Title: [94116] trunk
Revision
94116
Author
[email protected]
Date
2011-08-30 15:12:02 -0700 (Tue, 30 Aug 2011)

Log Message

getBBox() on a SVGPathElement with curves incorrectly includes control points
https://bugs.webkit.org/show_bug.cgi?id=53512
<rdar://problem/9861154>

Reviewed by Dirk Schulze.

The CoreGraphics implementation of Path::boundingRect() called
CGPathGetBoundingBox, which includes the path's control points in its
calculations. Snow Leopard added CGPathGetPathBoundingBox, which
finds the bounding box of only points within the path, and does not
include control points. On Snow Leopard and above, we now use the latter.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94115 => 94116)


--- trunk/LayoutTests/ChangeLog	2011-08-30 22:09:21 UTC (rev 94115)
+++ trunk/LayoutTests/ChangeLog	2011-08-30 22:12:02 UTC (rev 94116)
@@ -1,5 +1,20 @@
 2011-08-30  Tim Horton  <[email protected]>
 
+        getBBox() on a SVGPathElement with curves incorrectly includes control points
+        https://bugs.webkit.org/show_bug.cgi?id=53512
+        <rdar://problem/9861154>
+
+        Reviewed by Dirk Schulze.
+
+        Add a test ensuring that getBBox returns only the bounds of the filled shape,
+        not the bounds of all of the control points.
+
+        * platform/chromium/test_expectations.txt:
+        * svg/custom/getBBox-path-expected.txt: Added.
+        * svg/custom/getBBox-path.svg: Added.
+
+2011-08-30  Tim Horton  <[email protected]>
+
         SVG panning y-axis is flipped in WebKit2
         https://bugs.webkit.org/show_bug.cgi?id=65800
         <rdar://problem/9908012>

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (94115 => 94116)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-08-30 22:09:21 UTC (rev 94115)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-08-30 22:12:02 UTC (rev 94116)
@@ -3587,6 +3587,9 @@
 // Caused by r92618
 BUGWK65874 : fast/js/preventExtensions.html = TEXT
 
+// Introduced due to BUGWK53512, fails under Skia right now
+BUGWK65939 : svg/custom/getBBox-path.svg = TEXT
+
 // Caused by r92704
 BUGWK65951 WIN DEBUG : webaudio/audiobuffersource.html = CRASH
 BUGWK65951 WIN DEBUG : webaudio/mixing.html = CRASH

Added: trunk/LayoutTests/svg/custom/getBBox-path-expected.txt (0 => 94116)


--- trunk/LayoutTests/svg/custom/getBBox-path-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/getBBox-path-expected.txt	2011-08-30 22:12:02 UTC (rev 94116)
@@ -0,0 +1 @@
+100 37.5 PASS

Added: trunk/LayoutTests/svg/custom/getBBox-path.svg (0 => 94116)


--- trunk/LayoutTests/svg/custom/getBBox-path.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/getBBox-path.svg	2011-08-30 22:12:02 UTC (rev 94116)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" _onload_="init()">
+  <script type="text/_javascript_">
+  <![CDATA[
+    function init()
+    {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+        var txt = document.getElementById("text");
+        size = document.getElementById("shape").getBBox();
+        var passState = "FAIL";
+        if(size.width == 100 && size.height == 37.5)
+            passState = "PASS";
+        var textNode = document.createTextNode(size.width + " " + size.height + " " + passState);
+        txt.appendChild(textNode);
+    }
+  ]]>
+  </script>
+  <path id="shape" d="M100,100 C125,150 175,150 200,100 z" />
+  <text id="text" x="50" y="50" />
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (94115 => 94116)


--- trunk/Source/WebCore/ChangeLog	2011-08-30 22:09:21 UTC (rev 94115)
+++ trunk/Source/WebCore/ChangeLog	2011-08-30 22:12:02 UTC (rev 94116)
@@ -1,5 +1,24 @@
 2011-08-30  Tim Horton  <[email protected]>
 
+        getBBox() on a SVGPathElement with curves incorrectly includes control points
+        https://bugs.webkit.org/show_bug.cgi?id=53512
+        <rdar://problem/9861154>
+
+        Reviewed by Dirk Schulze.
+
+        The CoreGraphics implementation of Path::boundingRect() called
+        CGPathGetBoundingBox, which includes the path's control points in its
+        calculations. Snow Leopard added CGPathGetPathBoundingBox, which
+        finds the bounding box of only points within the path, and does not
+        include control points. On Snow Leopard and above, we now use the latter.
+
+        Test: svg/custom/getBBox-path.svg
+
+        * platform/graphics/cg/PathCG.cpp:
+        (WebCore::Path::boundingRect):
+
+2011-08-30  Tim Horton  <[email protected]>
+
         SVG panning y-axis is flipped in WebKit2
         https://bugs.webkit.org/show_bug.cgi?id=65800
         <rdar://problem/9908012>

Modified: trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp (94115 => 94116)


--- trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2011-08-30 22:09:21 UTC (rev 94115)
+++ trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2011-08-30 22:12:02 UTC (rev 94116)
@@ -163,7 +163,13 @@
 
 FloatRect Path::boundingRect() const
 {
+    // CGPathGetBoundingBox includes the path's control points, CGPathGetPathBoundingBox
+    // does not, but only exists on 10.6 and above.
+#if !defined(BUILDING_ON_LEOPARD)
+    return CGPathGetPathBoundingBox(m_path);
+#else
     return CGPathGetBoundingBox(m_path);
+#endif
 }
 
 FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to