Diff
Modified: trunk/LayoutTests/ChangeLog (258054 => 258055)
--- trunk/LayoutTests/ChangeLog 2020-03-07 04:48:50 UTC (rev 258054)
+++ trunk/LayoutTests/ChangeLog 2020-03-07 05:02:51 UTC (rev 258055)
@@ -1,3 +1,23 @@
+2020-03-06 Simon Fraser <[email protected]>
+
+ Fix scrolling tree hit-testing on scrolled and zoomed pages
+ https://bugs.webkit.org/show_bug.cgi?id=208755
+
+ Reviewed by Zalan Bujtas.
+
+ New tests for scrolled and zoomed documents.
+
+ Fix existing tests which used window.scrollTop = 0, which is not a thing.
+
+ * fast/scrolling/mac/absolute-in-overflow-scroll.html:
+ * fast/scrolling/mac/async-scroll-overflow.html:
+ * fast/scrolling/mac/move-node-in-overflow-scroll.html:
+ * fast/scrolling/mac/overflow-scrolled-document-expected.txt: Added.
+ * fast/scrolling/mac/overflow-scrolled-document.html: Copied from LayoutTests/fast/scrolling/mac/async-scroll-overflow.html.
+ * fast/scrolling/mac/overflow-zoomed-document-expected.txt: Added.
+ * fast/scrolling/mac/overflow-zoomed-document.html: Copied from LayoutTests/fast/scrolling/mac/async-scroll-overflow.html.
+ * fast/scrolling/mac/overlapped-overflow-scroll.html:
+
2020-03-06 Myles C. Maxfield <[email protected]>
[GPU Process] Implement CanvasRenderingContext2D.putImageData()
Modified: trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll.html (258054 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll.html 2020-03-07 04:48:50 UTC (rev 258054)
+++ trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll.html 2020-03-07 05:02:51 UTC (rev 258055)
@@ -43,7 +43,7 @@
async function resetScrollPositions()
{
- window.scrollTop = 0;
+ window.scrollTo(0, 0);
scroller.scrollTop = 0;
// Wait for scroll events to fire.
Modified: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html (258054 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html 2020-03-07 04:48:50 UTC (rev 258054)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html 2020-03-07 05:02:51 UTC (rev 258055)
@@ -32,7 +32,7 @@
async function resetScrollPositions()
{
- window.scrollTop = 0;
+ window.scrollTo(0, 0);
scroller.scrollTop = 0;
// Wait for scroll events to fire.
Modified: trunk/LayoutTests/fast/scrolling/mac/move-node-in-overflow-scroll.html (258054 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/move-node-in-overflow-scroll.html 2020-03-07 04:48:50 UTC (rev 258054)
+++ trunk/LayoutTests/fast/scrolling/mac/move-node-in-overflow-scroll.html 2020-03-07 05:02:51 UTC (rev 258055)
@@ -41,7 +41,7 @@
async function resetScrollPositions()
{
- window.scrollTop = 0;
+ window.scrollTo(0, 0);
scroller.scrollTop = 0;
// Wait for scroll events to fire.
Added: trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document-expected.txt (0 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document-expected.txt 2020-03-07 05:02:51 UTC (rev 258055)
@@ -0,0 +1,8 @@
+
+Test scroll over content
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document.html (from rev 258054, trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html) (0 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document.html 2020-03-07 05:02:51 UTC (rev 258055)
@@ -0,0 +1,86 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ }
+ .scroller {
+ position: absolute;
+ top: 310px;
+ left: 10px;
+ height: 300px;
+ width: 300px;
+ border: 20px solid gray;
+ padding: 5px;
+ overflow: scroll;
+ }
+ .content {
+ width: 200%;
+ height: 300%;
+ }
+
+ </style>
+ <script src=""
+ <script src=""
+ <script>
+ var jsTestIsAsync = true;
+
+ var scroller;
+ var overflowScrollEventCount = 0;
+ var windowScrollEventCount = 0;
+
+ async function resetScrollPositions()
+ {
+ window.scrollTo(0, 300);
+ scroller.scrollTop = 0;
+
+ // Wait for scroll events to fire.
+ await UIHelper.animationFrame();
+
+ overflowScrollEventCount = 0;
+ windowScrollEventCount = 0;
+ }
+
+ async function testScrollOverContent()
+ {
+ debug('');
+ debug('Test scroll over content');
+ await resetScrollPositions();
+ await UIHelper.mouseWheelScrollAt(100, 100);
+
+ shouldBe('overflowScrollEventCount > 0', 'true');
+ shouldBe('windowScrollEventCount == 0', 'true');
+ }
+
+ async function scrollTest()
+ {
+ await testScrollOverContent();
+
+ finishJSTest();
+ }
+
+ window.addEventListener('load', () => {
+ scroller = document.querySelector('.scroller');
+ scroller.addEventListener('scroll', () => {
+ ++overflowScrollEventCount;
+ }, false);
+
+ window.addEventListener('scroll', () => {
+ ++windowScrollEventCount;
+ }, false);
+
+ setTimeout(scrollTest, 0);
+ }, false);
+
+ var successfullyParsed = true;
+ </script>
+</head>
+<body>
+ <div class="scroller">
+ <div class="content"></div>
+ </div>
+ <div class="overlapper"></div>
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document-expected.txt (0 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document-expected.txt 2020-03-07 05:02:51 UTC (rev 258055)
@@ -0,0 +1,8 @@
+
+Test scroll over content
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document.html (from rev 258054, trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html) (0 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document.html 2020-03-07 05:02:51 UTC (rev 258055)
@@ -0,0 +1,91 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ }
+ .scroller {
+ position: absolute;
+ top: 310px;
+ left: 10px;
+ height: 300px;
+ width: 300px;
+ border: 20px solid gray;
+ padding: 5px;
+ overflow: scroll;
+ }
+ .content {
+ width: 200%;
+ height: 300%;
+ }
+
+ </style>
+ <script src=""
+ <script src=""
+ <script>
+ var jsTestIsAsync = true;
+
+ var scroller;
+ var overflowScrollEventCount = 0;
+ var windowScrollEventCount = 0;
+
+ async function resetScrollPositions()
+ {
+ window.scrollTo(0, 300);
+ scroller.scrollTop = 0;
+
+ // Wait for scroll events to fire.
+ await UIHelper.animationFrame();
+
+ overflowScrollEventCount = 0;
+ windowScrollEventCount = 0;
+ }
+
+ async function testScrollOverContent()
+ {
+ debug('');
+ debug('Test scroll over content');
+ await resetScrollPositions();
+ await UIHelper.mouseWheelScrollAt(500, 500);
+
+ shouldBe('overflowScrollEventCount > 0', 'true');
+ shouldBe('windowScrollEventCount == 0', 'true');
+ }
+
+ async function scrollTest()
+ {
+ await testScrollOverContent();
+
+ finishJSTest();
+ }
+
+ const pageScale = 2;
+
+ window.addEventListener('load', () => {
+ scroller = document.querySelector('.scroller');
+ scroller.addEventListener('scroll', () => {
+ ++overflowScrollEventCount;
+ }, false);
+
+ window.addEventListener('scroll', () => {
+ ++windowScrollEventCount;
+ }, false);
+
+ if (window.internals)
+ internals.setPageScaleFactor(pageScale, 0, 0);
+
+ setTimeout(scrollTest, 0);
+ }, false);
+
+ var successfullyParsed = true;
+ </script>
+</head>
+<body>
+ <div class="scroller">
+ <div class="content"></div>
+ </div>
+ <div class="overlapper"></div>
+ <script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/scrolling/mac/overlapped-overflow-scroll.html (258054 => 258055)
--- trunk/LayoutTests/fast/scrolling/mac/overlapped-overflow-scroll.html 2020-03-07 04:48:50 UTC (rev 258054)
+++ trunk/LayoutTests/fast/scrolling/mac/overlapped-overflow-scroll.html 2020-03-07 05:02:51 UTC (rev 258055)
@@ -43,7 +43,7 @@
async function resetScrollPositions()
{
- window.scrollTop = 0;
+ window.scrollTo(0, 0);
scroller.scrollTop = 0;
// Wait for scroll events to fire.
Modified: trunk/Source/WebCore/ChangeLog (258054 => 258055)
--- trunk/Source/WebCore/ChangeLog 2020-03-07 04:48:50 UTC (rev 258054)
+++ trunk/Source/WebCore/ChangeLog 2020-03-07 05:02:51 UTC (rev 258055)
@@ -1,3 +1,18 @@
+2020-03-06 Simon Fraser <[email protected]>
+
+ Fix scrolling tree hit-testing on scrolled and zoomed pages
+ https://bugs.webkit.org/show_bug.cgi?id=208755
+
+ Reviewed by Zalan Bujtas.
+
+ Map the hit-test point from view to content coordinates before hit-testing the scrolling tree.
+
+ Tests: fast/scrolling/mac/overflow-scrolled-document.html
+ fast/scrolling/mac/overflow-zoomed-document.html
+
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::handleWheelEvent):
+
2020-03-06 Alex Christensen <[email protected]>
Add SPI to disable cross origin access control checks
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (258054 => 258055)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-03-07 04:48:50 UTC (rev 258054)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-03-07 05:02:51 UTC (rev 258055)
@@ -111,6 +111,7 @@
if (m_rootNode) {
FloatPoint position = wheelEvent.position();
+ position.move(m_rootNode->viewToContentsOffset(m_treeState.mainFrameScrollPosition));
auto node = scrollingNodeForPoint(position);
LOG_WITH_STREAM(Scrolling, stream << "ScrollingTree::handleWheelEvent found node " << (node ? node->scrollingNodeID() : 0) << " for point " << position << "\n");