Commit 47c6523e authored by timothy_horton@apple.com's avatar timothy_horton@apple.com
Browse files

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e51a25ac
2011-08-30 Tim Horton <timothy_horton@apple.com>
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 <timothy_horton@apple.com>
 
SVG panning y-axis is flipped in WebKit2
......@@ -3587,6 +3587,9 @@ BUGWK65862 MAC DEBUG SLOW : storage/indexeddb/index-cursor.html = PASS
// 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
......
<?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>
2011-08-30 Tim Horton <timothy_horton@apple.com>
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 <timothy_horton@apple.com>
 
SVG panning y-axis is flipped in WebKit2
......@@ -163,7 +163,13 @@ void Path::translate(const FloatSize& size)
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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment