Diff
Modified: trunk/LayoutTests/ChangeLog (108856 => 108857)
--- trunk/LayoutTests/ChangeLog 2012-02-24 23:35:23 UTC (rev 108856)
+++ trunk/LayoutTests/ChangeLog 2012-02-24 23:49:15 UTC (rev 108857)
@@ -1,3 +1,25 @@
+2012-02-24 Hans Muller <[email protected]>
+
+ onclick is not reliable for transformed SVG elements
+ https://bugs.webkit.org/show_bug.cgi?id=34714
+
+ Reviewed by Dirk Schulze.
+
+ New svg-small-viewbox test checks that elementFromPoint() works correctly with SVG
+ elements defined within a 1x1 viewbox.
+
+ Revised select-textLength-spacing-squeeze-2.svg to avoid a corner-case,
+ removed unnecessary -1 adjustment of absEndPos.x from SelectionTestCase.js.
+
+ * platform/chromium/test_expectations.txt:
+ * platform/mac/svg/text/select-textLength-spacing-squeeze-2-expected.png:
+ * platform/mac/svg/text/select-textLength-spacing-squeeze-2-expected.txt:
+ * svg/hittest/svg-small-viewbox-expected.txt: Added.
+ * svg/hittest/svg-small-viewbox.xhtml: Added.
+ * svg/text/resources/SelectionTestCase.js:
+ (selectRange):
+ * svg/text/select-textLength-spacing-squeeze-2.svg:
+
2012-02-24 Julien Chaffraix <[email protected]>
Implement limited parsing of -webkit-grid-column and -webkit-grid-row
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (108856 => 108857)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-24 23:35:23 UTC (rev 108856)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-24 23:49:15 UTC (rev 108857)
@@ -933,6 +933,9 @@
// Updated test, needs a rebaseline
BUGWK78613 : svg/custom/circle-move-invalidation.svg = IMAGE IMAGE+TEXT
+// Changed test, needs a rebaseline
+BUGWK34714 : svg/text/select-textLength-spacing-squeeze-2.svg = IMAGE IMAGE+TEXT
+
// New test, needs a rebaseline
BUGWK77903 : svg/repaint/inner-svg-change-viewBox-contract.svg = IMAGE IMAGE+TEXT
Modified: trunk/LayoutTests/platform/mac/svg/text/select-textLength-spacing-squeeze-2-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/svg/text/select-textLength-spacing-squeeze-2-expected.txt (108856 => 108857)
--- trunk/LayoutTests/platform/mac/svg/text/select-textLength-spacing-squeeze-2-expected.txt 2012-02-24 23:35:23 UTC (rev 108856)
+++ trunk/LayoutTests/platform/mac/svg/text/select-textLength-spacing-squeeze-2-expected.txt 2012-02-24 23:49:15 UTC (rev 108857)
@@ -2,10 +2,10 @@
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (50,0) size 260x65
- RenderSVGContainer {g} at (120,4) size 41x57
- RenderSVGPath {svg:line} at (120,4) size 6x57 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=SOLID] [color=#000000]}] [x1=24.67] [y1=0.95] [x2=24.67] [y2=12.17]
- RenderSVGPath {svg:line} at (155,4) size 6x57 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=SOLID] [color=#000000]}] [x1=31.52] [y1=0.95] [x2=31.52] [y2=12.17]
- RenderSVGRect {svg:rect} at (123,4) size 35x57 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=24.67] [y=0.95] [width=6.85] [height=11.17]
+ RenderSVGContainer {g} at (153,4) size 59x57
+ RenderSVGPath {svg:line} at (153,4) size 6x57 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=SOLID] [color=#000000]}] [x1=31.23] [y1=0.95] [x2=31.23] [y2=12.17]
+ RenderSVGPath {svg:line} at (206,4) size 6x57 [stroke={[type=SOLID] [color=#008000]}] [fill={[type=SOLID] [color=#000000]}] [x1=41.88] [y1=0.95] [x2=41.88] [y2=12.17]
+ RenderSVGRect {svg:rect} at (156,4) size 54x57 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=31.23] [y=0.95] [width=10.65] [height=11.17]
RenderSVGText {text} at (10,0) size 52x12 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 52x12
chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.20: "T"
@@ -23,5 +23,5 @@
chunk 1 text run 13 at (48.44,10.00) startOffset 12 endOffset 13 width 5.60: "e"
chunk 1 text run 14 at (52.49,10.00) startOffset 13 endOffset 14 width 5.00: "z"
chunk 1 text run 15 at (55.95,10.00) startOffset 14 endOffset 15 width 5.60: "e"
-selection start: position 5 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
-selection end: position 7 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
+selection start: position 8 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
+selection end: position 10 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
Added: trunk/LayoutTests/svg/hittest/svg-small-viewbox-expected.txt (0 => 108857)
--- trunk/LayoutTests/svg/hittest/svg-small-viewbox-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/hittest/svg-small-viewbox-expected.txt 2012-02-24 23:49:15 UTC (rev 108857)
@@ -0,0 +1,14 @@
+Test for bug 34714 - onclick is not reliable for transformed SVG elements. This test checks that elementFromPoint() works correctly with an SVG rect element (green) defined within a 1x1 viewbox.
+
+On success, you will see a series of "PASS" messages
+
+PASS rect contains point @ 1, 1
+PASS rect contains point @ 1, 399
+PASS rect contains point @ 399, 1
+PASS rect contains point @ 399, 399
+PASS rect contains point @ 200, 200
+PASS rect does not contain point @ 1, 401
+PASS rect does not contain point @ 401, 1
+PASS rect does not contain point @ 401, 401
+PASS rect does not contain point @ -1, -1
+
Added: trunk/LayoutTests/svg/hittest/svg-small-viewbox.xhtml (0 => 108857)
--- trunk/LayoutTests/svg/hittest/svg-small-viewbox.xhtml (rev 0)
+++ trunk/LayoutTests/svg/hittest/svg-small-viewbox.xhtml 2012-02-24 23:49:15 UTC (rev 108857)
@@ -0,0 +1,65 @@
+<html xmlns='http://www.w3.org/1999/xhtml'>
+ <head>
+ <style>
+ #svgRoot {
+ margin: 0px;
+ padding: 0px;
+ position: absolute;
+ top: 0px;
+ left: 0px;"
+ }
+
+ #rect {
+ fill: green;
+ fill-opacity: 0.1;
+ }
+ </style>
+ </head>
+ <body>
+ <p>Test for bug 34714 - onclick is not reliable for transformed SVG elements. This test checks that elementFromPoint() works correctly with an SVG rect element (green) defined within a 1x1 viewbox.</p>
+ <p>On success, you will see a series of "PASS" messages</p>
+ <pre id="console"></pre>
+
+ <svg id="svgRoot" width="400px" height="400px" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg">
+ <g transform="translate(0.5, 0)">
+ <rect id="rect" width="1" height="1" transform="translate(-0.499, 0)"/>
+ </g>
+ </svg>
+
+ <script><![CDATA[
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ }
+
+ var resultString = "";
+ var rectElt = document.getElementById("rect");
+
+ var pointsInRect = [
+ {x: 1, y: 1}, // fails without the fix
+ {x: 1, y: 399}, // fails without the fix
+ {x: 399, y: 1},
+ {x: 399, y: 399},
+ {x: 200, y: 200}
+ ];
+
+ pointsInRect.forEach( function(point) {
+ var pass = (rectElt == document.elementFromPoint(point.x, point.y));
+ resultString += ((pass) ? "PASS " : "FAIL ") + " rect contains point @ " + point.x + ", " + point.y + "\n";
+ });
+
+ var pointsNotInRect = [
+ {x: 1, y: 401},
+ {x: 401, y: 1},
+ {x: 401, y: 401},
+ {x: -1, y: -1},
+ ];
+
+ pointsNotInRect.forEach( function(point) {
+ var pass = (rectElt != document.elementFromPoint(point.x, point.y));
+ resultString += ((pass) ? "PASS " : "FAIL ") + " rect does not contain point @ " + point.x + ", " + point.y + "\n";
+ });
+
+ document.getElementById("console").innerHTML = resultString;
+ ]]></script>
+ </body>
+</html>
Modified: trunk/LayoutTests/svg/text/resources/SelectionTestCase.js (108856 => 108857)
--- trunk/LayoutTests/svg/text/resources/SelectionTestCase.js 2012-02-24 23:35:23 UTC (rev 108856)
+++ trunk/LayoutTests/svg/text/resources/SelectionTestCase.js 2012-02-24 23:49:15 UTC (rev 108857)
@@ -66,7 +66,6 @@
var absStartPos = toAbsoluteCoordinates(startPos, element);
var absEndPos = toAbsoluteCoordinates(endPos, element);
- absEndPos.x -= 1;
// Move to selection origin and hold down mouse
eventSender.mouseMoveTo(absStartPos.x, absStartPos.y);
Modified: trunk/LayoutTests/svg/text/select-textLength-spacing-squeeze-2.svg (108856 => 108857)
--- trunk/LayoutTests/svg/text/select-textLength-spacing-squeeze-2.svg 2012-02-24 23:35:23 UTC (rev 108856)
+++ trunk/LayoutTests/svg/text/select-textLength-spacing-squeeze-2.svg 2012-02-24 23:49:15 UTC (rev 108857)
@@ -5,5 +5,5 @@
<text id="test" x="10" y="10" font-family="Arial" font-size="10" textLength="50" lengthAdjust="spacing">Text to Squeeze</text>
<script xlink:href=""
-<script>selectRange("test", 5, 6, "to");</script>
+<script>selectRange("test", 8, 9, "Sq");</script>
</svg>
Modified: trunk/Source/WebCore/ChangeLog (108856 => 108857)
--- trunk/Source/WebCore/ChangeLog 2012-02-24 23:35:23 UTC (rev 108856)
+++ trunk/Source/WebCore/ChangeLog 2012-02-24 23:49:15 UTC (rev 108857)
@@ -1,3 +1,18 @@
+2012-02-24 Hans Muller <[email protected]>
+
+ onclick is not reliable for transformed SVG elements
+ https://bugs.webkit.org/show_bug.cgi?id=34714
+
+ Reviewed by Dirk Schulze.
+
+ Use FloatPoints in RenderSVGRoot::nodeAtPoint() when converting the incoming
+ point to local coordinates.
+
+ Test: svg/hittest/svg-small-viewbox.xhtml
+
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::nodeAtPoint):
+
2012-02-24 Julien Chaffraix <[email protected]>
Implement limited parsing of -webkit-grid-column and -webkit-grid-row
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (108856 => 108857)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2012-02-24 23:35:23 UTC (rev 108856)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2012-02-24 23:49:15 UTC (rev 108857)
@@ -376,7 +376,7 @@
if (!contentBoxRect().contains(pointInBorderBox))
return false;
- LayoutPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
+ FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent));
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {