Bug 14060 - [CAIRO] SVG support
Summary: [CAIRO] SVG support
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Alp Toker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-10 01:03 PDT by Alp Toker
Modified: 2007-06-13 13:51 PDT (History)
0 users

See Also:


Attachments
Cairo SVG support (25.30 KB, patch)
2007-06-13 07:45 PDT, Alp Toker
rwlbuis: review-
Details | Formatted Diff | Diff
Cairo SVG support, take two (25.09 KB, patch)
2007-06-13 11:05 PDT, Alp Toker
rwlbuis: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alp Toker 2007-06-10 01:03:51 PDT
Now that the known issues in the Cairo graphics backend have been fixed, it is possible to provide SVG support using Cairo.
Comment 1 Alp Toker 2007-06-13 07:45:06 PDT
Created attachment 15001 [details]
Cairo SVG support

 ChangeLog                                                   |   29 ++
 WebCore.pro                                                 |   15 +
 platform/graphics/svg/SVGPaintServerPattern.h               |    2 
 platform/graphics/svg/SVGPaintServerSolid.h                 |    2 
 platform/graphics/svg/cairo/RenderPathCairo.cpp             |   58 +++++
 platform/graphics/svg/cairo/SVGPaintServerCairo.cpp         |   71 +++++++
 platform/graphics/svg/cairo/SVGPaintServerGradientCairo.cpp |  118 ++++++++++++
 platform/graphics/svg/cairo/SVGPaintServerPatternCairo.cpp  |   42 ++++
 platform/graphics/svg/cairo/SVGPaintServerSolidCairo.cpp    |   78 +++++++
 platform/graphics/svg/cairo/SVGResourceClipperCairo.cpp     |   69 +++++++
 platform/graphics/svg/cairo/SVGResourceMaskerCairo.cpp      |   50 +++++
 11 files changed, 532 insertions(+), 2 deletions(-)


Support is fairly complete except for gradients, but there are still some TODOs and extensive testing against the SVG test suite is still needed.
Comment 2 Rob Buis 2007-06-13 10:17:44 PDT
Comment on attachment 15001 [details]
Cairo SVG support


>+
>+        if (boundingBoxMode()) {
>+            // TODO: use RenderPathCairo's strokeBBox?
>+            double x1, y1, x2, y2;
>+            cairo_fill_extents(cr, &x1, &y1, &x2, &y2);
>+            cairo_matrix_translate(&matrix, x1, y1);
>+            cairo_matrix_scale(&matrix, x2 - x1, y2 - y1);
>+            cairo_matrix_multiply(&matrix, &matrix, &gradient_matrix);
>+            cairo_matrix_invert(&matrix);
>+        {
>+        double x0, x1, y0, y1;
>+            x0 = linear->gradientStart().x();
>+            y0 = linear->gradientStart().y();
>+            x1 = linear->gradientEnd().x();
>+            y1 = linear->gradientEnd().y();
>+            pattern = cairo_pattern_create_linear(x0, y0, x1, y1);
>+        }
>+        } else return false;

I can't tell what is going on there, do you mean a if/ilse? If it is an anonymous block, that is hard to read, please rewrite so it doesnt have one.

>+        delete dsh;

Should use delete[].


>+        if(path.isEmpty())
>+    if(!surface)

Style issues.

So all issues need fixing.
Cheers,

Rob.
Comment 3 Alp Toker 2007-06-13 11:05:41 PDT
Created attachment 15003 [details]
Cairo SVG support, take two

This patch addresses the style concerns in the review plus a couple of cleanups.
Comment 4 Rob Buis 2007-06-13 11:17:05 PDT
Comment on attachment 15003 [details]
Cairo SVG support, take two

Its fine. One minor thing, you may want to lose x0, x1, y0, y1 and just write out the calls, but its a preference thing I think.
Comment 5 Alp Toker 2007-06-13 11:29:38 PDT
(In reply to comment #4)
> (From update of attachment 15003 [details] [edit])
> Its fine. One minor thing, you may want to lose x0, x1, y0, y1 and just write
> out the calls, but its a preference thing I think.
> 

I'm OK with it as-is for now. The gradient code will be re-visited soon anyway, as it still needs work and probably won't look like this when it's finished.
Comment 6 Mark Rowe (bdash) 2007-06-13 13:51:09 PDT
Landed in r23507.