Title: [140370] trunk
Revision
140370
Author
[email protected]
Date
2013-01-21 16:31:57 -0800 (Mon, 21 Jan 2013)

Log Message

Event target rects on the top level document shouldn't be clipped.
https://bugs.webkit.org/show_bug.cgi?id=107339

Reviewed by James Robinson.

Source/WebCore:

clippedOverflowRectForRepaint clips the top-level RenderView to the viewport, which
is wrong for generating event target rects, as the result will not extend to the bounds
of the document on pages that scroll. Changing the top-level view to use documentRect
instead.

Tests updated to cover bug: platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html
                            platform/chromium/fast/events/touch/compositor-touch-hit-rects.html

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::accumulateRendererTouchEventTargetRects): Use converToRootView instead of
a loop around convertToContaining view. This is not a change in behavior.
(WebCore::accumulateDocumentEventTargetRects): Switch to use documentRect instead of
clippedOverflowRectForRepaint for the top-level Document, and use converToRootView
to put rects in the coordinates of the top-level document.

LayoutTests:

Updating existing tests to cover this issue.

* platform/chromium-linux/platform/chromium/fast/events/touch/compositor-touch-hit-rects-expected.txt:
* platform/chromium/fast/events/touch/compositor-touch-hit-rects.html:
* platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt:
* platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html:
* platform/chromium/fast/events/touch/resources/frame-with-document-touch-handler.html: Added.
* platform/chromium/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140369 => 140370)


--- trunk/LayoutTests/ChangeLog	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/LayoutTests/ChangeLog	2013-01-22 00:31:57 UTC (rev 140370)
@@ -1,3 +1,19 @@
+2013-01-21  Levi Weintraub  <[email protected]>
+
+        Event target rects on the top level document shouldn't be clipped.
+        https://bugs.webkit.org/show_bug.cgi?id=107339
+
+        Reviewed by James Robinson.
+
+        Updating existing tests to cover this issue.
+
+        * platform/chromium-linux/platform/chromium/fast/events/touch/compositor-touch-hit-rects-expected.txt:
+        * platform/chromium/fast/events/touch/compositor-touch-hit-rects.html:
+        * platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt:
+        * platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html:
+        * platform/chromium/fast/events/touch/resources/frame-with-document-touch-handler.html: Added.
+        * platform/chromium/TestExpectations:
+
 2013-01-21  Nico Weber  <[email protected]>
 
         [chromium] Update expectations.

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (140369 => 140370)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-22 00:31:57 UTC (rev 140370)
@@ -3907,6 +3907,9 @@
 
 webkit.org/b/98275 media/event-queue-crash.html [ Skip ]
 
+# Needs rebaselining on after webkit.org/b/107339
+webkit.org/b/107339 [ Mac Android Win ] platform/chromium/fast/events/touch/compositor-touch-hit-rects.html [ Pass Failure ]
+
 # Requires rebaselining after https://bugs.webkit.org/show_bug.cgi?id=11645
 webkit.org/b/11645 [ Mac Android ] fast/table/025.html [ Failure ]
 

Modified: trunk/LayoutTests/platform/chromium/fast/events/touch/compositor-touch-hit-rects.html (140369 => 140370)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/compositor-touch-hit-rects.html	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/compositor-touch-hit-rects.html	2013-01-22 00:31:57 UTC (rev 140370)
@@ -23,6 +23,9 @@
 #tests {
 	font: 10px Ahem;
 }
+body {
+	height: 1000px;
+}
 </style>
 </head>
 <body>
@@ -76,17 +79,23 @@
 	return a.top - b.top;
 }
 
