Now that the known issues in the Cairo graphics backend have been fixed, it is possible to provide SVG support using Cairo.
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 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.
Created attachment 15003 [details] Cairo SVG support, take two This patch addresses the style concerns in the review plus a couple of cleanups.
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.
(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.
Landed in r23507.