Fix SVG hit testing when padding is present

https://bugs.webkit.org/show_bug.cgi?id=37325

Patch by Philip Rogers <pdr@google.com> on 2011-11-15
Reviewed by Nikolas Zimmermann.

Source/WebCore:

Test: svg/hittest/svg-padding.xhtml

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::nodeAtPoint):

LayoutTests:

* svg/hittest/svg-padding-expected.txt: Added.
* svg/hittest/svg-padding.xhtml: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8d25fc96
2011-11-15 Philip Rogers <pdr@google.com>
Fix SVG hit testing when padding is present
https://bugs.webkit.org/show_bug.cgi?id=37325
Reviewed by Nikolas Zimmermann.
* svg/hittest/svg-padding-expected.txt: Added.
* svg/hittest/svg-padding.xhtml: Added.
2011-11-15 Philippe Normand <pnormand@igalia.com>
Unreviewed, marked
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<style>
body {
margin: 0px;
padding: 0px;
border: 1px solid black;
}
#square {
fill: blue;
}
#square:hover {
fill: green;
}
</style>
</head>
<body>
<table><tr><td>
<svg width='100px' height='100px' style='padding: 50px' xmlns='http://www.w3.org/2000/svg'>
<svg>
<rect id='square' width='100' height='100' onclick='alert("You clicked the square! It worked!")'/>
</svg>
</svg>
</td></tr></table>
<script><![CDATA[
if (window.layoutTestController) {
layoutTestController.dumpAsText();
}
var hitElement = document.elementFromPoint(75, 75);
var hitSuccess = hitElement && hitElement == document.getElementById("square");
document.body.innerHTML = hitSuccess ? "PASSED" : "FAIL, hit " + hitElement + " @ 50, 50";
]]></script>
</body>
</html>
2011-11-15 Philip Rogers <pdr@google.com>
Fix SVG hit testing when padding is present
https://bugs.webkit.org/show_bug.cgi?id=37325
Reviewed by Nikolas Zimmermann.
Test: svg/hittest/svg-padding.xhtml
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::nodeAtPoint):
2011-11-15 Pavel Feldman <pfeldman@google.com>
Web Inspector: move generic code from DevTools.js into the WebCore.
......
......@@ -434,8 +434,7 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
LayoutPoint pointInBorderBox = pointInParent - parentOriginToBorderBox();
// Note: For now, we're ignoring hits to border and padding for <svg>
LayoutPoint pointInContentBox = pointInBorderBox - borderOriginToContentBox();
if (!contentBoxRect().contains(pointInContentBox))
if (!contentBoxRect().contains(pointInBorderBox))
return false;
LayoutPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
......
Markdown is supported
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