Reviewed by Mitz.
authorrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Dec 2007 07:40:57 +0000 (07:40 +0000)
committerrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Dec 2007 07:40:57 +0000 (07:40 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=15289
        WebKit does not respect clip paths of a 0x0 rect

        Make empty clip paths clip the whole referencing graphic.

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.png
LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.txt
LayoutTests/platform/mac/svg/batik/text/textEffect2-expected.checksum
LayoutTests/platform/mac/svg/batik/text/textEffect2-expected.png
LayoutTests/platform/mac/svg/batik/text/textProperties-expected.checksum
LayoutTests/platform/mac/svg/batik/text/textProperties-expected.png
LayoutTests/svg/custom/empty-clip-path-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/empty-clip-path-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/empty-clip-path-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/empty-clip-path.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/svg/SVGClipPathElement.cpp
WebCore/svg/graphics/SVGResourceClipper.h

index 451382f2613fa4e54412f9722fe0aa1112a817a5..c088a5e11ceca0881aa829b6312d9f2ee5d44d9b 100644 (file)
@@ -1,3 +1,22 @@
+2007-12-05  Rob Buis  <buis@kde.org>
+
+        Reviewed by Mitz.
+
+        Testcase for:
+        http://bugs.webkit.org/show_bug.cgi?id=15289
+        WebKit does not respect clip paths of a 0x0 rect
+
+        * platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.png:
+        * platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.txt:
+        * platform/mac/svg/batik/text/textEffect2-expected.checksum:
+        * platform/mac/svg/batik/text/textEffect2-expected.png:
+        * platform/mac/svg/batik/text/textProperties-expected.checksum:
+        * platform/mac/svg/batik/text/textProperties-expected.png:
+        * svg/custom/empty-clip-path-expected.checksum: Added.
+        * svg/custom/empty-clip-path-expected.png: Added.
+        * svg/custom/empty-clip-path-expected.txt: Added.
+        * svg/custom/empty-clip-path.svg: Added.
+
 2007-12-05  Alice Liu  <alice.liu@apple.com>
 
         Reviewed by Antti.
index 77de231c9381452325902443aba63985e5432798..ac5bbd10b174e0cbee6d5b0f012693e4a6ecd223 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.png and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-path-04-b-expected.png differ
index 0c8b97287a8bc36a5c0fe6edd15692975ca2507e..d0a33b4750c3239960106bab76353b58505e9132 100644 (file)
@@ -1,4 +1,4 @@
-KCanvasResource {id="sample" [type=CLIPPER] [clip data=[]]}
+KCanvasResource {id="sample" [type=CLIPPER] [clip data=[[winding=EVEN-ODD] [path=M0.00,0.00L0.00,0.00L0.00,0.00L0.00,0.00]]]}
 layer at (0,0) size 480x360
   RenderView at (0,0) size 480x360
 layer at (0,0) size 480x360
index 80681cc75a8c1ca5d09726fec036c9bca00493a1..1f918bcb7c8f8018d311cec195dcd42d3186eb2c 100644 (file)
@@ -1 +1 @@
-b95c7c2774010b4878543ebdbb01ebb1
\ No newline at end of file
+73879241b4dde5c4d611ac8a5570a2cd
\ No newline at end of file
index 9ebd7c9fe41b6bb54e9ce93e0bb2815e08dd2917..ede1b02b1a2844af0f298c1ca158050670d012ca 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/batik/text/textEffect2-expected.png and b/LayoutTests/platform/mac/svg/batik/text/textEffect2-expected.png differ
index 300faaf8a09c9fd769348240ed6b3260a6f2b820..bafde1fba8f7a94a3239f3e9971b12ce3ed4f4bb 100644 (file)
@@ -1 +1 @@
-397afdef1c93851d9f943ca00a0e0cf0
\ No newline at end of file
+6c21a6781c6372037dbb34959d2426c9
\ No newline at end of file
index 2c8cc3be875ed640b1300c06f38ed4eb560239bf..861286ac78b52802cc0a0ccc7ad82fbb7c017b5b 100644 (file)
Binary files a/LayoutTests/platform/mac/svg/batik/text/textProperties-expected.png and b/LayoutTests/platform/mac/svg/batik/text/textProperties-expected.png differ
diff --git a/LayoutTests/svg/custom/empty-clip-path-expected.checksum b/LayoutTests/svg/custom/empty-clip-path-expected.checksum
new file mode 100644 (file)
index 0000000..d06729f
--- /dev/null
@@ -0,0 +1 @@
+1438bcc295fb5bf73c1dccd4de804baa
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/empty-clip-path-expected.png b/LayoutTests/svg/custom/empty-clip-path-expected.png
new file mode 100644 (file)
index 0000000..5a519b0
Binary files /dev/null and b/LayoutTests/svg/custom/empty-clip-path-expected.png differ
diff --git a/LayoutTests/svg/custom/empty-clip-path-expected.txt b/LayoutTests/svg/custom/empty-clip-path-expected.txt
new file mode 100644 (file)
index 0000000..e7e4650
--- /dev/null
@@ -0,0 +1,19 @@
+KCanvasResource {id="nothing" [type=CLIPPER] [clip data=[[winding=EVEN-ODD] [path=M0.00,0.00L0.00,0.00L0.00,0.00L0.00,0.00]]]}
+KCanvasResource {id="emptyrect" [type=CLIPPER] [clip data=[[winding=EVEN-ODD] [path=M0.00,0.00L0.00,0.00L0.00,0.00L0.00,0.00]]]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 452x154
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+    RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+    RenderSVGContainer {g} at (0,0) size 100x100 [clip path="#nothing"]
+      RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+    RenderSVGContainer {g} at (0,0) size 100x100 [clip path="#emptyrect"]
+      RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+    RenderSVGContainer {g} at (0,116) size 452x38
+      RenderSVGText {text} at (0,130) size 287x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,-14) size 287x18
+          chunk 1 text run 1 at (0.00,130.00) startOffset 0 endOffset 44 width 287.00: "Above a green rectangle should be displayed."
+      RenderSVGText {text} at (0,150) size 452x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,-14) size 452x18
+          chunk 1 text run 1 at (0.00,150.00) startOffset 0 endOffset 74 width 452.00: "It tests that an empty clip path clips the referencing graphic. Bug 15289."
diff --git a/LayoutTests/svg/custom/empty-clip-path.svg b/LayoutTests/svg/custom/empty-clip-path.svg
new file mode 100644 (file)
index 0000000..4f6e692
--- /dev/null
@@ -0,0 +1,23 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+  <defs>
+    <clipPath id="nothing">
+    </clipPath>
+    <clipPath id="emptyrect">
+      <rect width="0" height="0"/>
+    </clipPath>
+  </defs>
+
+  <rect fill="green" width="100" height="100"/>
+  <g clip-path="url(#nothing)" >
+    <rect width="100" height="100" fill="red"/>
+  </g>
+  <g clip-path="url(#emptyrect)" >
+    <rect width="100" height="100" fill="red"/>
+  </g>
+
+  <g>
+    <text y="130">Above a green rectangle should be displayed.</text>
+    <text y="150">It tests that an empty clip path clips the referencing graphic. Bug 15289.</text>
+  </g>
+</svg>
+
index 43737ea297f4fe9bb4f02a326c3ba5a837610ccc..afe4eb7bcf8700c721a773247b1147e55039176e 100644 (file)
@@ -1,3 +1,17 @@
+2007-12-05  Rob Buis  <buis@kde.org>
+
+        Reviewed by Mitz.
+
+        http://bugs.webkit.org/show_bug.cgi?id=15289
+        WebKit does not respect clip paths of a 0x0 rect
+
+        Make empty clip paths clip the whole referencing graphic.
+
+        * svg/SVGClipPathElement.cpp:
+        (WebCore::SVGClipPathElement::canvasResource):
+        * svg/graphics/SVGResourceClipper.h:
+        (WebCore::ClipDataList::isEmpty):
+
 2007-12-05  Darin Adler  <darin@apple.com>
 
         Reviewed by Maciej.
index 25559eb85cc3d54d8148658998e114331752df95..fd6cd3030d3e8797b3e88f3e6d04ab032f17f265 100644 (file)
@@ -88,6 +88,11 @@ SVGResource* SVGClipPathElement::canvasResource()
             pathStyle->deref(document()->renderArena());
         }
     }
+    if (m_clipper->clipData().isEmpty() ) {
+        Path pathData;
+        pathData.addRect(FloatRect());
+        m_clipper->addClipData(pathData, RULE_EVENODD, bbox);
+    }
     clipPathStyle->deref(document()->renderArena());
     return m_clipper.get();
 }
index f7425d20742f446704655afcfdb8c3efee78fc4e..d5c1ab770e05bd7792fa046a5c03512b05f93499 100644 (file)
@@ -54,6 +54,7 @@ namespace WebCore {
         
         void clear() { m_clipData.clear(); }
         const Vector<ClipData>& clipData() const { return m_clipData; }
+        bool isEmpty() const { return m_clipData.isEmpty(); }
     private:
         Vector<ClipData> m_clipData;
     };