[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zimmermann at webkit.org zimmermann at webkit.org
Wed Dec 22 14:26:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 10ff905c26b34fa7fb4e9a45a79cc57ffe7881a8
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 8 18:33:34 2010 +0000

    2010-10-08  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            gradient stroke on lines does not work
            https://bugs.webkit.org/show_bug.cgi?id=40985
    
            Correct handling of invalid fill/stroke paint servers / colors according to SVG 1.1 2nd Edition.
            Perfectly matches Opera, and now lets us pass three of the new tests.
    
            Fix incorrect svg/custom/invalid-fill* tests:
            -> If there's an invalid fill URI, but no fallback specified, it is as if fill="black" was specified. (invalid-fill.svg)
            -> If there's an invalid fill color, but no fallback specified, it is as if fill="none" was specified. (invalid-fill-hex.svg)
    
            Needed to refactor some of the gradient/pattern code to properly handle fallback paint servers.
            As side effect, we're allowing gradients with gradientUnits="userSpaceOnUse" to apply on 1d objects (lines) again, per SVG 1.1 2nd edition.
    
            Tests: svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg
                   svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg
                   svg/W3C-SVG-1.1-SE/pservers-grad-20-b.svg
    
            * rendering/RenderSVGResource.cpp: Rewrite fill/stroke paint resource requests, share all code between the similar functions.
            (WebCore::requestPaintingResource):
            (WebCore::RenderSVGResource::fillPaintingResource):
            (WebCore::RenderSVGResource::strokePaintingResource):
            * rendering/RenderSVGResource.h:
            * rendering/RenderSVGResourceGradient.cpp: Split collecting gradient properties from building the gradient. We don't need to build it, if it's not applyable (eg. on 1d lines).
            (WebCore::RenderSVGResourceGradient::RenderSVGResourceGradient):
            (WebCore::RenderSVGResourceGradient::removeAllClientsFromCache):
            (WebCore::clipToTextMask):
            (WebCore::RenderSVGResourceGradient::applyResource):
            * rendering/RenderSVGResourceGradient.h: Stop storing boundingBoxMode & gradientTransform in each GradientData object, it's enough to just store it in the gradient resource, once.
            * rendering/RenderSVGResourceLinearGradient.cpp:
            (WebCore::RenderSVGResourceLinearGradient::collectGradientAttributes): Splitted from buildGradient.
            (WebCore::RenderSVGResourceLinearGradient::buildGradient):
            * rendering/RenderSVGResourceLinearGradient.h:
            (WebCore::RenderSVGResourceLinearGradient::boundingBoxMode): Return bounding box mode information, from m_attributes instead of storing in gradientData.
            (WebCore::RenderSVGResourceLinearGradient::calculateGradientTransform): Ditto.
            * rendering/RenderSVGResourcePattern.cpp: Split collecting pattern properties from building the pattern. We don't need to build it, if it's not applyable (eg. on 1d lines).
            (WebCore::RenderSVGResourcePattern::RenderSVGResourcePattern):
            (WebCore::RenderSVGResourcePattern::removeAllClientsFromCache):
            (WebCore::RenderSVGResourcePattern::applyResource):
            (WebCore::RenderSVGResourcePattern::buildTileImageTransform):
            * rendering/RenderSVGResourcePattern.h:
            * rendering/RenderSVGResourceRadialGradient.cpp:
            (WebCore::RenderSVGResourceRadialGradient::collectGradientAttributes):
            (WebCore::RenderSVGResourceRadialGradient::buildGradient):
            * rendering/RenderSVGResourceRadialGradient.h:
            (WebCore::RenderSVGResourceRadialGradient::boundingBoxMode):
            (WebCore::RenderSVGResourceRadialGradient::calculateGradientTransform):
            * rendering/SVGRenderTreeAsText.cpp: Adapt to change, that fill/strokePaintingResource now take a Color& fallbackColor parameter.
            (WebCore::writeStyle):
            (WebCore::writeSVGResourceContainer):
            * rendering/svg/RenderSVGPath.cpp:
            (WebCore::RenderSVGPath::fillContains): Ditto.
            (WebCore::RenderSVGPath::strokeContains): Ditto.
            (WebCore::RenderSVGPath::fillAndStrokePath): Properly handle fallback color, if an existing (!) paint server failed to apply.
            * rendering/svg/SVGInlineTextBox.cpp:
            (WebCore::SVGInlineTextBox::acquirePaintingResource): Ditto.
            * svg/SVGLinearGradientElement.cpp:
            (WebCore::SVGLinearGradientElement::collectGradientAttributes): Pass LinearGradientAttributes by reference, instead of returning a copy.
            * svg/SVGLinearGradientElement.h: Rename collectGradientProperties to collectGradientAttributes.
            * svg/SVGPatternElement.cpp:
            (WebCore::SVGPatternElement::collectPatternAttributes): Pass PatternAttributes by reference, instead of returning.
            * svg/SVGPatternElement.h: Rename collectPatternProperties to collectPatternAttributes.
            * svg/SVGRadialGradientElement.cpp:
            (WebCore::SVGRadialGradientElement::collectGradientAttributes): Pass RadialGradientAttributes by reference, instead of returning a copy.
            * svg/SVGRadialGradientElement.h: Rename collectGradientProperties to collectGradientAttributes.
    
    2010-10-08  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            gradient stroke on lines does not work
            https://bugs.webkit.org/show_bug.cgi?id=40985
    
            * platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.checksum:
            * platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.png:
            * platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.checksum:
            * platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.png:
            * platform/mac-leopard/svg/custom/invalid-fill-expected.checksum:
            * platform/mac-leopard/svg/custom/invalid-fill-expected.png:
            * platform/mac-leopard/svg/custom/invalid-fill-hex-expected.checksum:
            * platform/mac-leopard/svg/custom/invalid-fill-hex-expected.png:
            * platform/mac/svg/W3C-SVG-1.1-SE: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.checksum: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.png: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.checksum: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.png: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.checksum: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.png: Added.
            * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt: Added.
            * platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt:
            * platform/mac/svg/custom/dominant-baseline-hanging-expected.txt:
            * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum:
            * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png:
            * platform/mac/svg/custom/invalid-fill-expected.txt:
            * platform/mac/svg/custom/invalid-fill-hex-expected.txt:
            * svg/W3C-SVG-1.1-SE: Added.
            * svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg: Added.
            * svg/W3C-SVG-1.1-SE/pservers-grad-20-b.svg: Added.
            * svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg: Added.
            * svg/custom/gradient-with-1d-boundingbox-expected.txt:
            * svg/custom/gradient-with-1d-boundingbox.svg: Add new test covering gradientUnits="userSpaceOnUse" on 1d lines, which is explicitely allowed.
            * svg/custom/invalid-fill-hex.svg: Fix invalid test, fill="none", is the default if the given fill color is invalid, according to SVG 1.1 2nd Edition.
            * svg/custom/invalid-fill.svg: Update test comments, that we match Opera in both tests, and the new SVG 1.1 2nd Edition specification.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69413 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b4fd315..b47e95b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,43 @@
+2010-10-08  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        gradient stroke on lines does not work
+        https://bugs.webkit.org/show_bug.cgi?id=40985
+
+        * platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.checksum:
+        * platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.png:
+        * platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.checksum:
+        * platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.png:
+        * platform/mac-leopard/svg/custom/invalid-fill-expected.checksum:
+        * platform/mac-leopard/svg/custom/invalid-fill-expected.png:
+        * platform/mac-leopard/svg/custom/invalid-fill-hex-expected.checksum:
+        * platform/mac-leopard/svg/custom/invalid-fill-hex-expected.png:
+        * platform/mac/svg/W3C-SVG-1.1-SE: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.checksum: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.png: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.checksum: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.png: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.checksum: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.png: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt: Added.
+        * platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt:
+        * platform/mac/svg/custom/dominant-baseline-hanging-expected.txt:
+        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum:
+        * platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png:
+        * platform/mac/svg/custom/invalid-fill-expected.txt:
+        * platform/mac/svg/custom/invalid-fill-hex-expected.txt:
+        * svg/W3C-SVG-1.1-SE: Added.
+        * svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg: Added.
+        * svg/W3C-SVG-1.1-SE/pservers-grad-20-b.svg: Added.
+        * svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg: Added.
+        * svg/custom/gradient-with-1d-boundingbox-expected.txt:
+        * svg/custom/gradient-with-1d-boundingbox.svg: Add new test covering gradientUnits="userSpaceOnUse" on 1d lines, which is explicitely allowed.
+        * svg/custom/invalid-fill-hex.svg: Fix invalid test, fill="none", is the default if the given fill color is invalid, according to SVG 1.1 2nd Edition.
+        * svg/custom/invalid-fill.svg: Update test comments, that we match Opera in both tests, and the new SVG 1.1 2nd Edition specification.
+
 2010-10-08  Zhenyao Mo  <zmo at google.com>
 
         Unreviewed, update WebGL test expectations.
diff --git a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.checksum b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.checksum
index cebe786..0626ab7 100644
--- a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.checksum
+++ b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.checksum
@@ -1 +1 @@
-a2d6151141b94ee96133d7a51985c1cc
\ No newline at end of file
+8a6985e97c3df18d41d047134357f1a8
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.png b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.png
index 68ab521..0f0853d 100644
Binary files a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.png and b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.png differ
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.checksum b/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.checksum
index 3eb9a01..442cb28 100644
--- a/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.checksum
+++ b/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.checksum
@@ -1 +1 @@
-9e7cf52b3586c60f7dcc6243af03b841
\ No newline at end of file
+60e8b9aea7e0e2df28114dadb5c5ee69
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.png b/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.png
index 6c70715..bf09c7f 100644
Binary files a/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.png and b/LayoutTests/platform/mac-leopard/svg/custom/dominant-baseline-hanging-expected.png differ
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.checksum b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.checksum
index fe39913..f31df4c 100644
--- a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.checksum
+++ b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.checksum
@@ -1 +1 @@
-8acbc464eb151142f75abc702defba4d
\ No newline at end of file
+27ca0307195f2f518ccd64c72a94bdf4
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.png b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.png
index 0f243bc..b3469dc 100644
Binary files a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.png and b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-expected.png differ
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.checksum b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.checksum
index bb85e8f..625e287 100644
--- a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.checksum
+++ b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.checksum
@@ -1 +1 @@
-1639a4a9b4f20ac0c9a8385b4a59f2cf
\ No newline at end of file
+da10e90b4ded38714424540666d8524f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.png b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.png
index 578b098..ea64ea5 100644
Binary files a/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.png and b/LayoutTests/platform/mac-leopard/svg/custom/invalid-fill-hex-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.checksum b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.checksum
new file mode 100644
index 0000000..a82bdb2
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.checksum
@@ -0,0 +1 @@
+1e3873009f2763a0d64ce5739f846ae0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.png
new file mode 100644
index 0000000..642db98
Binary files /dev/null and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt
new file mode 100644
index 0000000..24d02dd
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt
@@ -0,0 +1,44 @@
+layer at (0,0) size 480x360
+  RenderView at (0,0) size 480x360
+layer at (0,0) size 480x360
+  RenderSVGRoot {svg} at (0,0) size 480x360
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderSVGContainer {g} at (49,81) size 376x172
+      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+        RenderSVGResourceLinearGradient {linearGradient} [id="grad"] [gradientUnits=objectBoundingBox] [start=(0,0)] [end=(1,0)]
+          RenderSVGGradientStop {stop} [offset=0.00] [color=#000000]
+          RenderSVGGradientStop {stop} [offset=1.00] [color=#FFFFFF]
+      RenderSVGContainer {g} at (49,81) size 146x146 [transform={m=((0.30,0.00)(0.00,0.30)) t=(50.00,100.00)}]
+        RenderSVGPath {line} at (50,151) size 144x6 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (68,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (119,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (68,100) size 108x108 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=410.00] [y1=10.00] [x2=70.00] [y2=350.00]
+        RenderSVGPath {rect} at (49,81) size 146x146 [stroke={[type=SOLID] [color=#000000]}] [x=0.00] [y=-60.00] [width=480.00] [height=480.00]
+      RenderSVGText {text} at (69,236) size 102x17 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 102x17
+          chunk 1 (middle anchor) text run 1 at (69.04,250.00) startOffset 0 endOffset 1 width 16.99: "W"
+          chunk 1 (middle anchor) text run 2 at (86.02,250.00) startOffset 1 endOffset 3 width 9.00: "it"
+          chunk 1 (middle anchor) text run 3 at (94.96,250.00) startOffset 3 endOffset 6 width 20.02: "h f"
+          chunk 1 (middle anchor) text run 4 at (114.82,250.00) startOffset 6 endOffset 12 width 47.02: "allbac"
+          chunk 1 (middle anchor) text run 5 at (161.96,250.00) startOffset 12 endOffset 13 width 9.00: "k"
+      RenderSVGContainer {g} at (279,81) size 146x146 [transform={m=((0.30,0.00)(0.00,0.30)) t=(280.00,100.00)}]
+        RenderSVGPath {line} at (280,151) size 144x6 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (298,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (349,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (298,100) size 108x108 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=410.00] [y1=10.00] [x2=70.00] [y2=350.00]
+        RenderSVGPath {rect} at (279,81) size 146x146 [stroke={[type=SOLID] [color=#000000]}] [x=0.00] [y=-60.00] [width=480.00] [height=480.00]
+      RenderSVGText {text} at (286,236) size 128x17 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 128x17
+          chunk 1 (middle anchor) text run 1 at (286.53,250.00) startOffset 0 endOffset 1 width 16.99: "W"
+          chunk 1 (middle anchor) text run 2 at (303.51,250.00) startOffset 1 endOffset 3 width 9.00: "it"
+          chunk 1 (middle anchor) text run 3 at (312.45,250.00) startOffset 3 endOffset 9 width 45.04: "hout f"
+          chunk 1 (middle anchor) text run 4 at (357.33,250.00) startOffset 9 endOffset 15 width 47.02: "allbac"
+          chunk 1 (middle anchor) text run 5 at (404.47,250.00) startOffset 15 endOffset 16 width 9.00: "k"
+    RenderSVGContainer {g} at (10,314) size 227x32
+      RenderSVGText {text} at (10,314) size 227x32 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 227x32
+          chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 2 width 40.90: "$R"
+          chunk 1 text run 2 at (50.51,340.00) startOffset 2 endOffset 3 width 17.79: "e"
+          chunk 1 text run 3 at (67.82,340.00) startOffset 3 endOffset 12 width 117.38: "vision: 1"
+          chunk 1 text run 4 at (182.83,340.00) startOffset 12 endOffset 16 width 53.38: ".4 $"
+    RenderSVGPath {rect} at (0,0) size 480x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.checksum b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.checksum
new file mode 100644
index 0000000..2cf0bf7
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.checksum
@@ -0,0 +1 @@
+747ca26be1d55688ec474a7ad1a5aecb
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.png
new file mode 100644
index 0000000..2245fee
Binary files /dev/null and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt
new file mode 100644
index 0000000..1e4190f
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt
@@ -0,0 +1,44 @@
+layer at (0,0) size 480x360
+  RenderView at (0,0) size 480x360
+layer at (0,0) size 480x360
+  RenderSVGRoot {svg} at (0,0) size 480x360
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderSVGContainer {g} at (49,81) size 376x172
+      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+        RenderSVGResourceLinearGradient {linearGradient} [id="grad"] [gradientUnits=objectBoundingBox] [start=(0,0)] [end=(1,0)]
+          RenderSVGGradientStop {stop} [offset=0.00] [color=#000000]
+          RenderSVGGradientStop {stop} [offset=1.00] [color=#FFFFFF]
+      RenderSVGContainer {g} at (49,81) size 146x146 [transform={m=((0.30,0.00)(0.00,0.30)) t=(50.00,100.00)}]
+        RenderSVGPath {path} at (50,151) size 144x6 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 0 180 L 480 180"]
+        RenderSVGPath {path} at (68,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 0 180 L 480 180"]
+        RenderSVGPath {path} at (119,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 0 180 L 480 180"]
+        RenderSVGPath {path} at (68,100) size 108x108 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 410 10 L 70 350"]
+        RenderSVGPath {rect} at (49,81) size 146x146 [stroke={[type=SOLID] [color=#000000]}] [x=0.00] [y=-60.00] [width=480.00] [height=480.00]
+      RenderSVGText {text} at (69,236) size 102x17 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 102x17
+          chunk 1 (middle anchor) text run 1 at (69.04,250.00) startOffset 0 endOffset 1 width 16.99: "W"
+          chunk 1 (middle anchor) text run 2 at (86.02,250.00) startOffset 1 endOffset 3 width 9.00: "it"
+          chunk 1 (middle anchor) text run 3 at (94.96,250.00) startOffset 3 endOffset 6 width 20.02: "h f"
+          chunk 1 (middle anchor) text run 4 at (114.82,250.00) startOffset 6 endOffset 12 width 47.02: "allbac"
+          chunk 1 (middle anchor) text run 5 at (161.96,250.00) startOffset 12 endOffset 13 width 9.00: "k"
+      RenderSVGContainer {g} at (279,81) size 146x146 [transform={m=((0.30,0.00)(0.00,0.30)) t=(280.00,100.00)}]
+        RenderSVGPath {path} at (280,151) size 144x6 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 0 180 L 480 180"]
+        RenderSVGPath {path} at (298,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 0 180 L 480 180"]
+        RenderSVGPath {path} at (349,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 0 180 L 480 180"]
+        RenderSVGPath {path} at (298,100) size 108x108 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M 410 10 L 70 350"]
+        RenderSVGPath {rect} at (279,81) size 146x146 [stroke={[type=SOLID] [color=#000000]}] [x=0.00] [y=-60.00] [width=480.00] [height=480.00]
+      RenderSVGText {text} at (286,236) size 128x17 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 128x17
+          chunk 1 (middle anchor) text run 1 at (286.53,250.00) startOffset 0 endOffset 1 width 16.99: "W"
+          chunk 1 (middle anchor) text run 2 at (303.51,250.00) startOffset 1 endOffset 3 width 9.00: "it"
+          chunk 1 (middle anchor) text run 3 at (312.45,250.00) startOffset 3 endOffset 9 width 45.04: "hout f"
+          chunk 1 (middle anchor) text run 4 at (357.33,250.00) startOffset 9 endOffset 15 width 47.02: "allbac"
+          chunk 1 (middle anchor) text run 5 at (404.47,250.00) startOffset 15 endOffset 16 width 9.00: "k"
+    RenderSVGContainer {g} at (10,314) size 227x32
+      RenderSVGText {text} at (10,314) size 227x32 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 227x32
+          chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 2 width 40.90: "$R"
+          chunk 1 text run 2 at (50.51,340.00) startOffset 2 endOffset 3 width 17.79: "e"
+          chunk 1 text run 3 at (67.82,340.00) startOffset 3 endOffset 12 width 117.38: "vision: 1"
+          chunk 1 text run 4 at (182.83,340.00) startOffset 12 endOffset 16 width 53.38: ".7 $"
+    RenderSVGPath {rect} at (0,0) size 480x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.checksum b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.checksum
new file mode 100644
index 0000000..933b0aa
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.checksum
@@ -0,0 +1 @@
+2482f8554b0bcf6d521a1a7bc074106a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.png
new file mode 100644
index 0000000..abd72d8
Binary files /dev/null and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt
new file mode 100644
index 0000000..a602833
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt
@@ -0,0 +1,44 @@
+layer at (0,0) size 480x360
+  RenderView at (0,0) size 480x360
+layer at (0,0) size 480x360
+  RenderSVGRoot {svg} at (0,0) size 480x360
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderSVGContainer {g} at (39,59) size 402x202
+      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+        RenderSVGResourcePattern {pattern} [id="invisible1"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
+          RenderSVGPath {rect} at (0,0) size 480x360 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=480.00] [height=360.00]
+        RenderSVGResourcePattern {pattern} [id="invisible2"] [patternUnits=objectBoundingBox] [patternContentUnits=objectBoundingBox]
+          RenderSVGPath {rect} at (0,0) size 480x360 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=480.00] [height=360.00]
+        RenderSVGResourcePattern {pattern} [id="invisible3"] [patternUnits=objectBoundingBox] [patternContentUnits=objectBoundingBox]
+          RenderSVGPath {rect} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=1.00] [height=1.00]
+        RenderSVGResourcePattern {pattern} [id="invisible4"] [patternUnits=objectBoundingBox] [patternContentUnits=objectBoundingBox]
+          RenderSVGPath {rect} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=1.00] [height=1.00]
+        RenderSVGResourcePattern {pattern} [id="invisible5"] [patternUnits=userSpaceOnUse] [patternContentUnits=objectBoundingBox]
+          RenderSVGPath {rect} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=1.00] [height=1.00]
+        RenderSVGResourcePattern {pattern} [id="invisible6"] [patternUnits=userSpaceOnUse] [patternContentUnits=objectBoundingBox]
+          RenderSVGPath {rect} at (0,0) size 1x1 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=1.00] [height=1.00]
+        RenderSVGResourcePattern {pattern} [id="invisible7"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+          RenderSVGPath {rect} at (0,0) size 480x360 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=480.00] [height=360.00]
+      RenderSVGContainer {g} at (39,59) size 402x202 [transform={m=((1.00,0.00)(0.00,1.00)) t=(40.00,60.00)}]
+        RenderSVGPath {rect} at (39,59) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=PATTERN] [id="invisible1"]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+        RenderSVGPath {rect} at (139,59) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=PATTERN] [id="invisible2"]}] [x=100.00] [y=0.00] [width=100.00] [height=100.00]
+        RenderSVGPath {rect} at (239,59) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=PATTERN] [id="invisible3"]}] [x=200.00] [y=0.00] [width=100.00] [height=100.00]
+        RenderSVGPath {rect} at (339,59) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=PATTERN] [id="invisible4"]}] [x=300.00] [y=0.00] [width=100.00] [height=100.00]
+        RenderSVGPath {rect} at (39,159) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=PATTERN] [id="invisible5"]}] [x=0.00] [y=100.00] [width=100.00] [height=100.00]
+        RenderSVGPath {rect} at (139,159) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=PATTERN] [id="invisible6"]}] [x=100.00] [y=100.00] [width=100.00] [height=100.00]
+        RenderSVGPath {rect} at (239,159) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=PATTERN] [id="invisible7"]}] [x=200.00] [y=100.00] [width=100.00] [height=100.00]
+        RenderSVGPath {rect} at (339,159) size 102x102 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#00FF00]}] [x=300.00] [y=100.00] [width=100.00] [height=100.00]
+    RenderSVGContainer {g} at (10,314) size 223x32
+      RenderSVGText {text} at (10,314) size 223x32 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 223x32
+          chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 2 width 40.90: "$R"
+          chunk 1 text run 2 at (50.51,340.00) startOffset 2 endOffset 3 width 17.79: "e"
+          chunk 1 text run 3 at (67.82,340.00) startOffset 3 endOffset 12 width 117.38: "vision: 1"
+          chunk 1 text run 4 at (182.83,340.00) startOffset 12 endOffset 13 width 8.90: "."
+          chunk 1 text run 5 at (188.50,340.00) startOffset 13 endOffset 16 width 44.48: "1 $"
+    RenderSVGPath {rect} at (0,0) size 480x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
+    RenderSVGContainer {g} at (0,0) size 480x23
+      RenderSVGPath {rect} at (0,0) size 480x22 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FF0000]}] [x=1.00] [y=1.00] [width=478.00] [height=20.00]
+      RenderSVGText {text} at (206,1) size 68x21 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 68x21
+          chunk 1 (middle anchor) text run 1 at (206.67,18.00) startOffset 0 endOffset 5 width 66.66: "DRAFT"
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt
index 930e46c..4fede00 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-17-b-expected.txt
@@ -9,9 +9,9 @@ layer at (0,0) size 480x360
           RenderSVGGradientStop {stop} [offset=1.00] [color=#FFFFFF]
       RenderSVGContainer {g} at (49,81) size 146x146 [transform={m=((0.30,0.00)(0.00,0.30)) t=(50.00,100.00)}]
         RenderSVGPath {rect} at (49,81) size 146x146 [stroke={[type=SOLID] [color=#000000]}] [x=0.00] [y=-60.00] [width=480.00] [height=480.00]
-        RenderSVGPath {line} at (50,151) size 144x6 [stroke={[type=SOLID] [color=#000000] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
-        RenderSVGPath {line} at (68,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=SOLID] [color=#000000] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
-        RenderSVGPath {line} at (119,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=SOLID] [color=#000000] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (50,151) size 144x6 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (68,100) size 108x108 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(197.57,-116.98)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
+        RenderSVGPath {line} at (119,82) size 6x144 [transform={m=((0.00,1.00)(-1.00,0.00)) t=(420.00,-60.00)}] [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=180.00] [x2=480.00] [y2=180.00]
         RenderSVGPath {line} at (68,100) size 108x108 [stroke={[type=LINEAR-GRADIENT] [id="grad"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=410.00] [y1=10.00] [x2=70.00] [y2=350.00]
       RenderSVGText {text} at (84,236) size 72x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 72x18
diff --git a/LayoutTests/platform/mac/svg/custom/dominant-baseline-hanging-expected.txt b/LayoutTests/platform/mac/svg/custom/dominant-baseline-hanging-expected.txt
index 1ae7b3e..eb8609d 100644
--- a/LayoutTests/platform/mac/svg/custom/dominant-baseline-hanging-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/dominant-baseline-hanging-expected.txt
@@ -16,8 +16,8 @@ layer at (0,0) size 400x400
     RenderSVGContainer {g} at (9,6) size 381x29 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,10.00)}]
       RenderSVGPath {rect} at (10,10) size 380x25 [opacity=0.50] [fill={[type=SOLID] [color=#FFFFFF]}] [x=0.00] [y=0.00] [width=380.00] [height=25.00]
       RenderSVGContainer {g} at (8,8) size 382x27 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-0.50,-0.50)}]
-        RenderSVGPath {line} at (9,8) size 381x3 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=0.00] [x2=380.00] [y2=0.00]
-        RenderSVGPath {line} at (8,8) size 3x27 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=-0.50] [x2=0.00] [y2=25.00]
+        RenderSVGPath {line} at (9,8) size 381x3 [stroke={[type=LINEAR-GRADIENT] [id="h_stroke_gradient"]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=0.00] [x2=380.00] [y2=0.00]
+        RenderSVGPath {line} at (8,8) size 3x27 [stroke={[type=LINEAR-GRADIENT] [id="v_stroke_gradient"]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=-0.50] [x2=0.00] [y2=25.00]
       RenderSVGText {text} at (2,-4) size 323x24 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 323x24
           chunk 1 text run 1 at (2.00,14.40) startOffset 0 endOffset 40 width 323.00: "This is hanging from the top-left corner"
diff --git a/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum b/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum
index 9868c28..e576e53 100644
--- a/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum
+++ b/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.checksum
@@ -1 +1 @@
-b9f116b4a960c013825104fa2c8b2e78
\ No newline at end of file
+3f6d4777a259e0d25edaa55060258e45
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png b/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png
index 1bd368d..1d312ab 100644
Binary files a/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png and b/LayoutTests/platform/mac/svg/custom/gradient-with-1d-boundingbox-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/invalid-fill-expected.txt b/LayoutTests/platform/mac/svg/custom/invalid-fill-expected.txt
index 529538f..8ed1c37 100644
--- a/LayoutTests/platform/mac/svg/custom/invalid-fill-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/invalid-fill-expected.txt
@@ -1,11 +1,11 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (0,0) size 677x194
-    RenderSVGContainer {g} at (0,0) size 677x194
+  RenderSVGRoot {svg} at (0,0) size 677x214
+    RenderSVGContainer {g} at (0,0) size 677x214
       RenderSVGPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
       RenderSVGPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
-      RenderSVGContainer {g} at (10,116) size 667x78
+      RenderSVGContainer {g} at (10,116) size 667x98
         RenderSVGText {text} at (10,116) size 223x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 223x18
             chunk 1 text run 1 at (10.00,130.00) startOffset 0 endOffset 31 width 223.00: "The above rect should be BLACK."
@@ -15,7 +15,9 @@ layer at (0,0) size 800x600
         RenderSVGText {text} at (10,156) size 468x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 468x18
             chunk 1 text run 1 at (10.00,170.00) startOffset 0 endOffset 77 width 468.00: "Browsers don't display such an error, instead use some sort of fill-fallback."
-        RenderSVGText {text} at (10,176) size 546x18 contains 1 chunk(s)
-          RenderSVGInlineText {#text} at (0,0) size 546x18
-            chunk 1 text run 1 at (10.00,190.00) startOffset 0 endOffset 81 width 471.00: "Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'black'. "
-            chunk 1 text run 1 at (481.00,190.00) startOffset 0 endOffset 10 width 75.00: "Bug 11017."
+        RenderSVGText {text} at (10,176) size 566x18 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 566x18
+            chunk 1 text run 1 at (10.00,190.00) startOffset 0 endOffset 98 width 566.00: "If there's an invalid fill URI, but no fallback specified, it is as if fill=\"black\" was specified."
+        RenderSVGText {text} at (10,196) size 555x18 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 555x18
+            chunk 1 text run 1 at (10.00,210.00) startOffset 0 endOffset 84 width 555.00: "This has recently been changed in SVG 1.1 2nd edition. Our result matches Opera now."
diff --git a/LayoutTests/platform/mac/svg/custom/invalid-fill-hex-expected.txt b/LayoutTests/platform/mac/svg/custom/invalid-fill-hex-expected.txt
index 1ef2690..c0b3ec1 100644
--- a/LayoutTests/platform/mac/svg/custom/invalid-fill-hex-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/invalid-fill-hex-expected.txt
@@ -1,21 +1,23 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (0,0) size 656x194
-    RenderSVGContainer {g} at (0,0) size 656x194
+  RenderSVGRoot {svg} at (0,0) size 656x214
+    RenderSVGContainer {g} at (0,0) size 656x214
       RenderSVGPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
-      RenderSVGPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
-      RenderSVGContainer {g} at (10,116) size 646x78
-        RenderSVGText {text} at (10,116) size 223x18 contains 1 chunk(s)
-          RenderSVGInlineText {#text} at (0,0) size 223x18
-            chunk 1 text run 1 at (10.00,130.00) startOffset 0 endOffset 31 width 223.00: "The above rect should be BLACK."
+      RenderSVGPath {rect} at (0,0) size 100x100 [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+      RenderSVGContainer {g} at (10,116) size 646x98
+        RenderSVGText {text} at (10,116) size 200x18 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 200x18
+            chunk 1 text run 1 at (10.00,130.00) startOffset 0 endOffset 29 width 200.00: "The above rect should be RED."
         RenderSVGText {text} at (10,136) size 646x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 646x18
             chunk 1 text run 1 at (10.00,150.00) startOffset 0 endOffset 100 width 646.00: "SVG 1.1 FULL says there should be a \"highly perceivable error\" message when an invalid fill is used."
         RenderSVGText {text} at (10,156) size 468x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 468x18
             chunk 1 text run 1 at (10.00,170.00) startOffset 0 endOffset 77 width 468.00: "Browsers don't display such an error, instead use some sort of fill-fallback."
-        RenderSVGText {text} at (10,176) size 546x18 contains 1 chunk(s)
-          RenderSVGInlineText {#text} at (0,0) size 546x18
-            chunk 1 text run 1 at (10.00,190.00) startOffset 0 endOffset 81 width 471.00: "Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'black'. "
-            chunk 1 text run 1 at (481.00,190.00) startOffset 0 endOffset 10 width 75.00: "Bug 11017."
+        RenderSVGText {text} at (10,176) size 567x18 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 567x18
+            chunk 1 text run 1 at (10.00,190.00) startOffset 0 endOffset 99 width 567.00: "If there's an invalid fill color, but no fallback specified, it is as if fill=\"none\" was specified."
+        RenderSVGText {text} at (10,196) size 555x18 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 555x18
+            chunk 1 text run 1 at (10.00,210.00) startOffset 0 endOffset 84 width 555.00: "This has recently been changed in SVG 1.1 2nd edition. Our result matches Opera now."
diff --git a/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg
new file mode 100644
index 0000000..ada3ba5
--- /dev/null
+++ b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg
@@ -0,0 +1,92 @@
+<svg version="1.1" baseProfile="basic" id="svg-root"
+  width="100%" height="100%" viewBox="0 0 480 360"
+  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <!--======================================================================-->
+  <!--=  SVG 1.1 2nd Edition Test Case                                     =-->
+  <!--======================================================================-->
+  <!--=  Copyright 2009 World Wide Web Consortium, (Massachusetts          =-->
+  <!--=  Institute of Technology, European Research Consortium for         =-->
+  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
+  <!--=  All Rights Reserved.                                              =-->
+  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
+  <!--======================================================================-->
+  <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
+    template-version="1.4" reviewer="AE" author="ED" status="accepted"
+    version="$Revision: 1.4 $" testname="$RCSfile: pservers-grad-17-b.svg,v $">
+    <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/pservers.html#Gradients">
+        <p>
+          This test has a gradient with gradientUnits='objectBoundingBox' which is a fade from black to white.
+          The gradient is used for the stroke of a line. Vertical and horizontal lines don't have a boundingbox,
+          since they are one-dimensional, even though the
+          stroke-width makes it look like they should have a boundingbox with non-zero width and height.
+          See the coordinate chapter, last paragraph of 7.11.
+        </p>
+    </d:testDescription>
+    <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        [[
+        Describe how to use the here. The instructions should specify any
+        steps requied to run the test or any manual operation that need
+        to be performed to run the test.
+        ]]
+      </p>
+    </d:operatorScript>
+    <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        The left rectangle has four 'line' elements rotated in different ways. The stroke for the lines have a green solid stroke fallback which
+        should be used if the gradient should be ignored. For this sub-test to pass there must be three lines with solid green stroke, and one line
+        (from bottom left to top right) with a gradient stroke, visible in the rectangle.
+      </p>
+      <p>
+        The right rectangle is the same as the left rectangle except that the stroke paintservers don't have a fallback specified.
+        For this sub-test to pass only the line from bottom left to top right must be visible in the rectangle, and it must have a gradient stroke.
+      </p>
+    </d:passCriteria>
+  </d:SVGTestCase>
+  <title id="test-title">$RCSfile: pservers-grad-17-b.svg,v $</title>
+  <defs>
+    <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
+      <font-face-src>
+        <font-face-uri xlink:href="../custom/resources/SVGFreeSans.svg#ascii"/>
+      </font-face-src>
+    </font-face>
+  </defs>
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+    <defs>
+      <linearGradient id="grad">
+        <stop offset="0" stop-color="black"/>
+        <stop offset="1" stop-color="white"/>
+      </linearGradient>
+    </defs>
+
+    <!-- sub-test 1: stroke with solid color fallback -->
+    <g transform="translate(50, 100) scale(0.3)">
+      <line x1="0" y1="180" x2="480" y2="180" stroke="url(#grad) #0f0" stroke-width="20"/>
+      <line x1="0" y1="180" x2="480" y2="180" stroke="url(#grad) #0f0" stroke-width="20" transform="rotate(45 240 180)"/>
+      <line x1="0" y1="180" x2="480" y2="180" stroke="url(#grad) #0f0" stroke-width="20" transform="rotate(90 240 180)"/>
+      <line x1="410" y1="10" x2="70" y2="350" stroke="url(#grad) #0f0" stroke-width="20"/>
+      <rect x="0" y="-60" width="480" height="480" fill="none" stroke="black"/>
+    </g>
+    <text x="120" y="250" text-anchor="middle">With fallback</text>
+
+    <!-- sub-test 2: stroke without a fallback -->
+    <g transform="translate(280,100) scale(0.3)">
+      <line x1="0" y1="180" x2="480" y2="180" stroke="url(#grad)" stroke-width="20"/>
+      <line x1="0" y1="180" x2="480" y2="180" stroke="url(#grad)" stroke-width="20" transform="rotate(45 240 180)"/>
+      <line x1="0" y1="180" x2="480" y2="180" stroke="url(#grad)" stroke-width="20" transform="rotate(90 240 180)"/>
+      <line x1="410" y1="10" x2="70" y2="350" stroke="url(#grad)" stroke-width="20"/>
+      <rect x="0" y="-60" width="480" height="480" fill="none" stroke="black"/>
+    </g>
+    <text x="350" y="250" text-anchor="middle">Without fallback</text>
+  </g>
+  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
+    <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.4 $</text>
+  </g>
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
+  <!-- comment out this watermark once the test is approved -->
+  <!--<g id="draft-watermark">
+    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
+    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
+      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
+  </g>-->
+</svg>
diff --git a/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-grad-20-b.svg b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-grad-20-b.svg
new file mode 100644
index 0000000..9e32050
--- /dev/null
+++ b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-grad-20-b.svg
@@ -0,0 +1,92 @@
+<svg id="svg-root" width="100%" height="100%" 
+  viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" 
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+  <!--======================================================================-->
+  <!--=  Copyright 2008 World Wide Web Consortium, (Massachusetts          =-->
+  <!--=  Institute of Technology, European Research Consortium for         =-->
+  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
+  <!--=  All Rights Reserved.                                              =-->
+  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
+  <!--======================================================================-->
+  <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
+    template-version="1.4" reviewer="AG" author="ED" status="accepted"
+    version="$Revision: 1.7 $" testname="$RCSfile: pservers-grad-20-b.svg,v $">
+    <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/animate.html#InterfaceSVGAnimationElement">
+        <p>
+          This test has a gradient with gradientUnits='objectBoundingBox' which is a fade from black to white.
+          The gradient is used for the stroke of a line. Vertical and horizontal lines don't have a boundingbox, since they are one-dimensional, even though the
+          stroke-width makes it look like they should have a boundingbox with non-zero width and height.
+          See the coordinate chapter, last paragraph of 7.11.
+        </p>
+    </d:testDescription>
+    <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        The left rectangle has four 'line' elements rotated in different ways. The stroke for the lines have a green solid stroke fallback which
+        should be used if the gradient should be ignored.
+
+        The right rectangle is the same as the left rectangle except that the stroke paintservers don't have a fallback specified.
+      </p>
+    </d:operatorScript>
+    <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        The test is passed if
+      </p>
+      <ul>
+        <li>
+          there are three lines with solid green stroke, and one line
+          (from bottom left to top right) with a gradient stroke, visible in the left rectangle.
+        </li>
+        <li>there is a line from bottom left to top right with a gradient stroke, visible in the right rectangle.</li>
+      </ul>
+    </d:passCriteria>
+  </d:SVGTestCase>
+  <title id="test-title">$RCSfile: pservers-grad-20-b.svg,v $</title>
+  <defs>
+    <font-face
+      font-family="SVGFreeSansASCII"
+      unicode-range="U+0-7F">
+      <font-face-src>
+        <font-face-uri xlink:href="../custom/resources/SVGFreeSans.svg#ascii"/>
+      </font-face-src>
+    </font-face>
+  </defs>
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+    <defs>
+      <linearGradient id="grad">
+        <stop offset="0" stop-color="black" />
+        <stop offset="1" stop-color="white" />
+      </linearGradient>
+    </defs>
+    
+    <!-- sub-test 1: stroke with solid color fallback -->
+    <g transform="translate(50, 100) scale(0.3)">
+      <path d="M0 180L480 180" stroke="url(#grad) #0f0" stroke-width="20"/>
+      <path d="M0 180L480 180" stroke="url(#grad) #0f0" stroke-width="20" transform="rotate(45 240 180)"/>
+      <path d="M0 180L480 180" stroke="url(#grad) #0f0" stroke-width="20" transform="rotate(90 240 180)"/>
+      <path d="M410 10L70 350" stroke="url(#grad) #0f0" stroke-width="20"/>
+      <rect x="0" y="-60" width="480" height="480" fill="none" stroke="black"/>
+    </g>
+    <text x="120" y="250" text-anchor="middle">With fallback</text>
+    
+    <!-- sub-test 2: stroke without a fallback -->
+    <g transform="translate(280,100) scale(0.3)">
+      <path d="M0 180L480 180"	stroke="url(#grad)" stroke-width="20"/>
+      <path d="M0 180L480 180" stroke="url(#grad)" stroke-width="20" transform="rotate(45 240 180)"/>
+      <path d="M0 180L480 180" stroke="url(#grad)" stroke-width="20" transform="rotate(90 240 180)"/>
+      <path d="M410 10L70 350" stroke="url(#grad)" stroke-width="20"/>
+      <rect x="0" y="-60" width="480" height="480" fill="none" stroke="black"/>
+    </g>
+    <text x="350" y="250" text-anchor="middle">Without fallback</text>
+  </g>
+  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
+  <text id="revision" x="10" y="340" stroke="none" 
+    fill="black">$Revision: 1.7 $</text>
+  </g>
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
+  <!-- comment out this watermark once the test is approved -->
+  <!--<g id="draft-watermark">
+    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
+    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 
+      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
+  </g>-->
+</svg>
diff --git a/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg
new file mode 100644
index 0000000..55973c5
--- /dev/null
+++ b/LayoutTests/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg
@@ -0,0 +1,91 @@
+<svg id="svg-root" width="100%" height="100%"
+  viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+  <!--======================================================================-->
+  <!--=  Copyright 2008 World Wide Web Consortium, (Massachusetts          =-->
+  <!--=  Institute of Technology, European Research Consortium for         =-->
+  <!--=  Informatics and Mathematics (ERCIM), Keio University).            =-->
+  <!--=  All Rights Reserved.                                              =-->
+  <!--=  See http://www.w3.org/Consortium/Legal/.                          =-->
+  <!--======================================================================-->
+  <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
+    template-version="1.4" reviewer="[reviewer]" author="ED" status="created"
+    version="$Revision: 1.1 $" testname="$RCSfile: pservers-pattern-03-f.svg,v $">
+    <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/pservers.html#Patterns">
+      <p>
+        Test that empty patterns are not rendered, and that the fallback color is used instead.
+      </p>
+    </d:testDescription>
+    <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        Run the test. No interaction required.
+      </p>
+    </d:operatorScript>
+    <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
+      <p>
+        The test is passed if there are 8 green rectangles visible, and no red.
+      </p>
+    </d:passCriteria>
+  </d:SVGTestCase>
+  <title id="test-title">$RCSfile: pservers-pattern-03-f.svg,v $</title>
+  <defs>
+    <font-face
+      font-family="SVGFreeSansASCII"
+      unicode-range="U+0-7F">
+      <font-face-src>
+        <font-face-uri xlink:href="../custom/resources/SVGFreeSans.svg#ascii"/>
+      </font-face-src>
+    </font-face>
+  </defs>
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+
+    <defs>
+      <pattern id="invisible1">
+        <rect width="100%" height="100%" fill="red"/>
+      </pattern>
+      <pattern id="invisible2" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox">
+        <rect width="100%" height="100%" fill="red"/>
+      </pattern>
+      <pattern id="invisible3" width="0" height="0" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox">
+        <rect width="1" height="1" fill="red"/>
+      </pattern>
+      <pattern id="invisible4" width="0" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox">
+        <rect width="1" height="1" fill="red"/>
+      </pattern>
+      <pattern id="invisible5" width="0" height="0" patternUnits="userSpaceOnUse" patternContentUnits="objectBoundingBox">
+        <rect width="1" height="1" fill="red"/>
+      </pattern>
+      <pattern id="invisible6" height="0" patternUnits="userSpaceOnUse" patternContentUnits="objectBoundingBox">
+        <rect width="1" height="1" fill="red"/>
+      </pattern>
+      <pattern id="invisible7" height="0" patternUnits="userSpaceOnUse" patternContentUnits="userSpaceOnUse">
+        <rect width="100%" height="100%" fill="red"/>
+      </pattern>
+    </defs>
+
+    <g transform="translate(40 60)" stroke="black">
+      <rect width="100" height="100" fill="url(#invisible1) lime"/>
+      <rect x="100" width="100" height="100" fill="url(#invisible2) lime"/>
+      <rect x="200" width="100" height="100" fill="url(#invisible3) lime"/>
+      <rect x="300" width="100" height="100" fill="url(#invisible4) lime"/>
+
+      <rect y="100" width="100" height="100" fill="url(#invisible5) lime"/>
+      <rect x="100" y="100" width="100" height="100" fill="url(#invisible6) lime"/>
+      <rect x="200" y="100" width="100" height="100" fill="url(#invisible7) lime"/>
+      
+      <!-- note that this is on purpose testing a broken uri -->
+      <rect x="300" y="100" width="100" height="100" fill="url(#invisible8) lime"/>
+    </g>
+  </g>
+  <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
+    <text id="revision" x="10" y="340" stroke="none"
+      fill="black">$Revision: 1.1 $</text>
+  </g>
+  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
+  <!-- comment out this watermark once the test is approved -->
+  <g id="draft-watermark">
+    <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
+    <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
+      text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
+  </g>
+</svg>
diff --git a/LayoutTests/svg/custom/gradient-with-1d-boundingbox-expected.txt b/LayoutTests/svg/custom/gradient-with-1d-boundingbox-expected.txt
index aad86a0..8818c31 100644
--- a/LayoutTests/svg/custom/gradient-with-1d-boundingbox-expected.txt
+++ b/LayoutTests/svg/custom/gradient-with-1d-boundingbox-expected.txt
@@ -1,9 +1,20 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (0,40) size 200x20
+  RenderSVGRoot {svg} at (6,40) size 268x114
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
-      RenderSVGResourceLinearGradient {linearGradient} [id="gradient"] [gradientUnits=objectBoundingBox] [start=(0,0)] [end=(1,0)]
+      RenderSVGResourceLinearGradient {linearGradient} [id="gradient1"] [gradientUnits=objectBoundingBox] [start=(0,0)] [end=(1,0)]
         RenderSVGGradientStop {stop} [offset=0.00] [color=#FF0000]
         RenderSVGGradientStop {stop} [offset=1.00] [color=#008000]
-    RenderSVGPath {line} at (0,40) size 200x20 [stroke={[type=SOLID] [color=#00FF00] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=50.00] [x2=200.00] [y2=50.00]
+      RenderSVGResourceRadialGradient {radialGradient} [id="gradient2"] [gradientUnits=userSpaceOnUse] [center=(0,0)] [focal=(0,0)] [radius=9.00]
+        RenderSVGGradientStop {stop} [offset=0.00] [color=#FF0000]
+        RenderSVGGradientStop {stop} [offset=1.00] [color=#FF000000]
+    RenderSVGPath {line} at (20,40) size 200x20 [stroke={[type=LINEAR-GRADIENT] [id="gradient1"] [stroke width=20.00]}] [fill={[type=SOLID] [color=#000000]}] [x1=20.00] [y1=50.00] [x2=220.00] [y2=50.00]
+    RenderSVGContainer {g} at (111,91) size 18x18 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,100.00)}]
+      RenderSVGPath {line} at (111,99) size 18x2 [stroke={[type=RADIAL-GRADIENT] [id="gradient2"]}] [fill={[type=SOLID] [color=#000000]}] [x1=-9.00] [y1=0.00] [x2=9.00] [y2=0.00]
+      RenderSVGPath {line} at (119,91) size 2x18 [stroke={[type=RADIAL-GRADIENT] [id="gradient2"]}] [fill={[type=SOLID] [color=#000000]}] [x1=0.00] [y1=-9.00] [x2=0.00] [y2=9.00]
+      RenderSVGPath {line} at (112,92) size 16x16 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(0.00,0.00)}] [stroke={[type=RADIAL-GRADIENT] [id="gradient2"]}] [fill={[type=SOLID] [color=#000000]}] [x1=-9.00] [y1=0.00] [x2=9.00] [y2=0.00]
+      RenderSVGPath {line} at (112,92) size 16x16 [transform={m=((0.71,-0.71)(0.71,0.71)) t=(0.00,0.00)}] [stroke={[type=RADIAL-GRADIENT] [id="gradient2"]}] [fill={[type=SOLID] [color=#000000]}] [x1=-9.00] [y1=0.00] [x2=9.00] [y2=0.00]
+    RenderSVGText {text} at (6,136) size 268x18 contains 1 chunk(s)
+      RenderSVGInlineText {#text} at (0,0) size 268x18
+        chunk 1 (middle anchor) text run 1 at (6.50,150.00) startOffset 0 endOffset 43 width 267.00: "You should see a green line, and a red star"
diff --git a/LayoutTests/svg/custom/gradient-with-1d-boundingbox.svg b/LayoutTests/svg/custom/gradient-with-1d-boundingbox.svg
index d4babe4..534e0db 100644
--- a/LayoutTests/svg/custom/gradient-with-1d-boundingbox.svg
+++ b/LayoutTests/svg/custom/gradient-with-1d-boundingbox.svg
@@ -1,11 +1,26 @@
 <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<!-- Gradients can't applied on objects with a boundingBox, where either width or height is zero.
-     This test checks if we use a given alternative Color. -->
 <defs>
-<linearGradient id="gradient">
-    <stop offset="0" stop-color="red"/>
-    <stop offset="1" stop-color="green"/>
-</linearGradient>
+    <linearGradient id="gradient1">
+        <stop offset="0" stop-color="red"/>
+        <stop offset="1" stop-color="green"/>
+    </linearGradient>
+
+    <radialGradient id="gradient2" gradientUnits="userSpaceOnUse" cx="0" cy="0" r="9">
+        <stop offset="0" stop-color="red" />
+        <stop offset="1" stop-color="red" stop-opacity="0" />
+    </radialGradient>
 </defs>
-<line x1="0" x2="200" y1="50" y2="50" stroke="url(#gradient) #0f0" stroke-width="20"/>
+
+<!-- Gradients with objectBoundingBox units can't be applied to 1d objects -->
+<line x1="20" x2="220" y1="50" y2="50" stroke="url(#gradient1) #0f0" stroke-width="20"/>
+
+<!-- Gradients with userSpaceOnUse units can be applied to 1d objects -->
+<g transform="translate(120, 100)">
+    <line x1="-9" y1="0" x2="9" y2="0" stroke="url(#gradient2)" />
+    <line x1="0" y1="-9" x2="0" y2="9" stroke="url(#gradient2)" />
+    <line x1="-9" y1="0" x2="9" y2="0" stroke="url(#gradient2)" transform="rotate(45)" />
+    <line x1="-9" y1="0" x2="9" y2="0" stroke="url(#gradient2)" transform="rotate(-45)" />
+</g>
+
+<text x="140" y="150" text-anchor="middle">You should see a green line, and a red star</text>
 </svg>
diff --git a/LayoutTests/svg/custom/invalid-fill-hex.svg b/LayoutTests/svg/custom/invalid-fill-hex.svg
index 2b8dab1..1b9062b 100644
--- a/LayoutTests/svg/custom/invalid-fill-hex.svg
+++ b/LayoutTests/svg/custom/invalid-fill-hex.svg
@@ -4,10 +4,11 @@
     <rect width="100" height="100" fill="red"/>
     <rect width="100" height="100" fill="#ff"/>
     <g fill="black">
-      <text x="10" y="130">The above rect should be BLACK.</text>
+      <text x="10" y="130">The above rect should be RED.</text>
       <text x="10" y="150">SVG 1.1 FULL says there should be a "highly perceivable error" message when an invalid fill is used.</text>
       <text x="10" y="170">Browsers don't display such an error, instead use some sort of fill-fallback.</text>
-      <text x="10" y="190">Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'black'.  Bug 11017.</text>
+      <text x="10" y="190">If there's an invalid fill color, but no fallback specified, it is as if fill="none" was specified.</text>
+      <text x="10" y="210">This has recently been changed in SVG 1.1 2nd edition. Our result matches Opera now.</text>
     </g>
   </g>
 </svg>
diff --git a/LayoutTests/svg/custom/invalid-fill.svg b/LayoutTests/svg/custom/invalid-fill.svg
index 07a7f0f..617b334 100644
--- a/LayoutTests/svg/custom/invalid-fill.svg
+++ b/LayoutTests/svg/custom/invalid-fill.svg
@@ -7,7 +7,8 @@
       <text x="10" y="130">The above rect should be BLACK.</text>
       <text x="10" y="150">SVG 1.1 FULL says there should be a "highly perceivable error" message when an invalid fill url is used.</text>
       <text x="10" y="170">Browsers don't display such an error, instead use some sort of fill-fallback.</text>
-      <text x="10" y="190">Opera falls back to 'black' (default), Firefox to 'none', and Safari to 'black'.  Bug 11017.</text>
+      <text x="10" y="190">If there's an invalid fill URI, but no fallback specified, it is as if fill="black" was specified.</text>
+      <text x="10" y="210">This has recently been changed in SVG 1.1 2nd edition. Our result matches Opera now.</text>
     </g>
   </g>
 </svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index babffb0..e4c4566 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,72 @@
+2010-10-08  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        gradient stroke on lines does not work
+        https://bugs.webkit.org/show_bug.cgi?id=40985
+
+        Correct handling of invalid fill/stroke paint servers / colors according to SVG 1.1 2nd Edition.
+        Perfectly matches Opera, and now lets us pass three of the new tests.
+
+        Fix incorrect svg/custom/invalid-fill* tests:
+        -> If there's an invalid fill URI, but no fallback specified, it is as if fill="black" was specified. (invalid-fill.svg)
+        -> If there's an invalid fill color, but no fallback specified, it is as if fill="none" was specified. (invalid-fill-hex.svg)
+
+        Needed to refactor some of the gradient/pattern code to properly handle fallback paint servers.
+        As side effect, we're allowing gradients with gradientUnits="userSpaceOnUse" to apply on 1d objects (lines) again, per SVG 1.1 2nd edition.
+
+        Tests: svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg
+               svg/W3C-SVG-1.1-SE/pservers-grad-17-b.svg
+               svg/W3C-SVG-1.1-SE/pservers-grad-20-b.svg
+
+        * rendering/RenderSVGResource.cpp: Rewrite fill/stroke paint resource requests, share all code between the similar functions.
+        (WebCore::requestPaintingResource):
+        (WebCore::RenderSVGResource::fillPaintingResource):
+        (WebCore::RenderSVGResource::strokePaintingResource):
+        * rendering/RenderSVGResource.h:
+        * rendering/RenderSVGResourceGradient.cpp: Split collecting gradient properties from building the gradient. We don't need to build it, if it's not applyable (eg. on 1d lines).
+        (WebCore::RenderSVGResourceGradient::RenderSVGResourceGradient):
+        (WebCore::RenderSVGResourceGradient::removeAllClientsFromCache):
+        (WebCore::clipToTextMask):
+        (WebCore::RenderSVGResourceGradient::applyResource):
+        * rendering/RenderSVGResourceGradient.h: Stop storing boundingBoxMode & gradientTransform in each GradientData object, it's enough to just store it in the gradient resource, once.
+        * rendering/RenderSVGResourceLinearGradient.cpp:
+        (WebCore::RenderSVGResourceLinearGradient::collectGradientAttributes): Splitted from buildGradient.
+        (WebCore::RenderSVGResourceLinearGradient::buildGradient):
+        * rendering/RenderSVGResourceLinearGradient.h:
+        (WebCore::RenderSVGResourceLinearGradient::boundingBoxMode): Return bounding box mode information, from m_attributes instead of storing in gradientData.
+        (WebCore::RenderSVGResourceLinearGradient::calculateGradientTransform): Ditto.
+        * rendering/RenderSVGResourcePattern.cpp: Split collecting pattern properties from building the pattern. We don't need to build it, if it's not applyable (eg. on 1d lines).
+        (WebCore::RenderSVGResourcePattern::RenderSVGResourcePattern):
+        (WebCore::RenderSVGResourcePattern::removeAllClientsFromCache):
+        (WebCore::RenderSVGResourcePattern::applyResource):
+        (WebCore::RenderSVGResourcePattern::buildTileImageTransform):
+        * rendering/RenderSVGResourcePattern.h:
+        * rendering/RenderSVGResourceRadialGradient.cpp:
+        (WebCore::RenderSVGResourceRadialGradient::collectGradientAttributes):
+        (WebCore::RenderSVGResourceRadialGradient::buildGradient):
+        * rendering/RenderSVGResourceRadialGradient.h:
+        (WebCore::RenderSVGResourceRadialGradient::boundingBoxMode):
+        (WebCore::RenderSVGResourceRadialGradient::calculateGradientTransform):
+        * rendering/SVGRenderTreeAsText.cpp: Adapt to change, that fill/strokePaintingResource now take a Color& fallbackColor parameter.
+        (WebCore::writeStyle):
+        (WebCore::writeSVGResourceContainer):
+        * rendering/svg/RenderSVGPath.cpp: 
+        (WebCore::RenderSVGPath::fillContains): Ditto.
+        (WebCore::RenderSVGPath::strokeContains): Ditto.
+        (WebCore::RenderSVGPath::fillAndStrokePath): Properly handle fallback color, if an existing (!) paint server failed to apply.
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::acquirePaintingResource): Ditto.
+        * svg/SVGLinearGradientElement.cpp:
+        (WebCore::SVGLinearGradientElement::collectGradientAttributes): Pass LinearGradientAttributes by reference, instead of returning a copy.
+        * svg/SVGLinearGradientElement.h: Rename collectGradientProperties to collectGradientAttributes.
+        * svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::collectPatternAttributes): Pass PatternAttributes by reference, instead of returning.
+        * svg/SVGPatternElement.h: Rename collectPatternProperties to collectPatternAttributes.
+        * svg/SVGRadialGradientElement.cpp:
+        (WebCore::SVGRadialGradientElement::collectGradientAttributes): Pass RadialGradientAttributes by reference, instead of returning a copy.
+        * svg/SVGRadialGradientElement.h: Rename collectGradientProperties to collectGradientAttributes.
+
 2010-10-08  Benjamin Poulain  <benjamin.poulain at nokia.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp
index 0c943e5..f4c65d5 100644
--- a/WebCore/rendering/RenderSVGResource.cpp
+++ b/WebCore/rendering/RenderSVGResource.cpp
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann at kde.org>
- *               2007 Rob Buis <buis at kde.org>
- *               2008 Dirk Schulze <krit at webkit.org>
+ * Copyright (C) 2007 Rob Buis <buis at kde.org>
+ * Copyright (C) 2008 Dirk Schulze <krit at webkit.org>
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -33,124 +33,102 @@
 
 namespace WebCore {
 
-inline void RenderSVGResource::adjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color)
-{
-    if (style->insideLink() != InsideVisitedLink)
-        return;
-
-    RenderStyle* visitedStyle = style->getCachedPseudoStyle(VISITED_LINK);
-    SVGPaint* visitedPaint = useFillPaint ? visitedStyle->svgStyle()->fillPaint() : visitedStyle->svgStyle()->strokePaint();
-    if (visitedPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI)
-        return;
-        
-    Color visitedColor;
-    if (visitedPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
-        visitedColor = visitedStyle->color();
-    else
-        visitedColor = visitedPaint->color();
-
-    if (visitedColor.isValid())
-        color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha());
-}
-
-// FIXME: This method and strokePaintingResource() should be refactored, to share even more code
-RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderObject* object, const RenderStyle* style)
+static inline RenderSVGResource* requestPaintingResource(RenderSVGResourceMode mode, RenderObject* object, const RenderStyle* style, Color& fallbackColor)
 {
     ASSERT(object);
     ASSERT(style);
 
+    // If we have no style at all, ignore it.
     const SVGRenderStyle* svgStyle = style->svgStyle();
-    if (!svgStyle || !svgStyle->hasFill())
+    if (!svgStyle)
         return 0;
 
-    SVGPaint* fillPaint = svgStyle->fillPaint();
-    ASSERT(fillPaint);
-
-    RenderSVGResource* fillPaintingResource = 0;
-
-    SVGPaint::SVGPaintType paintType = fillPaint->paintType();
-    if (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) {
-        if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object))
-            fillPaintingResource = resources->fill();
-    }
-
-    if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !fillPaintingResource) {
-        RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource();
-        fillPaintingResource = solidResource;
-
-        Color fillColor;
-        if (fillPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
-            fillColor = style->visitedDependentColor(CSSPropertyColor);
-        else
-            fillColor = fillPaint->color();
-
-        adjustColorForPseudoRules(style, true /* useFillPaint */, fillColor);
-
-        // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT
-        if (fillColor.isValid())
-            solidResource->setColor(fillColor);
-        else
-            fillPaintingResource = 0;
+    // If we have no fill/stroke, return 0.
+    if (mode == ApplyToFillMode) {
+        if (!svgStyle->hasFill())
+            return 0;
+    } else {
+        if (!svgStyle->hasStroke())
+            return 0;
     }
 
-    if (!fillPaintingResource) {
-        // default value (black), see bug 11017
-        RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource();
-        solidResource->setColor(Color::black);
-        fillPaintingResource = solidResource;
-    }
+    SVGPaint* paint = mode == ApplyToFillMode ? svgStyle->fillPaint() : svgStyle->strokePaint();
+    ASSERT(paint);
 
-    return fillPaintingResource;
-}
-
-RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderObject* object, const RenderStyle* style)
-{
-    ASSERT(object);
-    ASSERT(style);
-
-    const SVGRenderStyle* svgStyle = style->svgStyle();
-    if (!svgStyle || !svgStyle->hasStroke())
+    SVGPaint::SVGPaintType paintType = paint->paintType();
+    if (paintType == SVGPaint::SVG_PAINTTYPE_NONE)
         return 0;
 
-    SVGPaint* strokePaint = svgStyle->strokePaint();
-    ASSERT(strokePaint);
+    Color color;
+    if (paintType == SVGPaint::SVG_PAINTTYPE_RGBCOLOR
+        || paintType == SVGPaint::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR
+        || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR
+        || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR)
+        color = paint->color();
+    else if (paintType == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paintType == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
+        color = style->visitedDependentColor(CSSPropertyColor);
+
+    if (style->insideLink() == InsideVisitedLink) {
+        RenderStyle* visitedStyle = style->getCachedPseudoStyle(VISITED_LINK);
+        ASSERT(visitedStyle);
+
+        if (SVGPaint* visitedPaint = mode == ApplyToFillMode ? visitedStyle->svgStyle()->fillPaint() : visitedStyle->svgStyle()->strokePaint()) {
+            // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'.
+            if (visitedPaint->paintType() < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaint->paintType() != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) {
+                const Color& visitedColor = visitedPaint->color();
+                if (visitedColor.isValid())
+                    color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha());
+            }
+        }
+    }
 
-    RenderSVGResource* strokePaintingResource = 0;
-    FloatRect objectBoundingBox = object->objectBoundingBox();
+    // If the primary resource is just a color, return immediately.
+    RenderSVGResourceSolidColor* colorResource = RenderSVGResource::sharedSolidPaintingResource();
+    if (paintType < SVGPaint::SVG_PAINTTYPE_URI_NONE) {
+        // If an invalid fill color is specified, fallback to fill/stroke="none".
+        if (!color.isValid())
+            return 0;
 
-    SVGPaint::SVGPaintType paintType = strokePaint->paintType();
-    if (!objectBoundingBox.isEmpty() && (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)) {
-        if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object))
-            strokePaintingResource = resources->stroke();
+        colorResource->setColor(color);
+        return colorResource;
     }
 
-    if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !strokePaintingResource) {
-        RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource();
-        strokePaintingResource = solidResource;
+    // If no resources are associated with the given renderer, return the color resource.
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
+    if (!resources) {
+        // If a paint server is specified, and no or an invalid fallback color is given, default to fill/stroke="black".
+        if (!color.isValid())
+            color = Color::black;
 
-        Color strokeColor;
-        if (strokePaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
-            strokeColor = style->visitedDependentColor(CSSPropertyColor);
-        else
-            strokeColor = strokePaint->color();
+        colorResource->setColor(color);
+        return colorResource;
+    }
 
-        adjustColorForPseudoRules(style, false /* useFillPaint */, strokeColor);
+    // If the requested resource is not available, return the color resource.
+    RenderSVGResource* uriResource = mode == ApplyToFillMode ? resources->fill() : resources->stroke();
+    if (!uriResource) {
+        // If a paint server is specified, and no or an invalid fallback color is given, default to fill/stroke="black".
+        if (!color.isValid())
+            color = Color::black;
 
-        // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT
-        if (strokeColor.isValid())
-            solidResource->setColor(strokeColor);
-        else
-            strokePaintingResource = 0;
+        colorResource->setColor(color);
+        return colorResource;
     }
 
-    if (!strokePaintingResource) {
-        // default value (black), see bug 11017
-        RenderSVGResourceSolidColor* solidResource = sharedSolidPaintingResource();
-        solidResource->setColor(Color::black);
-        strokePaintingResource = solidResource;
-    }
+    // The paint server resource exists, though it may be invalid (pattern with width/height=0). Pass the fallback color to our caller
+    // so it can use the solid color painting resource, if applyResource() on the URI resource failed.
+    fallbackColor = color;
+    return uriResource;
+}
+
+RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderObject* object, const RenderStyle* style, Color& fallbackColor)
+{
+    return requestPaintingResource(ApplyToFillMode, object, style, fallbackColor);
+}
 
-    return strokePaintingResource;
+RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderObject* object, const RenderStyle* style, Color& fallbackColor)
+{
+    return requestPaintingResource(ApplyToStrokeMode, object, style, fallbackColor);
 }
 
 RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource()
diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h
index a70ce52..0230e98 100644
--- a/WebCore/rendering/RenderSVGResource.h
+++ b/WebCore/rendering/RenderSVGResource.h
@@ -75,15 +75,12 @@ public:
         return 0;
     }
 
-    // Helper utilities used in the render tree to access resources used for painting shapes/text (gradients & patterns only)
-    static RenderSVGResource* fillPaintingResource(RenderObject*, const RenderStyle*);
-    static RenderSVGResource* strokePaintingResource(RenderObject*, const RenderStyle*);
+    // Helper utilities used in the render tree to access resources used for painting shapes/text (gradients & patterns & solid colors only)
+    static RenderSVGResource* fillPaintingResource(RenderObject*, const RenderStyle*, Color& fallbackColor);
+    static RenderSVGResource* strokePaintingResource(RenderObject*, const RenderStyle*, Color& fallbackColor);
     static RenderSVGResourceSolidColor* sharedSolidPaintingResource();
 
     static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool needsLayout = true);
-
-private:
-    static void adjustColorForPseudoRules(const RenderStyle*, bool useFillPaint, Color&);
 };
 
 }
diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp
index 169903e..b4ecb9e 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.cpp
+++ b/WebCore/rendering/RenderSVGResourceGradient.cpp
@@ -37,6 +37,7 @@ namespace WebCore {
 
 RenderSVGResourceGradient::RenderSVGResourceGradient(SVGGradientElement* node)
     : RenderSVGResourceContainer(node)
+    , m_shouldCollectGradientAttributes(true)
 #if PLATFORM(CG)
     , m_savedContext(0)
 #endif
@@ -59,6 +60,7 @@ void RenderSVGResourceGradient::removeAllClientsFromCache(bool markForInvalidati
         m_gradient.clear();
     }
 
+    m_shouldCollectGradientAttributes = true;
     markAllClientsForInvalidation(markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation);
 }
 
@@ -110,7 +112,8 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context,
                                              OwnPtr<ImageBuffer>& imageBuffer,
                                              FloatRect& targetRect,
                                              RenderObject* object,
-                                             GradientData* gradientData)
+                                             bool boundingBoxMode,
+                                             const AffineTransform& gradientTransform)
 {
     RenderObject* textRootBlock = RenderSVGText::locateRenderSVGTextAncestor(object);
     ASSERT(textRootBlock);
@@ -126,12 +129,12 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context,
     SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, clampedAbsoluteTargetRect, imageBuffer);
 
     AffineTransform matrix;
-    if (gradientData->boundingBoxMode) {
+    if (boundingBoxMode) {
         FloatRect maskBoundingBox = textRootBlock->objectBoundingBox();
         matrix.translate(maskBoundingBox.x(), maskBoundingBox.y());
         matrix.scaleNonUniform(maskBoundingBox.width(), maskBoundingBox.height());
     }
-    matrix.multLeft(gradientData->transform);
+    matrix.multLeft(gradientTransform);
     return matrix;
 }
 #endif
@@ -151,13 +154,22 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
     if (!gradientElement)
         return false;
 
-    gradientElement->updateAnimatedSVGAttribute(anyQName());
+    if (m_shouldCollectGradientAttributes) {
+        gradientElement->updateAnimatedSVGAttribute(anyQName());
+        collectGradientAttributes(gradientElement);
+        m_shouldCollectGradientAttributes = false;
+    }
+
+    // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
+    // then the given effect (e.g. a gradient or a filter) will be ignored.
+    FloatRect objectBoundingBox = object->objectBoundingBox();
+    if (boundingBoxMode() && objectBoundingBox.isEmpty())
+        return false;
 
     if (!m_gradient.contains(object))
         m_gradient.set(object, new GradientData);
 
     GradientData* gradientData = m_gradient.get(object);
-
     bool isPaintingText = resourceMode & ApplyToTextMode;
 
     // Create gradient object
@@ -168,16 +180,18 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
         // resource, so don't apply it here. For non-CG platforms, we want the text bounding
         // box applied to the gradient space transform now, so the gradient shader can use it.
 #if PLATFORM(CG)
-        if (gradientData->boundingBoxMode && !isPaintingText) {
+        if (boundingBoxMode() && !objectBoundingBox.isEmpty() && !isPaintingText) {
 #else
-        if (gradientData->boundingBoxMode) {
+        if (boundingBoxMode() && !objectBoundingBox.isEmpty()) {
 #endif
-            FloatRect objectBoundingBox = object->objectBoundingBox();
             gradientData->userspaceTransform.translate(objectBoundingBox.x(), objectBoundingBox.y());
             gradientData->userspaceTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
         }
 
-        gradientData->userspaceTransform.multLeft(gradientData->transform);
+        AffineTransform gradientTransform;
+        calculateGradientTransform(gradientTransform);
+
+        gradientData->userspaceTransform.multLeft(gradientTransform);
         gradientData->gradient->setGradientSpaceTransform(gradientData->userspaceTransform);
     }
 
@@ -231,8 +245,11 @@ void RenderSVGResourceGradient::postApplyResource(RenderObject* object, Graphics
             context = m_savedContext;
             m_savedContext = 0;
 
+            AffineTransform gradientTransform;
+            calculateGradientTransform(gradientTransform);
+
             FloatRect targetRect;
-            gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, targetRect, object, gradientData));
+            gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, targetRect, object, boundingBoxMode(), gradientTransform));
             context->setFillGradient(gradientData->gradient);
 
             context->fillRect(targetRect);
diff --git a/WebCore/rendering/RenderSVGResourceGradient.h b/WebCore/rendering/RenderSVGResourceGradient.h
index 4de4272..bc0b864 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.h
+++ b/WebCore/rendering/RenderSVGResourceGradient.h
@@ -37,10 +37,7 @@ namespace WebCore {
 
 struct GradientData {
     RefPtr<Gradient> gradient;
-
-    bool boundingBoxMode;
     AffineTransform userspaceTransform;
-    AffineTransform transform;
 };
 
 class GraphicsContext;
@@ -59,9 +56,14 @@ public:
 
 protected:
     void addStops(GradientData*, const Vector<Gradient::ColorStop>&) const;
+
+    virtual bool boundingBoxMode() const = 0;
+    virtual void calculateGradientTransform(AffineTransform&) = 0;
+    virtual void collectGradientAttributes(SVGGradientElement*) = 0;
     virtual void buildGradient(GradientData*, SVGGradientElement*) const = 0;
 
 private:
+    bool m_shouldCollectGradientAttributes : 1;
     HashMap<RenderObject*, GradientData*> m_gradient;
 
 #if PLATFORM(CG)
diff --git a/WebCore/rendering/RenderSVGResourceLinearGradient.cpp b/WebCore/rendering/RenderSVGResourceLinearGradient.cpp
index e34e524..ce8d69e 100644
--- a/WebCore/rendering/RenderSVGResourceLinearGradient.cpp
+++ b/WebCore/rendering/RenderSVGResourceLinearGradient.cpp
@@ -40,25 +40,26 @@ RenderSVGResourceLinearGradient::~RenderSVGResourceLinearGradient()
 {
 }
 
+void RenderSVGResourceLinearGradient::collectGradientAttributes(SVGGradientElement* gradientElement)
+{
+    m_attributes = LinearGradientAttributes();
+    static_cast<SVGLinearGradientElement*>(gradientElement)->collectGradientAttributes(m_attributes);
+}
+
 void RenderSVGResourceLinearGradient::buildGradient(GradientData* gradientData, SVGGradientElement* gradientElement) const
 {
     SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradientElement);
-    LinearGradientAttributes attributes = linearGradientElement->collectGradientProperties();
 
     // Determine gradient start/end points
     FloatPoint startPoint;
     FloatPoint endPoint;
-    linearGradientElement->calculateStartEndPoints(attributes, startPoint, endPoint);
+    linearGradientElement->calculateStartEndPoints(m_attributes, startPoint, endPoint);
 
     gradientData->gradient = Gradient::create(startPoint, endPoint);
-    gradientData->gradient->setSpreadMethod(attributes.spreadMethod());
-
-    // Record current gradient transform
-    gradientData->transform = attributes.gradientTransform();
-    gradientData->boundingBoxMode = attributes.boundingBoxMode();
+    gradientData->gradient->setSpreadMethod(m_attributes.spreadMethod());
 
     // Add stops
-    addStops(gradientData, attributes.stops());
+    addStops(gradientData, m_attributes.stops());
 }
 
 }
diff --git a/WebCore/rendering/RenderSVGResourceLinearGradient.h b/WebCore/rendering/RenderSVGResourceLinearGradient.h
index c1f84c2..9e4530d 100644
--- a/WebCore/rendering/RenderSVGResourceLinearGradient.h
+++ b/WebCore/rendering/RenderSVGResourceLinearGradient.h
@@ -23,6 +23,7 @@
 #define RenderSVGResourceLinearGradient_h
 
 #if ENABLE(SVG)
+#include "LinearGradientAttributes.h"
 #include "RenderSVGResourceGradient.h"
 
 namespace WebCore {
@@ -39,7 +40,13 @@ public:
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
     static RenderSVGResourceType s_resourceType;
 
+    virtual bool boundingBoxMode() const { return m_attributes.boundingBoxMode(); }
+    virtual void calculateGradientTransform(AffineTransform& transform) { transform = m_attributes.gradientTransform(); }
+    virtual void collectGradientAttributes(SVGGradientElement*);
     virtual void buildGradient(GradientData*, SVGGradientElement*) const;
+
+private:
+    LinearGradientAttributes m_attributes;
 };
 
 }
diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp
index ccbdaca..40dd4f4 100644
--- a/WebCore/rendering/RenderSVGResourcePattern.cpp
+++ b/WebCore/rendering/RenderSVGResourcePattern.cpp
@@ -37,6 +37,7 @@ RenderSVGResourceType RenderSVGResourcePattern::s_resourceType = PatternResource
 
 RenderSVGResourcePattern::RenderSVGResourcePattern(SVGPatternElement* node)
     : RenderSVGResourceContainer(node)
+    , m_shouldCollectPatternAttributes(true)
 {
 }
 
@@ -56,6 +57,7 @@ void RenderSVGResourcePattern::removeAllClientsFromCache(bool markForInvalidatio
         m_pattern.clear();
     }
 
+    m_shouldCollectPatternAttributes = true;
     markAllClientsForInvalidation(markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation);
 }
 
@@ -84,22 +86,34 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
     if (!patternElement)
         return false;
 
-    patternElement->updateAnimatedSVGAttribute(anyQName());
+    if (m_shouldCollectPatternAttributes) {
+        patternElement->updateAnimatedSVGAttribute(anyQName());
+
+        m_attributes = PatternAttributes();
+        patternElement->collectPatternAttributes(m_attributes);
+        m_shouldCollectPatternAttributes = false;
+    }
+
+    // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
+    // then the given effect (e.g. a gradient or a filter) will be ignored.
+    FloatRect objectBoundingBox = object->objectBoundingBox();
+    if (m_attributes.boundingBoxMode() && objectBoundingBox.isEmpty())
+        return false;
 
     if (!m_pattern.contains(object))
         m_pattern.set(object, new PatternData);
 
     PatternData* patternData = m_pattern.get(object);
     if (!patternData->pattern) {
-        PatternAttributes attributes = patternElement->collectPatternProperties();
-
         // If we couldn't determine the pattern content element root, stop here.
-        if (!attributes.patternContentElement())
+        if (!m_attributes.patternContentElement())
             return false;
 
         // Compute all necessary transformations to build the tile image & the pattern.
         FloatRect tileBoundaries;
-        AffineTransform tileImageTransform = buildTileImageTransform(object, attributes, patternElement, tileBoundaries);
+        AffineTransform tileImageTransform;
+        if (!buildTileImageTransform(object, m_attributes, patternElement, tileBoundaries, tileImageTransform))
+            return false;
 
         AffineTransform absoluteTransform;
         SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
@@ -107,7 +121,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
         FloatRect absoluteTileBoundaries = absoluteTransform.mapRect(tileBoundaries);
 
         // Build tile image.
-        OwnPtr<ImageBuffer> tileImage = createTileImage(object, attributes, tileBoundaries, absoluteTileBoundaries, tileImageTransform);
+        OwnPtr<ImageBuffer> tileImage = createTileImage(object, m_attributes, tileBoundaries, absoluteTileBoundaries, tileImageTransform);
         if (!tileImage)
             return false;
 
@@ -124,7 +138,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
         patternData->transform.translate(tileBoundaries.x(), tileBoundaries.y());
         patternData->transform.scale(tileBoundaries.width() / absoluteTileBoundaries.width(), tileBoundaries.height() / absoluteTileBoundaries.height());
 
-        AffineTransform patternTransform = attributes.patternTransform();
+        AffineTransform patternTransform = m_attributes.patternTransform();
         if (!patternTransform.isIdentity())
             patternData->transform.multiply(patternTransform);
 
@@ -201,19 +215,21 @@ static inline FloatRect calculatePatternBoundaries(const PatternAttributes& attr
                      attributes.height().value(patternElement));
 }
 
-AffineTransform RenderSVGResourcePattern::buildTileImageTransform(RenderObject* renderer,
-                                                                  const PatternAttributes& attributes,
-                                                                  const SVGPatternElement* patternElement,
-                                                                  FloatRect& patternBoundaries) const
+bool RenderSVGResourcePattern::buildTileImageTransform(RenderObject* renderer,
+                                                       const PatternAttributes& attributes,
+                                                       const SVGPatternElement* patternElement,
+                                                       FloatRect& patternBoundaries,
+                                                       AffineTransform& tileImageTransform) const
 {
     ASSERT(renderer);
     ASSERT(patternElement);
 
-    FloatRect objectBoundingBox = renderer->objectBoundingBox();    
+    FloatRect objectBoundingBox = renderer->objectBoundingBox();
     patternBoundaries = calculatePatternBoundaries(attributes, objectBoundingBox, patternElement); 
+    if (patternBoundaries.width() <= 0 || patternBoundaries.height() <= 0)
+        return false;
 
     AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(patternElement->viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height());
-    AffineTransform tileImageTransform;
 
     // Apply viewBox/objectBoundingBox transformations.
     if (!viewBoxCTM.isIdentity())
@@ -223,7 +239,7 @@ AffineTransform RenderSVGResourcePattern::buildTileImageTransform(RenderObject*
         tileImageTransform.scale(objectBoundingBox.width(), objectBoundingBox.height());
     }
 
-    return tileImageTransform;
+    return true;
 }
 
 PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(RenderObject* object,
diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h
index 9a067c2..ba4aec4 100644
--- a/WebCore/rendering/RenderSVGResourcePattern.h
+++ b/WebCore/rendering/RenderSVGResourcePattern.h
@@ -27,6 +27,7 @@
 #include "FloatRect.h"
 #include "ImageBuffer.h"
 #include "Pattern.h"
+#include "PatternAttributes.h"
 #include "RenderSVGResourceContainer.h"
 #include "SVGPatternElement.h"
 #include "SVGUnitTypes.h"
@@ -41,8 +42,6 @@ struct PatternData {
     AffineTransform transform;
 };
 
-struct PatternAttributes;
-
 class RenderSVGResourcePattern : public RenderSVGResourceContainer {
 public:
     RenderSVGResourcePattern(SVGPatternElement*);
@@ -61,11 +60,13 @@ public:
     static RenderSVGResourceType s_resourceType;
 
 private:
-    AffineTransform buildTileImageTransform(RenderObject*, const PatternAttributes&, const SVGPatternElement*, FloatRect& patternBoundaries) const;
+    bool buildTileImageTransform(RenderObject*, const PatternAttributes&, const SVGPatternElement*, FloatRect& patternBoundaries, AffineTransform& tileImageTransform) const;
 
     PassOwnPtr<ImageBuffer> createTileImage(RenderObject*, const PatternAttributes&, const FloatRect& tileBoundaries,
                                             const FloatRect& absoluteTileBoundaries, const AffineTransform& tileImageTransform) const;
 
+    bool m_shouldCollectPatternAttributes : 1;
+    PatternAttributes m_attributes;
     HashMap<RenderObject*, PatternData*> m_pattern;
 };
 
diff --git a/WebCore/rendering/RenderSVGResourceRadialGradient.cpp b/WebCore/rendering/RenderSVGResourceRadialGradient.cpp
index a8904c8..300afcb 100644
--- a/WebCore/rendering/RenderSVGResourceRadialGradient.cpp
+++ b/WebCore/rendering/RenderSVGResourceRadialGradient.cpp
@@ -40,30 +40,31 @@ RenderSVGResourceRadialGradient::~RenderSVGResourceRadialGradient()
 {
 }
 
+void RenderSVGResourceRadialGradient::collectGradientAttributes(SVGGradientElement* gradientElement)
+{
+    m_attributes = RadialGradientAttributes();
+    static_cast<SVGRadialGradientElement*>(gradientElement)->collectGradientAttributes(m_attributes);
+}
+
 void RenderSVGResourceRadialGradient::buildGradient(GradientData* gradientData, SVGGradientElement* gradientElement) const
 {
     SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradientElement);
-    RadialGradientAttributes attributes = radialGradientElement->collectGradientProperties();
 
     // Determine gradient focal/center points and radius
     FloatPoint focalPoint;
     FloatPoint centerPoint;
     float radius;
-    radialGradientElement->calculateFocalCenterPointsAndRadius(attributes, focalPoint, centerPoint, radius);
+    radialGradientElement->calculateFocalCenterPointsAndRadius(m_attributes, focalPoint, centerPoint, radius);
 
     gradientData->gradient = Gradient::create(focalPoint,
-                                              0.0f, // SVG does not support a "focus radius"
+                                              0, // SVG does not support a "focus radius"
                                               centerPoint,
                                               radius);
 
-    gradientData->gradient->setSpreadMethod(attributes.spreadMethod());
-
-    // Record current gradient transform
-    gradientData->transform = attributes.gradientTransform();
-    gradientData->boundingBoxMode = attributes.boundingBoxMode();
+    gradientData->gradient->setSpreadMethod(m_attributes.spreadMethod());
 
     // Add stops
-    addStops(gradientData, attributes.stops());
+    addStops(gradientData, m_attributes.stops());
 }
 
 }
diff --git a/WebCore/rendering/RenderSVGResourceRadialGradient.h b/WebCore/rendering/RenderSVGResourceRadialGradient.h
index 0583f99..6492ee3 100644
--- a/WebCore/rendering/RenderSVGResourceRadialGradient.h
+++ b/WebCore/rendering/RenderSVGResourceRadialGradient.h
@@ -23,6 +23,7 @@
 #define RenderSVGResourceRadialGradient_h
 
 #if ENABLE(SVG)
+#include "RadialGradientAttributes.h"
 #include "RenderSVGResourceGradient.h"
 
 namespace WebCore {
@@ -39,7 +40,13 @@ public:
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
     static RenderSVGResourceType s_resourceType;
 
+    virtual bool boundingBoxMode() const { return m_attributes.boundingBoxMode(); }
+    virtual void calculateGradientTransform(AffineTransform& transform) { transform = m_attributes.gradientTransform(); }
+    virtual void collectGradientAttributes(SVGGradientElement*);
     virtual void buildGradient(GradientData*, SVGGradientElement*) const;
+
+private:
+    RadialGradientAttributes m_attributes;
 };
 
 }
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index 57f8486..b7f7f95 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -327,7 +327,8 @@ static void writeStyle(TextStream& ts, const RenderObject& object)
         ASSERT(path.node());
         ASSERT(path.node()->isSVGElement());
 
-        if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGPath*>(&path), path.style())) {
+        Color fallbackColor;
+        if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGPath*>(&path), path.style(), fallbackColor)) {
             TextStreamSeparator s(" ");
             ts << " [stroke={" << s;
             writeSVGPaintingResource(ts, strokePaintingResource);
@@ -354,7 +355,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object)
             ts << "}]";
         }
 
-        if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderSVGPath*>(&path), path.style())) {
+        if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderSVGPath*>(&path), path.style(), fallbackColor)) {
             TextStreamSeparator s(" ");
             ts << " [fill={" << s;
             writeSVGPaintingResource(ts, fillPaintingResource);
@@ -580,7 +581,9 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i
 
         // Dump final results that are used for rendering. No use in asking SVGPatternElement for its patternUnits(), as it may
         // link to other patterns using xlink:href, we need to build the full inheritance chain, aka. collectPatternProperties()
-        PatternAttributes attributes = static_cast<SVGPatternElement*>(pattern->node())->collectPatternProperties();
+        PatternAttributes attributes;
+        static_cast<SVGPatternElement*>(pattern->node())->collectPatternAttributes(attributes);
+
         writeNameValuePair(ts, "patternUnits", boundingBoxModeString(attributes.boundingBoxMode()));
         writeNameValuePair(ts, "patternContentUnits", boundingBoxModeString(attributes.boundingBoxModeContent()));
 
@@ -595,7 +598,8 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i
         // link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties()
         SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradient->node());
 
-        LinearGradientAttributes attributes = linearGradientElement->collectGradientProperties();
+        LinearGradientAttributes attributes;
+        linearGradientElement->collectGradientAttributes(attributes);
         writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.boundingBoxMode());
 
         FloatPoint startPoint;
@@ -610,7 +614,8 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i
         // link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties()
         SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradient->node());
 
-        RadialGradientAttributes attributes = radialGradientElement->collectGradientProperties();
+        RadialGradientAttributes attributes;
+        radialGradientElement->collectGradientAttributes(attributes);
         writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.boundingBoxMode());
 
         FloatPoint focalPoint;
diff --git a/WebCore/rendering/svg/RenderSVGPath.cpp b/WebCore/rendering/svg/RenderSVGPath.cpp
index 907b60c..f8f7f33 100644
--- a/WebCore/rendering/svg/RenderSVGPath.cpp
+++ b/WebCore/rendering/svg/RenderSVGPath.cpp
@@ -35,6 +35,7 @@
 #include "PointerEventsHitRules.h"
 #include "RenderSVGContainer.h"
 #include "RenderSVGResourceMarker.h"
+#include "RenderSVGResourceSolidColor.h"
 #include "SVGRenderSupport.h"
 #include "SVGResources.h"
 #include "SVGStyledTransformableElement.h"
@@ -78,7 +79,8 @@ bool RenderSVGPath::fillContains(const FloatPoint& point, bool requiresFill, Win
     if (!m_fillBoundingBox.contains(point))
         return false;
 
-    if (requiresFill && !RenderSVGResource::fillPaintingResource(this, style()))
+    Color fallbackColor;
+    if (requiresFill && !RenderSVGResource::fillPaintingResource(this, style(), fallbackColor))
         return false;
 
     return m_path.contains(point, fillRule);
@@ -89,7 +91,8 @@ bool RenderSVGPath::strokeContains(const FloatPoint& point, bool requiresStroke)
     if (!m_strokeAndMarkerBoundingBox.contains(point))
         return false;
 
-    if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style()))
+    Color fallbackColor;
+    if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style(), fallbackColor))
         return false;
 
     BoundingRectStrokeStyleApplier strokeStyle(this, style());
@@ -143,13 +146,21 @@ void RenderSVGPath::fillAndStrokePath(GraphicsContext* context)
     context->beginPath();
     RenderStyle* style = this->style();
 
-    if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style)) {
+    Color fallbackColor;
+    if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style, fallbackColor)) {
         context->addPath(m_path);
         if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode))
             fillPaintingResource->postApplyResource(this, context, ApplyToFillMode);
+        else if (fallbackColor.isValid()) {
+            RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
+            fallbackResource->setColor(fallbackColor);
+            if (fallbackResource->applyResource(this, style, context, ApplyToFillMode))
+                fallbackResource->postApplyResource(this, context, ApplyToFillMode);
+        }
     }
 
-    RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(this, style);
+    fallbackColor = Color();
+    RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(this, style, fallbackColor);
     if (!strokePaintingResource)
         return;
 
@@ -172,6 +183,12 @@ void RenderSVGPath::fillAndStrokePath(GraphicsContext* context)
 
     if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode))
         strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode);
+    else if (fallbackColor.isValid()) {
+        RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
+        fallbackResource->setColor(fallbackColor);
+        if (fallbackResource->applyResource(this, style, context, ApplyToStrokeMode))
+            fallbackResource->postApplyResource(this, context, ApplyToStrokeMode);
+    }
 
     if (restoreContext)
         context->restore();
