Diff
Modified: trunk/LayoutTests/ChangeLog (210146 => 210147)
--- trunk/LayoutTests/ChangeLog 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/LayoutTests/ChangeLog 2016-12-25 23:57:40 UTC (rev 210147)
@@ -1,3 +1,30 @@
+2016-12-23 Simon Fraser <[email protected]>
+
+ REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
+ https://bugs.webkit.org/show_bug.cgi?id=166472
+ rdar://problem/29675551
+
+ Reviewed by Tim Horton.
+
+ Add some test coverage for autoscroll of the main document. I could only get this
+ working in WebKitTestRunner, not DumpRenderTree.
+
+ * TestExpectations:
+ * fast/events/autoscroll-main-document-expected.txt: Added.
+ * fast/events/autoscroll-main-document.html: Added.
+ * fast/events/autoscroll-when-zoomed-expected.txt: Added.
+ * fast/events/autoscroll-when-zoomed.html: Added.
+ * fast/events/drag-select-when-zoomed-expected.txt: Added.
+ * fast/events/drag-select-when-zoomed-with-header-expected.txt: Added.
+ * fast/events/drag-select-when-zoomed-with-header.html: Added.
+ * fast/events/drag-select-when-zoomed.html: Added.
+ * fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt: Added.
+ * fast/scrolling/scroll-to-anchor-zoomed-header.html: Added.
+ * fast/transforms/selection-bounds-in-transformed-view.html: Revert the target scroll position to what it was
+ before r209299, and improve the failure output.
+ * platform/ios-simulator/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+
2016-12-23 Andy Estes <[email protected]>
[iOS] Fix some crashing webarchive tests
Modified: trunk/LayoutTests/TestExpectations (210146 => 210147)
--- trunk/LayoutTests/TestExpectations 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/LayoutTests/TestExpectations 2016-12-25 23:57:40 UTC (rev 210147)
@@ -51,6 +51,10 @@
fast/events/mouse-force-down.html [ Skip ]
fast/events/mouse-force-up.html [ Skip ]
+# Document autoscroll tests only work on Mac WK2
+fast/events/autoscroll-when-zoomed.html [ Skip ]
+fast/events/autoscroll-main-document.html [ Skip ]
+
# Only iOS supports QuickLook
quicklook [ Skip ]
http/tests/quicklook [ Skip ]
Added: trunk/LayoutTests/fast/events/autoscroll-main-document-expected.txt (0 => 210147)
--- trunk/LayoutTests/fast/events/autoscroll-main-document-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-main-document-expected.txt 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,9 @@
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+This test ensures that drag-selecting works correctly in the main frame.
+
+PASS firstRange.startOffset is 18
+PASS firstRange.endOffset is 425
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/autoscroll-main-document.html (0 => 210147)
--- trunk/LayoutTests/fast/events/autoscroll-main-document.html (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-main-document.html 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ height: 1000px;
+ }
+ #container {
+ position: relative;
+ top: -10px;
+ left: 50px;
+ width: 400px;
+ outline: 1px solid black;
+ font-family: monospace;
+ }
+ </style>
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ const eventCount = 50;
+ var scrollCount = 0;
+
+ var start;
+ var end;
+ var firstRange;
+
+ function testComplete()
+ {
+ eventSender.mouseMoveTo(end.x, 0);
+ eventSender.mouseUp();
+
+ firstRange = window.getSelection().getRangeAt(0);
+ shouldBe('firstRange.startOffset', '18');
+ shouldBe('firstRange.endOffset', '425');
+
+ finishJSTest();
+ }
+
+ function waitForScrolledToTop()
+ {
+ if (window.scrollY == 0) {
+ testComplete();
+ return;
+ }
+
+ window.setTimeout(waitForScrolledToTop, 2);
+ }
+
+ function doOneScroll()
+ {
+ if (++scrollCount == eventCount) {
+ waitForScrolledToTop();
+ return;
+ }
+
+ eventSender.mouseMoveTo(end.x, end.y - scrollCount);
+ window.setTimeout(doOneScroll, 2);
+ }
+
+ function doTest()
+ {
+ if (!window.testRunner || !window.eventSender) {
+ debug('This test requires testRunner and eventSender');
+ return;
+ }
+
+ var containerRect = document.getElementById('container').getBoundingClientRect();
+ var lineHeight = containerRect.height / 3;
+
+ window.scrollTo(0, containerRect.bottom - lineHeight);
+
+ containerRect = document.getElementById('container').getBoundingClientRect(); // Scrolling changed it.
+
+ start = { x: containerRect.left + containerRect.width / 2, y: containerRect.bottom - lineHeight / 3 };
+ end = { x: containerRect.left + containerRect.width / 3, y: 16 };
+
+ eventSender.mouseMoveTo(start.x, start.y);
+ eventSender.mouseDown();
+
+ doOneScroll();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+<div id="container">
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+</div>
+
+<p>This test ensures that drag-selecting works correctly in the main frame.</p>
+
+<div id="console"></div>
+
+<script src=""
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/autoscroll-when-zoomed-expected.txt (0 => 210147)
--- trunk/LayoutTests/fast/events/autoscroll-when-zoomed-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-when-zoomed-expected.txt 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,9 @@
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+This test ensures that drag-selecting works correctly in the main frame.
+
+PASS firstRange.startOffset is 51
+PASS firstRange.endOffset is 400
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/autoscroll-when-zoomed.html (0 => 210147)
--- trunk/LayoutTests/fast/events/autoscroll-when-zoomed.html (rev 0)
+++ trunk/LayoutTests/fast/events/autoscroll-when-zoomed.html 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ height: 1000px;
+ }
+ #container {
+ position: relative;
+ top: -10px;
+ left: 50px;
+ width: 400px;
+ outline: 1px solid black;
+ font-family: monospace;
+ }
+ </style>
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ const pageScale = 1.5;
+ const eventCount = 50;
+ var scrollCount = 0;
+
+ var start;
+ var end;
+ var firstRange;
+
+ function testComplete()
+ {
+ eventSender.mouseMoveTo(pageScale * end.x, 0);
+ eventSender.mouseUp();
+
+ firstRange = window.getSelection().getRangeAt(0);
+ shouldBe('firstRange.startOffset', '51');
+ shouldBe('firstRange.endOffset', '400');
+
+ finishJSTest();
+ }
+
+ function waitForScrolledToTop()
+ {
+ if (window.scrollY == 0) {
+ testComplete();
+ return;
+ }
+
+ window.setTimeout(waitForScrolledToTop, 2);
+ }
+
+ function doOneScroll()
+ {
+ if (++scrollCount == eventCount) {
+ waitForScrolledToTop();
+ return;
+ }
+
+ eventSender.mouseMoveTo(pageScale * end.x, pageScale * (end.y - scrollCount));
+ window.setTimeout(doOneScroll, 2);
+ }
+
+ function doTest()
+ {
+ if (!window.testRunner || !window.eventSender) {
+ debug('This test requires testRunner and eventSender');
+ return;
+ }
+
+ window.internals.setPageScaleFactor(pageScale, 0, 0);
+
+ var containerRect = document.getElementById('container').getBoundingClientRect();
+ var lineHeight = containerRect.height / 3;
+
+ window.scrollTo(0, containerRect.bottom - lineHeight);
+
+ containerRect = document.getElementById('container').getBoundingClientRect(); // Scrolling changed it.
+
+ start = { x: containerRect.left + 10, y: containerRect.bottom - lineHeight / 3 };
+ end = { x: containerRect.right - 10, y: 16 };
+
+ eventSender.mouseMoveTo(pageScale * start.x, pageScale * start.y);
+ eventSender.mouseDown();
+
+ doOneScroll();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+<div id="container">
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+</div>
+
+<p>This test ensures that drag-selecting works correctly in the main frame.</p>
+
+<div id="console"></div>
+
+<script src=""
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/drag-select-when-zoomed-expected.txt (0 => 210147)
--- trunk/LayoutTests/fast/events/drag-select-when-zoomed-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/drag-select-when-zoomed-expected.txt 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,9 @@
+This test ensures that drag-selecting works correctly in scaled pages.
+
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+PASS firstRange.startOffset is 79
+PASS firstRange.endOffset is 103
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/drag-select-when-zoomed-with-header-expected.txt (0 => 210147)
--- trunk/LayoutTests/fast/events/drag-select-when-zoomed-with-header-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/drag-select-when-zoomed-with-header-expected.txt 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,9 @@
+This test ensures that drag-selecting works correctly in scaled pages.
+
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+PASS firstRange.startOffset is 79
+PASS firstRange.endOffset is 103
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/drag-select-when-zoomed-with-header.html (0 => 210147)
--- trunk/LayoutTests/fast/events/drag-select-when-zoomed-with-header.html (rev 0)
+++ trunk/LayoutTests/fast/events/drag-select-when-zoomed-with-header.html 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ #container {
+ position: absolute;
+ top: 100px;
+ left: 10px;
+ width: 400px;
+ outline: 1px solid black;
+ font-family: monospace;
+ }
+ </style>
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ const headerHeight = 32;
+ const pageScale = 1.8;
+ var mouseXStart;
+ var mouseXEnd;
+ var mouseY;
+ var currMouseX;
+ var firstRange;
+
+ if (window.internals)
+ internals.setHeaderHeight(headerHeight);
+
+ function testComplete()
+ {
+ eventSender.mouseMoveTo(mouseXEnd, mouseY);
+ eventSender.mouseUp();
+
+ firstRange = window.getSelection().getRangeAt(0);
+ shouldBe('firstRange.startOffset', '79');
+ shouldBe('firstRange.endOffset', '103');
+
+ finishJSTest();
+ }
+
+ function doOneMouseMove()
+ {
+ if (currMouseX >= mouseXEnd) {
+ testComplete();
+ return;
+ }
+
+ eventSender.mouseMoveTo(currMouseX, mouseY);
+ currMouseX += 2;
+ window.setTimeout(doOneMouseMove, 2);
+ }
+
+ function doTest()
+ {
+ if (!window.testRunner || !window.eventSender) {
+ debug('This test requires testRunner and eventSender');
+ return;
+ }
+
+ window.internals.setPageScaleFactor(pageScale, 0, 0);
+
+ var containerRect = document.getElementById('container').getBoundingClientRect();
+ var lineHeight = containerRect.height / 3;
+
+ mouseXStart = pageScale * (containerRect.left + containerRect.width / 2);
+ mouseY = headerHeight + pageScale * (containerRect.top + lineHeight / 2);
+ mouseXEnd = pageScale * (containerRect.right - 10);
+
+ currMouseX = mouseXStart;
+ eventSender.mouseMoveTo(currMouseX, mouseY);
+ eventSender.mouseDown();
+
+ doOneMouseMove();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+<p>This test ensures that drag-selecting works correctly in scaled pages.</p>
+
+<div id="container">
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+</div>
+
+<div id="console"></div>
+
+<script src=""
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/drag-select-when-zoomed.html (0 => 210147)
--- trunk/LayoutTests/fast/events/drag-select-when-zoomed.html (rev 0)
+++ trunk/LayoutTests/fast/events/drag-select-when-zoomed.html 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ #container {
+ position: absolute;
+ top: 100px;
+ left: 10px;
+ width: 400px;
+ outline: 1px solid black;
+ font-family: monospace;
+ }
+ </style>
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ const pageScale = 1.8;
+ var mouseXStart;
+ var mouseXEnd;
+ var mouseY;
+ var currMouseX;
+ var firstRange;
+
+ function testComplete()
+ {
+ eventSender.mouseMoveTo(mouseXEnd, mouseY);
+ eventSender.mouseUp();
+
+ firstRange = window.getSelection().getRangeAt(0);
+ shouldBe('firstRange.startOffset', '79');
+ shouldBe('firstRange.endOffset', '103');
+
+ finishJSTest();
+ }
+
+ function doOneMouseMove()
+ {
+ if (currMouseX >= mouseXEnd) {
+ testComplete();
+ return;
+ }
+
+ eventSender.mouseMoveTo(currMouseX, mouseY);
+ currMouseX += 2;
+ window.setTimeout(doOneMouseMove, 2);
+ }
+
+ function doTest()
+ {
+ if (!window.testRunner || !window.eventSender) {
+ debug('This test requires testRunner and eventSender');
+ return;
+ }
+
+ window.internals.setPageScaleFactor(pageScale, 0, 0);
+
+ var containerRect = document.getElementById('container').getBoundingClientRect();
+ var lineHeight = containerRect.height / 3;
+
+ mouseXStart = pageScale * (containerRect.left + containerRect.width / 2);
+ mouseY = pageScale * (containerRect.top + lineHeight / 2);
+ mouseXEnd = pageScale * (containerRect.right - 10);
+
+ currMouseX = mouseXStart;
+ eventSender.mouseMoveTo(currMouseX, mouseY);
+ eventSender.mouseDown();
+
+ doOneMouseMove();
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+<p>This test ensures that drag-selecting works correctly in scaled pages.</p>
+
+<div id="container">
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+</div>
+
+<div id="console"></div>
+
+<script src=""
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt (0 => 210147)
--- trunk/LayoutTests/fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,11 @@
+Tests scrolling to an anchor in a zoomed page with a header scrolls to the correct location.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.scrollingElement.scrollTop is 1019
+PASS document.scrollingElement.scrollLeft is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Anchor is here
Added: trunk/LayoutTests/fast/scrolling/scroll-to-anchor-zoomed-header.html (0 => 210147)
--- trunk/LayoutTests/fast/scrolling/scroll-to-anchor-zoomed-header.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/scroll-to-anchor-zoomed-header.html 2016-12-25 23:57:40 UTC (rev 210147)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ width: 2000px;
+ }
+
+ .anchor {
+ position: absolute;
+ top: 1000px;
+ left: 40px;
+ border: 1px solid black;
+ }
+ </style>
+ <script src=""
+ <script>
+ description("Tests scrolling to an anchor in a zoomed page with a header scrolls to the correct location.");
+ window.jsTestIsAsync = true;
+
+ const headerHeight = 32;
+ const pageScale = 1.8;
+
+ if (window.internals) {
+ internals.setHeaderHeight(headerHeight);
+ internals.setPageScaleFactor(pageScale, 0, 0);
+ }
+
+ function runTest()
+ {
+ setTimeout(function() {
+ window.location='#anchor';
+ setTimeout(finishTest, 0);
+ }, 0);
+ }
+
+ function finishTest()
+ {
+ if (window.location.toString().indexOf("#") == -1) {
+ setTimeout(finishTest, 0);
+ return;
+ }
+
+ shouldBe('document.scrollingElement.scrollTop', '1019');
+ shouldBe('document.scrollingElement.scrollLeft', '0');
+
+ finishJSTest();
+ }
+ </script>
+</head>
+<body _onload_="runTest()">
+
+<div class="anchor">
+ <a name="anchor">Anchor is here</a>
+</div>
+
+<script src=""
+
+</body></html>
Modified: trunk/LayoutTests/fast/transforms/selection-bounds-in-transformed-view.html (210146 => 210147)
--- trunk/LayoutTests/fast/transforms/selection-bounds-in-transformed-view.html 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/LayoutTests/fast/transforms/selection-bounds-in-transformed-view.html 2016-12-25 23:57:40 UTC (rev 210147)
@@ -10,6 +10,8 @@
}
document.execCommand("FindString", false, "target");
- document.getElementById("result").innerText = document.body.scrollTop === 937 ? "PASS" : "FAIL";
+ var scrollTop = document.body.scrollTop;
+ var expectedScrollTop = 864;
+ document.getElementById("result").innerText = scrollTop === expectedScrollTop ? "PASS" : "FAIL: document.body.scrollTop was " + scrollTop + ", should be " + expectedScrollTop;
</script>
</body>
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (210146 => 210147)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-25 23:57:40 UTC (rev 210147)
@@ -1292,6 +1292,12 @@
fast/events/tab-focus-link-in-canvas.html [ Failure ]
fast/events/tabindex-focus-blur-all.html [ Failure ]
+# Tests that depend on mouse input
+fast/events/autoscroll-main-document.html [ Skip ]
+fast/events/autoscroll-when-zoomed.html [ Skip ]
+fast/events/drag-select-when-zoomed-with-header.html [ Skip ]
+fast/events/drag-select-when-zoomed.html [ Skip ]
+
# Ref-test imported from W3C that is failing because type=image input elements have rounded corners on iOS.
imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/image01.html [ ImageOnlyFailure ]
# Ref-test imported form W3C that is failing because the test is off by a couple of pixels on iOS.
@@ -2747,6 +2753,7 @@
fast/zooming/client-rect-in-fixed-zoomed.html [ Skip ]
fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html [ Skip ]
fast/visual-viewport/zoomed-scroll-into-view-fixed.html [ Skip ]
+fast/scrolling/scroll-to-anchor-zoomed-header.html [ Skip ]
# This test relies on Arial being used to draw Arabic. However, on iOS,
# we explicitly disallow this because this font is too slow.
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (210146 => 210147)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2016-12-25 23:57:40 UTC (rev 210147)
@@ -13,6 +13,8 @@
fast/events/force-click-link-selection-behavior.html [ Pass ]
fast/events/force-click-on-link-navigation.html [ Pass ]
fast/events/force-click-text-selection-behavior.html [ Failure ]
+fast/events/autoscroll-when-zoomed.html [ Pass ]
+fast/events/autoscroll-main-document.html [ Pass ]
fast/media/mq-inverted-colors-live-update.html [ Pass ]
fast/media/mq-inverted-colors-live-update-in-subframes.html [ Pass ]
@@ -40,7 +42,7 @@
########################################
### START OF (1) Classified failures with bug reports
-# WebKitTestRunner needs an implementation of eventSender
+# WebKitTestRunner needs a more complete implementation of eventSender
# <https://bugs.webkit.org/show_bug.cgi?id=42194>
editing/pasteboard/4947130.html
editing/pasteboard/cleanup-on-move.html
Modified: trunk/Source/WebCore/ChangeLog (210146 => 210147)
--- trunk/Source/WebCore/ChangeLog 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/Source/WebCore/ChangeLog 2016-12-25 23:57:40 UTC (rev 210147)
@@ -1,3 +1,30 @@
+2016-12-23 Simon Fraser <[email protected]>
+
+ REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
+ https://bugs.webkit.org/show_bug.cgi?id=166472
+ rdar://problem/29675551
+
+ Reviewed by Tim Horton.
+
+ r209299 broke autoscroll in zoomed pages because it changed RenderLayer::scrollRectToVisible()
+ to shrink viewRect by page scale. This is incorrect for all callers of scrollRectToVisible, since
+ the "absoluteRect" passed in is actually in zoomed document coordinates for all the callers I tested.
+
+ This code is also fixed to account for headers and footers. getRectToExpose() takes rectangles
+ in "scroll view contents" coordinates (i.e. including header, and zoomed document), so doesn't need
+ the separate visibleRectRelativeToDocument parameter.
+
+ Tests: fast/events/autoscroll-main-document.html
+ fast/events/autoscroll-when-zoomed.html
+ fast/events/drag-select-when-zoomed-with-header.html
+ fast/events/drag-select-when-zoomed.html
+ fast/scrolling/scroll-to-anchor-zoomed-header.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::scrollRectToVisible):
+ (WebCore::RenderLayer::getRectToExpose):
+ * rendering/RenderLayer.h:
+
2016-12-24 Zalan Bujtas <[email protected]>
RenderBlockFlow::moveFloatsTo does not move floats.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (210146 => 210147)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2016-12-25 23:57:40 UTC (rev 210147)
@@ -2527,7 +2527,7 @@
ASSERT(box);
LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(absoluteRect))).boundingBox());
LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight());
- LayoutRect revealRect = getRectToExpose(layerBounds, layerBounds, localExposeRect, insideFixed, alignX, alignY);
+ LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, alignX, alignY);
ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(revealRect).location()));
if (clampedScrollOffset != scrollOffset()) {
@@ -2551,7 +2551,7 @@
NoEventDispatchAssertion assertNoEventDispatch;
LayoutRect viewRect = frameView.visibleContentRect(LegacyIOSDocumentVisibleRect);
- LayoutRect exposeRect = getRectToExpose(viewRect, viewRect, absoluteRect, insideFixed, alignX, alignY);
+ LayoutRect exposeRect = getRectToExpose(viewRect, absoluteRect, insideFixed, alignX, alignY);
IntPoint scrollOffset(roundedIntPoint(exposeRect.location()));
// Adjust offsets if they're outside of the allowable range.
@@ -2572,16 +2572,15 @@
#if !PLATFORM(IOS)
LayoutRect viewRect = frameView.visibleContentRect();
- viewRect.scale(1 / frameView.frameScaleFactor());
-
- LayoutRect visibleRectRelativeToDocument = viewRect;
- visibleRectRelativeToDocument.setLocation(frameView.documentScrollPositionRelativeToScrollableAreaOrigin());
#else
LayoutRect viewRect = frameView.unobscuredContentRect();
- LayoutRect visibleRectRelativeToDocument = viewRect;
#endif
- LayoutRect revealRect = getRectToExpose(viewRect, visibleRectRelativeToDocument, absoluteRect, insideFixed, alignX, alignY);
-
+ // Move the target rect into "scrollView contents" coordinates.
+ LayoutRect targetRect = absoluteRect;
+ targetRect.move(0, frameView.headerHeight());
+
+ LayoutRect revealRect = getRectToExpose(viewRect, targetRect, insideFixed, alignX, alignY);
+
frameView.setScrollPosition(roundedIntPoint(revealRect.location()));
// This is the outermost view of a web page, so after scrolling this view we
@@ -2612,7 +2611,7 @@
}
}
-LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const LayoutRect &visibleRectRelativeToDocument, const LayoutRect &exposeRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
+LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const LayoutRect &exposeRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY) const
{
FrameView& frameView = renderer().view().frameView();
if (insideFixed) {
@@ -2624,6 +2623,8 @@
// exposeRect is in absolute coords, affected by page scale. Unscale it.
LayoutRect unscaledExposeRect = exposeRect;
unscaledExposeRect.scale(1 / frameView.frameScaleFactor());
+ unscaledExposeRect.move(0, -frameView.headerHeight());
+
// These are both in unscaled coordinates.
LayoutRect layoutViewport = frameView.layoutViewportRect();
LayoutRect visualViewport = frameView.visualViewportRect();
@@ -2634,9 +2635,10 @@
unscaledExposeRect.setSize(unscaledExposeRect.size().shrunkTo(visualViewport.size()));
// Compute how much we have to move the visualViewport to reveal the part of the layoutViewport that contains exposeRect.
- LayoutRect requiredVisualViewport = getRectToExpose(visualViewport, visualViewport, unscaledExposeRect, false, alignX, alignY);
+ LayoutRect requiredVisualViewport = getRectToExpose(visualViewport, unscaledExposeRect, false, alignX, alignY);
// Scale it back up.
requiredVisualViewport.scale(frameView.frameScaleFactor());
+ requiredVisualViewport.move(0, frameView.headerHeight());
return requiredVisualViewport;
}
}
@@ -2679,7 +2681,7 @@
// Determine the appropriate Y behavior.
ScrollAlignment::Behavior scrollY;
LayoutRect exposeRectY(visibleRect.x(), exposeRect.y(), visibleRect.width(), exposeRect.height());
- LayoutUnit intersectHeight = intersection(visibleRectRelativeToDocument, exposeRectY).height();
+ LayoutUnit intersectHeight = intersection(visibleRect, exposeRectY).height();
if (intersectHeight == exposeRect.height())
// If the rectangle is fully visible, use the specified visible behavior.
scrollY = ScrollAlignment::getVisibleBehavior(alignY);
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (210146 => 210147)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2016-12-25 23:57:40 UTC (rev 210147)
@@ -204,10 +204,9 @@
void availableContentSizeChanged(AvailableSizeChangeReason) override;
+ // "absoluteRect" is in scaled document coordinates.
void scrollRectToVisible(SelectionRevealMode, const LayoutRect& absoluteRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
- LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect& visibleRectRelativeToDocument, const LayoutRect& exposeRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
-
bool scrollsOverflow() const;
bool hasScrollbars() const { return m_hBar || m_vBar; }
void setHasHorizontalScrollbar(bool);
@@ -940,6 +939,8 @@
RenderLayer* enclosingTransformedAncestor() const;
+ LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect& exposeRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY) const;
+
// Convert a point in absolute coords into layer coords, taking transforms into account
LayoutPoint absoluteToContents(const LayoutPoint&) const;
Modified: trunk/Tools/ChangeLog (210146 => 210147)
--- trunk/Tools/ChangeLog 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/Tools/ChangeLog 2016-12-25 23:57:40 UTC (rev 210147)
@@ -1,3 +1,19 @@
+2016-12-23 Simon Fraser <[email protected]>
+
+ REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
+ https://bugs.webkit.org/show_bug.cgi?id=166472
+ rdar://problem/29675551
+
+ Reviewed by Tim Horton.
+
+ These changes are necessary to allow the mouse to leave the WTR window while
+ drag-scrolling, to test autoscroll. Previously, we were never calling -mouseDragged
+ (which DRT does); we'd always go through mouseMoved, which hits an early return
+ in WebViewImpl::mouseMoved() when the point is outside the view.
+
+ * WebKitTestRunner/mac/EventSenderProxy.mm:
+ (WTR::EventSenderProxy::mouseMoveTo):
+
2016-12-23 Andy Estes <[email protected]>
[iOS] Fix some crashing webarchive tests
Modified: trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (210146 => 210147)
--- trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm 2016-12-24 21:26:22 UTC (rev 210146)
+++ trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm 2016-12-25 23:57:40 UTC (rev 210147)
@@ -603,7 +603,8 @@
NSPoint position = [view convertPoint:NSMakePoint(x, y) toView:nil];
m_position.x = position.x;
m_position.y = position.y;
- NSEvent *event = [NSEvent mouseEventWithType:(m_leftMouseButtonDown ? NSEventTypeLeftMouseDragged : NSEventTypeMouseMoved)
+ bool isDrag = m_leftMouseButtonDown;
+ NSEvent *event = [NSEvent mouseEventWithType:(isDrag ? NSEventTypeLeftMouseDragged : NSEventTypeMouseMoved)
location:position
modifierFlags:0
timestamp:absoluteTimeForEventTime(currentEventTime())
@@ -614,10 +615,14 @@
pressure:0];
NSPoint windowLocation = event.locationInWindow;
- NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:windowLocation];
+ // Always target drags at the WKWebView to allow for drag-scrolling outside the view.
+ NSView *targetView = isDrag ? m_testController->mainWebView()->platformView() : [m_testController->mainWebView()->platformView() hitTest:windowLocation];
if (targetView) {
[NSApp _setCurrentEvent:event];
- [targetView mouseMoved:event];
+ if (isDrag)
+ [targetView mouseDragged:event];
+ else
+ [targetView mouseMoved:event];
[NSApp _setCurrentEvent:nil];
} else
WTFLogAlways("mouseMoveTo failed to find a target view at %f,%f\n", windowLocation.x, windowLocation.y);