-function logRects(id) {
+function testElementWithId(id)
+{
 	element = document.getElementById(id);
 	element.addEventListener('touchstart', listener, false);
+	logRects(id);
+	element.removeEventListener('touchstart', listener, false);
+}
+
+function logRects(testName) {
+
 	rects = window.internals.touchEventTargetClientRects(document);
 	var sortedRects = new Array();
 	for (var i = 0; i < rects.length; ++i)
 		sortedRects[i] = rects[i];
 	sortedRects.sort(sortRects);
 	for (var i = 0; i < rects.length; ++i)
-		log(id + "[" + i + "]: (" + sortedRects[i].left + ", " + sortedRects[i].top + ", " + sortedRects[i].width + ", " + sortedRects[i].height + ")");
-	element.removeEventListener('touchstart', listener, false);
+		log(testName + "[" + i + "]: (" + sortedRects[i].left + ", " + sortedRects[i].top + ", " + sortedRects[i].width + ", " + sortedRects[i].height + ")");
 }
 
 function runTest() {
@@ -94,14 +103,17 @@
 		return;
 
 	window.testRunner.dumpAsText();
-	logRects("normalFlow");
-	logRects("absoluteChildContainer");
-	logRects("relativeChildContainer");
-	logRects("overhangingContainer");
-	logRects("transformedChildContainer");
-	logRects("continuation");
-	logRects("inlineAbsoluteChildContainer");
+	testElementWithId("normalFlow");
+	testElementWithId("absoluteChildContainer");
+	testElementWithId("relativeChildContainer");
+	testElementWithId("overhangingContainer");
+	testElementWithId("transformedChildContainer");
+	testElementWithId("continuation");
+	testElementWithId("inlineAbsoluteChildContainer");
 
+	document.addEventListener('touchstart', listener, false);
+	logRects("document");
+
 	var testContainer = document.getElementById("tests");
 	testContainer.parentNode.removeChild(testContainer);
 }

Added: trunk/LayoutTests/platform/chromium/fast/events/touch/resources/frame-with-document-touch-handler.html (0 => 140370)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/resources/frame-with-document-touch-handler.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/resources/frame-with-document-touch-handler.html	2013-01-22 00:31:57 UTC (rev 140370)
@@ -0,0 +1,7 @@
+<!doctype html>
+<html>
+<body style="height:1000px; width: 1000px;">
+<script>
+document.addEventListener("touchstart", function() { }, false);
+</script>
+</body>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt (140369 => 140370)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt	2013-01-22 00:31:57 UTC (rev 140370)
@@ -1,4 +1,5 @@
 This test validates that touch hit tests rects are created in the coordinates of the outermost view, not their containing view. This test only works in DumpRenderTree.
-[0]: (60, 110, 50, 50)
-[1]: (420, 170, 50, 50)
+[0]: (10, 50, 285, 135)
+[1]: (60, 110, 50, 50)
+[2]: (420, 170, 50, 50)
 

Modified: trunk/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html (140369 => 140370)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html	2013-01-22 00:31:57 UTC (rev 140370)
@@ -23,6 +23,7 @@
 <div id="console"></div>
 <iframe id="iframe1" src=""
 <iframe id="iframe2"></iframe>
+<iframe id="iframe3" src=""
 <script>
 
 var iframeDocument = document.getElementById("iframe2").contentWindow.document;

Modified: trunk/LayoutTests/platform/chromium-linux/platform/chromium/fast/events/touch/compositor-touch-hit-rects-expected.txt (140369 => 140370)


--- trunk/LayoutTests/platform/chromium-linux/platform/chromium/fast/events/touch/compositor-touch-hit-rects-expected.txt	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/LayoutTests/platform/chromium-linux/platform/chromium/fast/events/touch/compositor-touch-hit-rects-expected.txt	2013-01-22 00:31:57 UTC (rev 140370)
@@ -1,15 +1,16 @@
 This tests verifies the hit test regions given to the compositor. It can only be run in DumpRenderTree. The outputted rects should cover the hit test regions of all the listed elements.
 
-normalFlow[0]: (8, 72, 784, 10)
-absoluteChildContainer[0]: (8, 102, 784, 10)
+normalFlow[0]: (8, 72, 769, 10)
+absoluteChildContainer[0]: (8, 102, 769, 10)
 absoluteChildContainer[1]: (118, 300, 140, 10)
-relativeChildContainer[0]: (8, 152, 784, 10)
+relativeChildContainer[0]: (8, 152, 769, 10)
 relativeChildContainer[1]: (128, 352, 140, 10)
-overhangingContainer[0]: (8, 202, 784, 10)
+overhangingContainer[0]: (8, 202, 769, 10)
 overhangingContainer[1]: (8, 202, 110, 80)
-transformedChildContainer[0]: (63, 240, 674, 34)
-transformedChildContainer[1]: (8, 252, 784, 10)
+transformedChildContainer[0]: (62, 241, 661, 32)
+transformedChildContainer[1]: (8, 252, 769, 10)
 continuation[0]: (108, 302, 100, 10)
 inlineAbsoluteChildContainer[0]: (378, 300, 250, 10)
 inlineAbsoluteChildContainer[1]: (108, 352, 270, 10)
+document[0]: (0, 0, 785, 1024)
 

Modified: trunk/Source/WebCore/ChangeLog (140369 => 140370)


--- trunk/Source/WebCore/ChangeLog	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/Source/WebCore/ChangeLog	2013-01-22 00:31:57 UTC (rev 140370)
@@ -1,3 +1,25 @@
+2013-01-21  Levi Weintraub  <[email protected]>
+
+        Event target rects on the top level document shouldn't be clipped.
+        https://bugs.webkit.org/show_bug.cgi?id=107339
+
+        Reviewed by James Robinson.
+
+        clippedOverflowRectForRepaint clips the top-level RenderView to the viewport, which
+        is wrong for generating event target rects, as the result will not extend to the bounds
+        of the document on pages that scroll. Changing the top-level view to use documentRect
+        instead.
+
+        Tests updated to cover bug: platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html
+                                    platform/chromium/fast/events/touch/compositor-touch-hit-rects.html
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::accumulateRendererTouchEventTargetRects): Use converToRootView instead of
+        a loop around convertToContaining view. This is not a change in behavior.
+        (WebCore::accumulateDocumentEventTargetRects): Switch to use documentRect instead of
+        clippedOverflowRectForRepaint for the top-level Document, and use converToRootView
+        to put rects in the coordinates of the top-level document.
+
 2013-01-17  Andy Estes  <[email protected]>
 
         Add a USE() macro for content filtering code

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (140369 => 140370)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2013-01-22 00:27:39 UTC (rev 140369)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2013-01-22 00:31:57 UTC (rev 140370)
@@ -188,8 +188,7 @@
         if (!r.isEmpty()) {
             // Convert to the top-level view's coordinates.
             ASSERT(renderer->document()->view());
-            for (ScrollView* view = renderer->document()->view(); view && view->parent(); view = view->parent())
-                r = view->convertToContainingView(r);
+            r = renderer->document()->view()->convertToRootView(r);
 
             if (!parentRect.contains(r)) {
                 rects.append(r);
@@ -216,9 +215,17 @@
 
         if (touchTarget == document) {
             if (RenderView* view = document->renderView()) {
-                IntRect r = enclosingIntRect(view->clippedOverflowRectForRepaint(0));
-                if (!r.isEmpty())
+                IntRect r;
+                if (touchTarget == document->topDocument())
+                    r = view->documentRect();
+                else
+                    r = enclosingIntRect(view->clippedOverflowRectForRepaint(0));
+
+                if (!r.isEmpty()) {
+                    ASSERT(view->document()->view());
+                    r = view->document()->view()->convertToRootView(r);
                     rects.append(r);
+                }
             }
             return;
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to