diff --git a/WebCore/rendering/svg/SVGInlineTextBox.cpp b/WebCore/rendering/svg/SVGInlineTextBox.cpp
index 4c9cc81..8352ee5 100644
--- a/WebCore/rendering/svg/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/svg/SVGInlineTextBox.cpp
@@ -30,6 +30,7 @@
 #include "RenderBlock.h"
 #include "RenderSVGInlineText.h"
 #include "RenderSVGResource.h"
+#include "RenderSVGResourceSolidColor.h"
 #include "SVGRootInlineBox.h"
 
 using namespace std;
@@ -291,10 +292,11 @@ bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, Render
     ASSERT(style);
     ASSERT(m_paintingResourceMode != ApplyToDefaultMode);
 
+    Color fallbackColor;
     if (m_paintingResourceMode & ApplyToFillMode)
-        m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, style);
+        m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, style, fallbackColor);
     else if (m_paintingResourceMode & ApplyToStrokeMode)
-        m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style);
+        m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style, fallbackColor);
     else {
         // We're either called for stroking or filling.
         ASSERT_NOT_REACHED();
@@ -303,7 +305,16 @@ bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, Render
     if (!m_paintingResource)
         return false;
 
-    m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode);
+    if (!m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode)) {
+        if (fallbackColor.isValid()) {
+            RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
+            fallbackResource->setColor(fallbackColor);
+
+            m_paintingResource = fallbackResource;
+            m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode);
+        }
+    }
+
     return true;
 }
 
diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp
index ec351d7..840a31e 100644
--- a/WebCore/svg/SVGLinearGradientElement.cpp
+++ b/WebCore/svg/SVGLinearGradientElement.cpp
@@ -113,9 +113,8 @@ RenderObject* SVGLinearGradientElement::createRenderer(RenderArena* arena, Rende
     return new (arena) RenderSVGResourceLinearGradient(this);
 }
 
-LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties()
+void SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttributes& attributes)
 {
-    LinearGradientAttributes attributes;
     HashSet<SVGGradientElement*> processedGradients;
 
     bool isLinear = true;
@@ -170,8 +169,6 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties()
         } else
             current = 0;
     }
-
-    return attributes;
 }
 
 void SVGLinearGradientElement::calculateStartEndPoints(const LinearGradientAttributes& attributes, FloatPoint& startPoint, FloatPoint& endPoint)
diff --git a/WebCore/svg/SVGLinearGradientElement.h b/WebCore/svg/SVGLinearGradientElement.h
index dec912f..86bebf3 100644
--- a/WebCore/svg/SVGLinearGradientElement.h
+++ b/WebCore/svg/SVGLinearGradientElement.h
@@ -33,7 +33,7 @@ namespace WebCore {
     public:
         static PassRefPtr<SVGLinearGradientElement> create(const QualifiedName&, Document*);
 
-        LinearGradientAttributes collectGradientProperties();
+        void collectGradientAttributes(LinearGradientAttributes&);
         void calculateStartEndPoints(const LinearGradientAttributes&, FloatPoint& startPoint, FloatPoint& endPoint);
 
     private:
diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp
index 6a8a108..0f3b5d4 100644
--- a/WebCore/svg/SVGPatternElement.cpp
+++ b/WebCore/svg/SVGPatternElement.cpp
@@ -200,9 +200,8 @@ RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*
     return new (arena) RenderSVGResourcePattern(this);
 }
 
