Diff
Modified: trunk/LayoutTests/ChangeLog (128461 => 128462)
--- trunk/LayoutTests/ChangeLog 2012-09-13 15:03:24 UTC (rev 128461)
+++ trunk/LayoutTests/ChangeLog 2012-09-13 15:03:48 UTC (rev 128462)
@@ -1,3 +1,17 @@
+2012-09-13 Allan Sandfeld Jensen <[email protected]>
+
+ REGRESSION: hit test doesn't take iframe scroll position into account
+ https://bugs.webkit.org/show_bug.cgi?id=96541
+
+ Reviewed by Antonio Gomes.
+ Test written by Rick Byers.
+
+ Test that scroll position is taken into account in hit testing.
+
+ * fast/events/touch/resources/touch-inside-iframe-scrolled2.html: Added.
+ * fast/events/touch/touch-inside-iframe-scrolled-expected.txt: Added.
+ * fast/events/touch/touch-inside-iframe-scrolled.html: Added.
+
2012-09-13 Kenneth Rohde Christiansen <[email protected]>
[EFL][DRT] Implement LayoutTestController::layerTreeAsText
Added: trunk/LayoutTests/fast/events/touch/resources/touch-inside-iframe-scrolled2.html (0 => 128462)
--- trunk/LayoutTests/fast/events/touch/resources/touch-inside-iframe-scrolled2.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/resources/touch-inside-iframe-scrolled2.html 2012-09-13 15:03:48 UTC (rev 128462)
@@ -0,0 +1,30 @@
+<html>
+<body _onload_="parent.runTest()">
+<style type='text/css'>
+#container {
+ height:1000px;
+ width:1000px
+}
+#mydiv {
+ top:300px;
+ left:100px;
+ width:100px;
+ height:100px;
+ position:absolute;
+ background-color:blue;
+}
+</style>
+<div id='container'>
+<div id='mydiv'></div>
+</div>
+<script type='text/_javascript_'>
+// Scroll so mydiv is at the top left
+window.scrollTo(100,300);
+
+document.getElementById('mydiv').addEventListener('touchstart', function(event) {
+ parent.testComplete(true, event);
+ event.stopPropagation();
+}, false);
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/touch/touch-inside-iframe-scrolled-expected.txt (0 => 128462)
--- trunk/LayoutTests/fast/events/touch/touch-inside-iframe-scrolled-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/touch-inside-iframe-scrolled-expected.txt 2012-09-13 15:03:48 UTC (rev 128462)
@@ -0,0 +1,13 @@
+
+Test iframes receive touches correctly when scrolled. https://bugs.webkit.org/show_bug.cgi?id=96541
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS correctDiv is true
+PASS touch.pageX is 150
+PASS touch.pageY is 350
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/touch-inside-iframe-scrolled.html (0 => 128462)
--- trunk/LayoutTests/fast/events/touch/touch-inside-iframe-scrolled.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/touch-inside-iframe-scrolled.html 2012-09-13 15:03:48 UTC (rev 128462)
@@ -0,0 +1,48 @@
+<html>
+<script src=""
+<body>
+<iframe style="position:absolute; top:100px; left:100px;" src=""
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+description('Test iframes receive touches correctly when scrolled. https://bugs.webkit.org/show_bug.cgi?id=96541');
+
+var touch = null;
+var correctDiv = false;
+
+function testComplete(hitCorrectDiv, event)
+{
+ correctDiv = hitCorrectDiv;
+ shouldBeTrue("correctDiv");
+
+ touch = event.touches[0];
+ shouldBe("touch.pageX", "150");
+ shouldBe("touch.pageY", "350");
+
+ isSuccessfullyParsed();
+ testRunner.notifyDone();
+}
+
+// Backstop to prevent test timeout on incorrect position
+document.addEventListener('touchstart', function(event) {
+ parent.testComplete(false, event);
+}, false);
+
+function runTest() {
+ if (window.eventSender) {
+ // Touch the center of the div in the iframe.
+ // 100px is offset to iframe in main frame,
+ // 2px for the iframe border, 50px to get to centre of the div.
+ eventSender.addTouchPoint(152, 152);
+ eventSender.touchStart();
+ } else {
+ debug('This test requires DRT.');
+ }
+}
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+}
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (128461 => 128462)
--- trunk/Source/WebCore/ChangeLog 2012-09-13 15:03:24 UTC (rev 128461)
+++ trunk/Source/WebCore/ChangeLog 2012-09-13 15:03:48 UTC (rev 128462)
@@ -1,3 +1,18 @@
+2012-09-13 Allan Sandfeld Jensen <[email protected]>
+
+ REGRESSION: hit test doesn't take iframe scroll position into account
+ https://bugs.webkit.org/show_bug.cgi?id=96541
+
+ Reviewed by Antonio Gomes.
+
+ Convert the coordinate correctly by taking scroll position plus frame
+ borders and padding into account.
+
+ Test: fast/events/touch/touch-inside-iframe-scrolled.html
+
+ * rendering/RenderFrameBase.cpp:
+ (WebCore::RenderFrameBase::nodeAtPoint):
+
2012-09-13 Ilya Tikhonovsky <[email protected]>
Web Inspector: NMI: remove the dependency of platform sources from WebCore header introduced by NMI instrumentation.
Modified: trunk/Source/WebCore/rendering/RenderFrameBase.cpp (128461 => 128462)
--- trunk/Source/WebCore/rendering/RenderFrameBase.cpp 2012-09-13 15:03:24 UTC (rev 128461)
+++ trunk/Source/WebCore/rendering/RenderFrameBase.cpp 2012-09-13 15:03:48 UTC (rev 128462)
@@ -114,7 +114,8 @@
if (childRoot) {
LayoutPoint adjustedLocation = accumulatedOffset + location();
- HitTestLocation newHitTestLocation(locationInContainer, -toLayoutSize(adjustedLocation));
+ LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset();
+ HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset);
HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest);
bool isInsideChildFrame = childRoot->layer()->hitTest(newHitTestRequest, newHitTestLocation, result);