Bug 18808

Summary: [CAIRO] minor problems with SVG-Gradients
Product: WebKit Reporter: Dirk Schulze <krit>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal Keywords: Cairo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
GradientFix
none
Fixes Gradients
none
Fixes Gradients
none
Fixes Gradients
none
Fixes Gradients zimmermann: review+

Description Dirk Schulze 2008-04-30 00:40:25 PDT
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)
Comment 1 Dirk Schulze 2008-04-30 00:53:20 PDT
Created attachment 20899 [details]
GradientFix

Fixes point 1 and 2.
Comment 2 Dirk Schulze 2008-04-30 14:28:17 PDT
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).
Comment 3 Eric Seidel (no email) 2008-05-01 19:30:29 PDT
I could have sworn I reviewed this exact patch already on some other bug?
Comment 4 Dirk Schulze 2008-05-02 06:33:25 PDT
(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.
Comment 5 Dirk Schulze 2008-05-08 11:35:39 PDT
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.
Comment 6 Dirk Schulze 2008-05-23 07:28:30 PDT
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.
Comment 7 Dirk Schulze 2008-05-30 04:00:45 PDT
Created attachment 21429 [details]
Fixes Gradients

Modified coding-style to the one of SVG/Cairo patterns.
Comment 8 Dirk Schulze 2008-06-24 09:18:28 PDT
Created attachment 21909 [details]
Fixes Gradients

forgot my email
Comment 9 Nikolas Zimmermann 2008-07-05 12:35:09 PDT
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 :-)
Comment 10 Mark Rowe (bdash) 2008-07-26 22:41:07 PDT
Landed in r35391.