-PatternAttributes SVGPatternElement::collectPatternProperties() const
+void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) const
 {
-    PatternAttributes attributes;
     HashSet<const SVGPatternElement*> processedPatterns;
 
     const SVGPatternElement* current = this;
@@ -246,8 +245,6 @@ PatternAttributes SVGPatternElement::collectPatternProperties() const
         } else
             current = 0;
     }
-
-    return attributes;
 }
 
 bool SVGPatternElement::selfHasRelativeLengths() const
diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h
index 497660a..a93c54c 100644
--- a/WebCore/svg/SVGPatternElement.h
+++ b/WebCore/svg/SVGPatternElement.h
@@ -45,7 +45,7 @@ namespace WebCore {
     public:
         static PassRefPtr<SVGPatternElement> create(const QualifiedName&, Document*);
 
-        PatternAttributes collectPatternProperties() const;
+        void collectPatternAttributes(PatternAttributes&) const;
 
     private:
         SVGPatternElement(const QualifiedName&, Document*);
diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp
index 80aba78..584b1b6 100644
--- a/WebCore/svg/SVGRadialGradientElement.cpp
+++ b/WebCore/svg/SVGRadialGradientElement.cpp
@@ -123,9 +123,8 @@ RenderObject* SVGRadialGradientElement::createRenderer(RenderArena* arena, Rende
     return new (arena) RenderSVGResourceRadialGradient(this);
 }
 
-RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties()
+void SVGRadialGradientElement::collectGradientAttributes(RadialGradientAttributes& attributes)
 {
-    RadialGradientAttributes attributes;
     HashSet<SVGGradientElement*> processedGradients;
 
     bool isRadial = true;
@@ -190,8 +189,6 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties()
 
     if (!attributes.hasFy())
         attributes.setFy(attributes.cy());
-
-    return attributes;
 }
 
 void SVGRadialGradientElement::calculateFocalCenterPointsAndRadius(const RadialGradientAttributes& attributes, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius)
diff --git a/WebCore/svg/SVGRadialGradientElement.h b/WebCore/svg/SVGRadialGradientElement.h
index e528a13..61333af 100644
--- a/WebCore/svg/SVGRadialGradientElement.h
+++ b/WebCore/svg/SVGRadialGradientElement.h
@@ -33,7 +33,7 @@ namespace WebCore {
     public:
         static PassRefPtr<SVGRadialGradientElement> create(const QualifiedName&, Document*);
 
-        RadialGradientAttributes collectGradientProperties();
+        void collectGradientAttributes(RadialGradientAttributes&);
         void calculateFocalCenterPointsAndRadius(const RadialGradientAttributes&, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius);
 
     private:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list