There are still some minor problems with SVG Gradients. 1.Stroke of objects aren't handled with gradients at present. 2.If a stop is less than all previous stops, it is set equal to the largest stop: http://www.w3.org/Graphics/SVG/Test/20061213/htmlEmbedHarness/full-pservers-grad-16-b.html 3.If you fill the stroke of a line with a gradient without stoppoints (only color-set), CAIRO stops rendering at this point: http://www.w3.org/Graphics/SVG/Test/20061213/htmlEmbedHarness/full-pservers-grad-17-b.html (only related to lines) 4.If you use an own font-family (with glyph) a gradient is drawn for every glyph instead for the hole text. http://www.w3.org/Graphics/SVG/Test/20061213/htmlEmbedHarness/full-pservers-grad-08-b.html (can only be seen if you modify FontCairo, to draw texts with colors, gradients, pattern for SVG)
Created attachment 20899 [details] GradientFix Fixes point 1 and 2.
Point 3 is related to the boundingBoxMode. FloatRect bbox = object->relativeBBox(false); gets (0,0,0,0). Thats why cairo stops rendering. I have no idea what could be the reason. object->relativeBBox(false) seems to call FloatRect(const IntRect& r) ... in FloatRect.cpp and FloatRect should give the right values but gives (0,0,0,0).
I could have sworn I reviewed this exact patch already on some other bug?
(In reply to comment #3) > I could have sworn I reviewed this exact patch already on some other bug? > Nearly the same, on another bug yes :-) 18700. I reseted the review-tag to none, since it is clear, how the code should be shared.
Created attachment 21022 [details] Fixes Gradients This patch fixes 1, 2 and 3. The problem for 3 was PathCairo. PathCairo uses cairo_fill_extends instead of cairo_path_extends (like suggested in the manual of cairo). Thats why boundingBox gets (0,0,0,0). The SVG-test-suite of W3C runs smooth with one exception: point 4. 4 is related to FontCairo and should be fixed there. As long as it is not clear which code should be shared with the other PaintServers (look #18700), the review-flag is empty.
Created attachment 21309 [details] Fixes Gradients Additional fix for radial gradients with bounding box. (see http://www.w3.org/Graphics/SVG/Test/20061213/htmlEmbedHarness/full-pservers-grad-13-b.html last two boxes). A focus have to be inside a radius of a gradient.
Created attachment 21429 [details] Fixes Gradients Modified coding-style to the one of SVG/Cairo patterns.
Created attachment 21909 [details] Fixes Gradients forgot my email
Good job, indeed the paintserver code has to be shared across all implementations. The long term goal is to remove the whole specialized painting abstraction for SVG anyway and join with GraphicsContext used throughout WebCore. Have a nice weekend :-)
Landed in r35391.