2011-05-25 Rob Buis <rbuis@rim.com>
authorrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 May 2011 19:01:46 +0000 (19:01 +0000)
committerrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 May 2011 19:01:46 +0000 (19:01 +0000)
        Reviewed by Eric Seidel.

        WebKit does not handle missing filter elements correctly
        https://bugs.webkit.org/show_bug.cgi?id=12569

        Updated improved pixel test result and add new SVG1.1 SE test and results.

        * platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.png: Added.
        * platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.txt: Added.
        * platform/mac/svg/W3C-SVG-1.1/filters-felem-01-b-expected.png:
        * svg/W3C-SVG-1.1-SE/filters-felem-01-b.svg: Added.
2011-05-25  Rob Buis  <rbuis@rim.com>

        Reviewed by Eric Seidel.
        New test rubber-stamped by Dirk Schulze.

        WebKit does not handle missing filter elements correctly
        https://bugs.webkit.org/show_bug.cgi?id=12569

        Do not render elements that reference non-existant filters.

        Test: svg/W3C-SVG-1.1-SE/filters-felem-01-b.svg

        * rendering/svg/SVGRenderSupport.cpp:
        (WebCore::SVGRenderSupport::prepareToRenderSVGContent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87310 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-felem-01-b-expected.png
LayoutTests/svg/W3C-SVG-1.1-SE/filters-felem-01-b.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/SVGRenderSupport.cpp

index 8c26f2f..b552b0a 100644 (file)
@@ -1,3 +1,17 @@
+2011-05-25  Rob Buis  <rbuis@rim.com>
+
+        Reviewed by Eric Seidel.
+
+        WebKit does not handle missing filter elements correctly
+        https://bugs.webkit.org/show_bug.cgi?id=12569
+
+        Updated improved pixel test result and add new SVG1.1 SE test and results.
+
+        * platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.png: Added.
+        * platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.txt: Added.
+        * platform/mac/svg/W3C-SVG-1.1/filters-felem-01-b-expected.png:
+        * svg/W3C-SVG-1.1-SE/filters-felem-01-b.svg: Added.
+
 2011-05-25  Nate Chapin  <japhet@chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.png
new file mode 100644 (file)
index 0000000..0cfc531
Binary files /dev/null and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.txt
new file mode 100644 (file)
index 0000000..3bd75bd
--- /dev/null
@@ -0,0 +1,40 @@
+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 (82,20) size 364x265
+      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+        RenderSVGResourceFilter {filter} [id="null"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+        RenderSVGResourceFilter {filter} [id="nullreg"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+      RenderSVGContainer {g} at (90,20) size 80x115
+        RenderSVGPath {circle} at (100,30) size 60x60 [fill={[type=SOLID] [color=#FF0000]}] [cx=130.00] [cy=60.00] [r=30.00]
+        RenderSVGPath {circle} at (90,20) size 80x80 [fill={[type=SOLID] [color=#00FF00]}] [cx=130.00] [cy=60.00] [r=40.00]
+        RenderSVGText {text} at (95,111) size 70x24 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 70x24
+            chunk 1 (middle anchor) text run 1 at (95.50,130.00) startOffset 0 endOffset 9 width 69.00: "No filter"
+      RenderSVGContainer {g} at (82,162) size 96x123
+        RenderSVGPath {circle} at (100,180) size 60x60 [fill={[type=SOLID] [color=#00FF00]}] [cx=130.00] [cy=210.00] [r=30.00]
+        RenderSVGPath {circle} at (82,162) size 96x96 [fill={[type=SOLID] [color=#FF0000]}] [cx=130.00] [cy=210.00] [r=40.00]
+          [filter="null"] RenderSVGResourceFilter {filter} at (82,162) size 96x96
+        RenderSVGText {text} at (91,261) size 78x24 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 78x24
+            chunk 1 (middle anchor) text run 1 at (91.50,280.00) startOffset 0 endOffset 11 width 77.00: "Null filter"
+      RenderSVGContainer {g} at (252,20) size 156x115
+        RenderSVGPath {circle} at (300,30) size 60x60 [fill={[type=SOLID] [color=#00FF00]}] [cx=330.00] [cy=60.00] [r=30.00]
+        RenderSVGPath {circle} at (290,20) size 80x80 [fill={[type=SOLID] [color=#FF0000]}] [cx=330.00] [cy=60.00] [r=40.00]
+        RenderSVGText {text} at (252,111) size 156x24 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 156x24
+            chunk 1 (middle anchor) text run 1 at (252.00,130.00) startOffset 0 endOffset 19 width 156.00: "Non-existent filter"
+      RenderSVGContainer {g} at (214,180) size 232x105
+        RenderSVGPath {circle} at (300,180) size 60x60 [fill={[type=SOLID] [color=#00FF00]}] [cx=330.00] [cy=210.00] [r=30.00]
+        RenderSVGPath {circle} at (322,202) size 16x16 [fill={[type=SOLID] [color=#FF0000]}] [cx=330.00] [cy=210.00] [r=40.00]
+          [filter="nullreg"] RenderSVGResourceFilter {filter} at (322,202) size 16x16
+        RenderSVGText {text} at (214,261) size 232x24 contains 1 chunk(s)
+          RenderSVGInlineText {#text} at (0,0) size 232x24
+            chunk 1 (middle anchor) text run 1 at (214.50,280.00) startOffset 0 endOffset 29 width 231.00: "Null with small region filter"
+    RenderSVGContainer {g} at (10,310) size 231x38
+      RenderSVGText {text} at (10,310) size 231x38 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 231x38
+          chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 231.00: "$Revision: 1.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]
index 5a117b7..99a9497 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-felem-01-b-expected.png and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-felem-01-b-expected.png differ
diff --git a/LayoutTests/svg/W3C-SVG-1.1-SE/filters-felem-01-b.svg b/LayoutTests/svg/W3C-SVG-1.1-SE/filters-felem-01-b.svg
new file mode 100644 (file)
index 0000000..4ad9586
--- /dev/null
@@ -0,0 +1,90 @@
+<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="BB" author="CL" status="accepted"
+    version="$Revision: 1.7 $" testname="$RCSfile: filters-felem-01-b.svg,v $">
+    <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/filters.html#FilterElement">
+      <p>
+        Test which verifies null filters and filter regions.
+      </p>
+      <p>
+        Four subtests each consist of a small red circle overdrawn with a larger green circle. 
+        Filters are applied to three of the red circles, hiding them and showing the green circle.
+      </p>
+      <p>
+        The top left subtest has no filter applied to the circle, so the green circle is visible and the red one is not. 
+        The top right subtest applies a filter to the red circle, but there is no corresponding filter element. 
+        Thus, a null filter is applied and the red circle is not shown, allowing the green circle to be seen.
+      </p>
+      <p>
+        The bottom left subtest applies an empty filter element with the default filterRegion, and the bottom right 
+        subtest applies an empty filter with a non-default filterRegion. In both cases where empty filters are applied, 
+        the result of the filter is a transparent black offscreen, thus showing the green circle underneath.
+      </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 four green circles visible.
+      </p>
+    </d:passCriteria>
+  </d:SVGTestCase>
+  <title id="test-title">$RCSfile: filters-felem-01-b.svg,v $</title>
+  <defs>
+    <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
+      <font-face-src>
+        <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
+      </font-face-src>
+    </font-face>
+  </defs>
+  <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
+    <defs>
+      <filter id="null"/>
+      <filter id="nullreg" filterUnits="objectBoundingBox" x="40%" y="40%" width="20%" height="20%"/>
+    </defs>
+    <g>
+      <circle r="30" fill="red" cx="130" cy="60"/>
+      <circle r="40" fill="lime" cx="130" cy="60"/>
+      <text font-size="20" x="130" y="130" text-anchor="middle">No filter</text>
+    </g>
+    <g>
+      <circle r="30" fill="lime" cx="130" cy="210"/>
+      <circle r="40" fill="red" cx="130" cy="210" filter="url(#null)"/>
+      <text font-size="20" x="130" y="280" text-anchor="middle">Null filter</text>
+    </g>
+    <g>
+      <circle r="30" fill="lime" cx="330" cy="60"/>
+      <circle r="40" fill="red" cx="330" cy="60" filter="url(#notthere)"/>
+      <text font-size="20" x="330" y="130" text-anchor="middle">Non-existent filter</text>
+    </g>
+    <g>
+      <circle r="30" fill="lime" cx="330" cy="210"/>
+      <circle r="40" fill="red" cx="330" cy="210" filter="url(#nullreg)"/>
+      <text font-size="20" x="330" y="280" text-anchor="middle">Null with small region filter</text>
+    </g>
+  </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="#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>
index 4913fb3..c6900e1 100644 (file)
@@ -1,3 +1,18 @@
+2011-05-25  Rob Buis  <rbuis@rim.com>
+
+        Reviewed by Eric Seidel.
+        New test rubber-stamped by Dirk Schulze.
+
+        WebKit does not handle missing filter elements correctly
+        https://bugs.webkit.org/show_bug.cgi?id=12569
+
+        Do not render elements that reference non-existant filters.
+
+        Test: svg/W3C-SVG-1.1-SE/filters-felem-01-b.svg
+
+        * rendering/svg/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderSupport::prepareToRenderSVGContent):
+
 2011-05-25  Nate Chapin  <japhet@chromium.org>
 
         Reviewed by Adam Barth.
index bfc74f0..d9755ef 100644 (file)
@@ -106,8 +106,13 @@ bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo
     }
 
     SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
-    if (!resources)
+    if (!resources) {
+#if ENABLE(FILTERS)
+        if (svgStyle->hasFilter())
+            return false;
+#endif
         return true;
+    }
 
     if (RenderSVGResourceMasker* masker = resources->masker()) {
         if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode))