[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 11:13:35 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1253fb292c5a9f2bda9fb8ad09bea5f335a52730
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 15 10:15:33 2010 +0000

    2010-07-15  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            clipPath is missing cycle detection
            https://bugs.webkit.org/show_bug.cgi?id=42350
    
            Detect cyclic clipper resources, and ignore them on rendering. Early exit in applyResource just like the pattern/mask resources do.
    
            * rendering/RenderSVGResourceClipper.cpp:
            (WebCore::RenderSVGResourceClipper::applyResource):
            (WebCore::RenderSVGResourceClipper::hitTestClipContent):
            (WebCore::RenderSVGResourceClipper::childElementReferencesResource):
            * rendering/RenderSVGResourceClipper.h:
    
    2010-07-15  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            clipPath is missing cycle detection
            https://bugs.webkit.org/show_bug.cgi?id=42350
    
            Change clipPath behaviour: clipPath children that reference the clipPath they define, are not ignored.
            Updated tests accordingly. Raised SVG WG question, as the handling is inconsistent between Opera/FF & WebKit.
    
            * platform/mac/svg/clip-path/clip-path-recursive-call-by-child-expected.txt:
            * platform/mac/svg/custom/recursive-clippath-expected.checksum:
            * platform/mac/svg/custom/recursive-clippath-expected.png:
            * platform/mac/svg/custom/recursive-clippath-expected.txt:
            * svg/clip-path/clip-path-recursive-call-by-child.svg:
            * svg/custom/recursive-clippath.svg:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63420 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dea620a..73d32e8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,22 @@
 2010-07-15  Nikolas Zimmermann  <nzimmermann at rim.com>
 
+        Reviewed by Dirk Schulze.
+
+        clipPath is missing cycle detection
+        https://bugs.webkit.org/show_bug.cgi?id=42350
+
+        Change clipPath behaviour: clipPath children that reference the clipPath they define, are not ignored.
+        Updated tests accordingly. Raised SVG WG question, as the handling is inconsistent between Opera/FF & WebKit.
+
+        * platform/mac/svg/clip-path/clip-path-recursive-call-by-child-expected.txt:
+        * platform/mac/svg/custom/recursive-clippath-expected.checksum:
+        * platform/mac/svg/custom/recursive-clippath-expected.png:
+        * platform/mac/svg/custom/recursive-clippath-expected.txt:
+        * svg/clip-path/clip-path-recursive-call-by-child.svg:
+        * svg/custom/recursive-clippath.svg:
+
+2010-07-15  Nikolas Zimmermann  <nzimmermann at rim.com>
+
         Rubber-stamped by Dirk Schulze.
 
         Extend svg/custom/recursive-gradient.svg with the same recursion tests patterns have.
diff --git a/LayoutTests/platform/mac/svg/clip-path/clip-path-recursive-call-by-child-expected.txt b/LayoutTests/platform/mac/svg/clip-path/clip-path-recursive-call-by-child-expected.txt
index 8045cb7..dfccbfe 100644
--- a/LayoutTests/platform/mac/svg/clip-path/clip-path-recursive-call-by-child-expected.txt
+++ b/LayoutTests/platform/mac/svg/clip-path/clip-path-recursive-call-by-child-expected.txt
@@ -6,6 +6,6 @@ layer at (0,0) size 800x600
       RenderSVGResourceClipper {clipPath} [id="clip"] [clipPathUnits=userSpaceOnUse]
         RenderPath {rect} at (0,0) size 100x50 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,50.00 L0.00,50.00 Z"]
           [clipPath="clip"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x50
-    RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
-    RenderPath {rect} at (0,0) size 100x50 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
+    RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
+    RenderPath {rect} at (0,0) size 100x50 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
       [clipPath="clip"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x50
diff --git a/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.checksum b/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.checksum
index 7363841..215a511 100644
--- a/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.checksum
+++ b/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.checksum
@@ -1 +1 @@
-778803df0a824ed8f2c7dfa07c56832e
\ No newline at end of file
+3aa16a092fe25416b039cd3ea92f1ead
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.png b/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.png
index a56e38c..dbeabf5 100644
Binary files a/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.png and b/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.txt b/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.txt
index 809c8c4..a4657e4 100644
--- a/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/recursive-clippath-expected.txt
@@ -1,10 +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 100x100
-    RenderSVGResourceClipper {clipPath} [id="clipPath_0"] [clipPathUnits=userSpaceOnUse]
-      RenderPath {rect} at (0,0) size 100x100 [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
-        [clipPath="clipPath_0"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x100
-    RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L200.00,0.00 L200.00,200.00 L0.00,200.00 Z"]
+  RenderSVGRoot {svg} at (0,0) size 200x200
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGResourceClipper {clipPath} [id="clipPath_0"] [clipPathUnits=userSpaceOnUse]
+        RenderPath {rect} at (0,0) size 100x100 [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
+          [clipPath="clipPath_0"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x100
+    RenderPath {rect} at (0,0) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L200.00,0.00 L200.00,200.00 L0.00,200.00 Z"]
+    RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L200.00,0.00 L200.00,200.00 L0.00,200.00 Z"]
       [clipPath="clipPath_0"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x100
-    RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
diff --git a/LayoutTests/svg/clip-path/clip-path-recursive-call-by-child.svg b/LayoutTests/svg/clip-path/clip-path-recursive-call-by-child.svg
index d1679cb..2da9627 100644
--- a/LayoutTests/svg/clip-path/clip-path-recursive-call-by-child.svg
+++ b/LayoutTests/svg/clip-path/clip-path-recursive-call-by-child.svg
@@ -4,6 +4,13 @@
         <rect x="0" y="0" width="100" height="50" clip-path="url(#clip)"/>
     </clipPath>
 </defs>
-<rect x="0" y="0" width="100" height="100" style="fill:green;"/>
-<rect x="0" y="0" width="100" height="100" clip-path="url(#clip)" style="fill:red;"/>
+<!--
+Spec: clip-path: If the IRI reference is not valid (e.g it points to an object that doesn't exist or the object
+                 is not a 'clipPath' element) the 'clip-path' property must be treated as if it hadn't been specified.
+
+     Our view is that an clipPath containing a cycle is not valid, and thus should be ignored.
+     But the object that references the clipPath should still be drawn.
+-->
+<rect x="0" y="0" width="100" height="100" style="fill:red;"/>
+<rect x="0" y="0" width="100" height="100" clip-path="url(#clip)" style="fill:green;"/>
 </svg>
diff --git a/LayoutTests/svg/custom/recursive-clippath.svg b/LayoutTests/svg/custom/recursive-clippath.svg
index 326d228..c0741c9 100644
--- a/LayoutTests/svg/custom/recursive-clippath.svg
+++ b/LayoutTests/svg/custom/recursive-clippath.svg
@@ -1,7 +1,18 @@
 <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
+<defs>
     <clipPath id='clipPath_0'>
         <rect x='0' y='0' width='100' height='100' fill='none' clip-path='url(#clipPath_0)'/>
     </clipPath>
-    <rect x='0' y='0' width='200' height='200' fill='red' clip-path='url(#clipPath_0)'/>
-    <rect x='0' y='0' width='100' height='100' fill='green'/>
-</svg>
\ No newline at end of file
+</defs>
+
+<!--
+Spec: clip-path: If the IRI reference is not valid (e.g it points to an object that doesn't exist or the object
+                 is not a ‘clipPath’ element) the ‘clip-path’ property must be treated as if it hadn't been specified.
+
+      Our view is that an clipPath containing a cycle is not valid, and thus should be ignored.
+      But the object that references the clipPath should still be drawn.
+-->
+
+<rect x='0' y='0' width='200' height='200' fill='red'/>
+<rect x='0' y='0' width='200' height='200' fill='green' clip-path='url(#clipPath_0)'/>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 71f2ab3..6c89de9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-15  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        clipPath is missing cycle detection
+        https://bugs.webkit.org/show_bug.cgi?id=42350
+
+        Detect cyclic clipper resources, and ignore them on rendering. Early exit in applyResource just like the pattern/mask resources do.
+
+        * rendering/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::applyResource):
+        (WebCore::RenderSVGResourceClipper::hitTestClipContent):
+        (WebCore::RenderSVGResourceClipper::childElementReferencesResource):
+        * rendering/RenderSVGResourceClipper.h:
+
 2010-07-15  Mark Rowe  <mrowe at apple.com>
 
         Reviewed by Maciej Stachowiak.
diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp
index cc499bf..5116ea7 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.cpp
+++ b/WebCore/rendering/RenderSVGResourceClipper.cpp
@@ -95,6 +95,11 @@ bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*,
 #else
     UNUSED_PARAM(resourceMode);
 #endif
+
+    // Early exit, if this resource contains a child which references ourselves.
+    if (containsCyclicReference(node()))
+        return false;
+
     applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context);
     return true;
 }
@@ -270,6 +275,12 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect()
 
 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint)
 {
+    // FIXME: We should be able to check whether m_clipper.contains(object) - this doesn't work at the moment
+    // as resourceBoundingBox() has already created ClipperData, even if applyResource() returned false.
+    // Early exit, if this resource contains a child which references ourselves.
+    if (containsCyclicReference(node()))
+        return false;
+
     FloatPoint point = nodeAtPoint;
     if (!SVGRenderSupport::pointInClippingArea(this, point))
         return false;
@@ -296,6 +307,14 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin
     return false;
 }
 
+bool RenderSVGResourceClipper::childElementReferencesResource(const SVGRenderStyle* style, const String& referenceId) const
+{
+    if (!style->hasClipper())
+        return false;
+
+    return style->clipperResource() == referenceId;
+}
+
 FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object)
 {
     // Save the reference to the calling object for relayouting it on changing resource properties.
diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h
index 78ec75b..6064be1 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.h
+++ b/WebCore/rendering/RenderSVGResourceClipper.h
@@ -68,6 +68,8 @@ private:
     bool createClipData(ClipperData*, const FloatRect&, const FloatRect&);
     void calculateClipContentRepaintRect();
 
+    virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const;
+
     FloatRect m_clipBoundaries;
     HashMap<RenderObject*, ClipperData*> m_clipper;
 };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list