- Revision
- 259936
- Author
- [email protected]
- Date
- 2020-04-11 16:49:26 -0700 (Sat, 11 Apr 2020)
Log Message
[Async overflow] Can't scroll overflow:scroll in sideways-scrollable RTL document
https://bugs.webkit.org/show_bug.cgi?id=210389
Reviewed by Tim Horton.
Source/WebCore:
ScrollingTree::handleWheelEvent() converts the event coordinates from view to "content"
coordinates, but we then jump into hit-testing on CALayers. In a sideways-scrollable
RTL document, the root content layer has a negative X offset which corresponds to
scrollOrigin; we need to map the point into the coordinate space of this layer
before entering layer-based hit-testing.
Tests: fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html
fast/scrolling/mac/async-scroll-overflow-rtl.html
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::handleWheelEvent):
* page/scrolling/mac/ScrollingTreeMac.mm:
(ScrollingTreeMac::scrollingNodeForPoint):
LayoutTests:
* fast/scrolling/mac/async-scroll-overflow-rtl-expected.txt: Added.
* fast/scrolling/mac/async-scroll-overflow-rtl-zoomed-expected.txt: Added.
* fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html: Added.
* fast/scrolling/mac/async-scroll-overflow-rtl.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (259935 => 259936)
--- trunk/LayoutTests/ChangeLog 2020-04-11 23:21:26 UTC (rev 259935)
+++ trunk/LayoutTests/ChangeLog 2020-04-11 23:49:26 UTC (rev 259936)
@@ -1,3 +1,15 @@
+2020-04-11 Simon Fraser <[email protected]>
+
+ [Async overflow] Can't scroll overflow:scroll in sideways-scrollable RTL document
+ https://bugs.webkit.org/show_bug.cgi?id=210389
+
+ Reviewed by Tim Horton.
+
+ * fast/scrolling/mac/async-scroll-overflow-rtl-expected.txt: Added.
+ * fast/scrolling/mac/async-scroll-overflow-rtl-zoomed-expected.txt: Added.
+ * fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html: Added.
+ * fast/scrolling/mac/async-scroll-overflow-rtl.html: Added.
+
2020-04-11 Diego Pino Garcia <[email protected]>
[GTK] Gardening of encrypted-media tests
Added: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-expected.txt (0 => 259936)
--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-expected.txt 2020-04-11 23:49:26 UTC (rev 259936)
@@ -0,0 +1,8 @@
+
+Test scroll over content
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed-expected.txt (0 => 259936)
--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed-expected.txt 2020-04-11 23:49:26 UTC (rev 259936)
@@ -0,0 +1,20 @@
+
+Test scroll outside top left corner
+PASS overflowScrollEventCount is 0
+PASS windowScrollEventCount > 0 is true
+
+Test scroll inside top left corner
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount is 0
+
+Test scroll outside bottom right corner
+PASS overflowScrollEventCount is 0
+PASS windowScrollEventCount > 0 is true
+
+Test scroll inside bottom right corner
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html (0 => 259936)
--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html 2020-04-11 23:49:26 UTC (rev 259936)
@@ -0,0 +1,131 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html dir="rtl">
+<head>
+ <style>
+ .wide {
+ width: 2000px;
+ height: 10px;
+ background-color: silver;
+ }
+
+ .scroller {
+ position: absolute;
+ left: 100px;
+ top: 20px;
+ height: 200px;
+ width: 200px;
+ border: 4px solid gray;
+ padding: 5px;
+ margin: 10px;
+ 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, 0);
+ scroller.scrollTop = 0;
+
+ // Wait for scroll events to fire.
+ await UIHelper.animationFrame();
+
+ overflowScrollEventCount = 0;
+ windowScrollEventCount = 0;
+ }
+
+ async function testScrollOutsideTopLeft()
+ {
+ debug('');
+ debug('Test scroll outside top left corner');
+ await resetScrollPositions();
+ await UIHelper.mouseWheelScrollAt(170, 40);
+
+ shouldBe('overflowScrollEventCount', '0');
+ shouldBe('windowScrollEventCount > 0', 'true');
+ }
+
+ async function testScrollInsideTopLeft()
+ {
+ debug('');
+ debug('Test scroll inside top left corner');
+ await resetScrollPositions();
+ await UIHelper.mouseWheelScrollAt(215, 60);
+
+ shouldBe('overflowScrollEventCount > 0', 'true');
+ shouldBe('windowScrollEventCount', '0');
+ }
+
+ async function testScrollOutsideBottomRight()
+ {
+ debug('');
+ debug('Test scroll outside bottom right corner');
+ await resetScrollPositions();
+ await UIHelper.mouseWheelScrollAt(515, 380);
+
+ shouldBe('overflowScrollEventCount', '0');
+ shouldBe('windowScrollEventCount > 0', 'true');
+ }
+
+ async function testScrollInsideBottomRight()
+ {
+ debug('');
+ debug('Test scroll inside bottom right corner');
+ await resetScrollPositions();
+ await UIHelper.mouseWheelScrollAt(485, 335);
+
+ shouldBe('overflowScrollEventCount > 0', 'true');
+ shouldBe('windowScrollEventCount', '0');
+ }
+
+ async function scrollTest()
+ {
+ await testScrollOutsideTopLeft();
+ await testScrollInsideTopLeft();
+ await testScrollOutsideBottomRight();
+ await testScrollInsideBottomRight();
+
+ finishJSTest();
+ }
+
+ window.addEventListener('load', () => {
+
+ if (window.internals)
+ internals.setPageScaleFactor(1.5, 0, 0);
+
+ 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="wide"></div>
+ <div class="scroller">
+ <div class="content"></div>
+ </div>
+ <div id="console"></div>
+ <script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl.html (0 => 259936)
--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl.html 2020-04-11 23:49:26 UTC (rev 259936)
@@ -0,0 +1,77 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html dir="rtl">
+<head>
+ <style>
+ .wide {
+ width: 2000px;
+ height: 10px;
+ background-color: silver;
+ }
+
+ .scroller {
+ position: absolute;
+ left: 100px;
+ top: 20px;
+ height: 300px;
+ width: 300px;
+ border: 20px solid gray;
+ padding: 5px;
+ margin: 20px;
+ 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 testScrollOverContent()
+ {
+ debug('');
+ debug('Test scroll over content');
+ await UIHelper.mouseWheelScrollAt(300, 250); // Over the scroller
+
+ shouldBe('overflowScrollEventCount > 0', 'true');
+ shouldBe('windowScrollEventCount', '0');
+ }
+
+ 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="wide"></div>
+ <div class="scroller">
+ <div class="content"></div>
+ </div>
+ <div id="console"></div>
+ <script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (259935 => 259936)
--- trunk/Source/WebCore/ChangeLog 2020-04-11 23:21:26 UTC (rev 259935)
+++ trunk/Source/WebCore/ChangeLog 2020-04-11 23:49:26 UTC (rev 259936)
@@ -1,3 +1,24 @@
+2020-04-11 Simon Fraser <[email protected]>
+
+ [Async overflow] Can't scroll overflow:scroll in sideways-scrollable RTL document
+ https://bugs.webkit.org/show_bug.cgi?id=210389
+
+ Reviewed by Tim Horton.
+
+ ScrollingTree::handleWheelEvent() converts the event coordinates from view to "content"
+ coordinates, but we then jump into hit-testing on CALayers. In a sideways-scrollable
+ RTL document, the root content layer has a negative X offset which corresponds to
+ scrollOrigin; we need to map the point into the coordinate space of this layer
+ before entering layer-based hit-testing.
+
+ Tests: fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html
+ fast/scrolling/mac/async-scroll-overflow-rtl.html
+
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::handleWheelEvent):
+ * page/scrolling/mac/ScrollingTreeMac.mm:
+ (ScrollingTreeMac::scrollingNodeForPoint):
+
2020-04-10 Darin Adler <[email protected]>
Move more from live range to SimpleRange: callers of absoluteTextRects
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (259935 => 259936)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-04-11 23:21:26 UTC (rev 259935)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2020-04-11 23:49:26 UTC (rev 259936)
@@ -77,7 +77,7 @@
ScrollingEventResult ScrollingTree::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
{
- LOG_WITH_STREAM(Scrolling, stream << "\nScrollingTree " << this << " handleWheelEvent (async scrolling enabled: " << asyncFrameOrOverflowScrollingEnabled() << ")");
+ LOG_WITH_STREAM(Scrolling, stream << "\nScrollingTree " << this << " handleWheelEvent " << wheelEvent);
LockHolder locker(m_treeMutex);
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm (259935 => 259936)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm 2020-04-11 23:21:26 UTC (rev 259935)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm 2020-04-11 23:49:26 UTC (rev 259936)
@@ -154,9 +154,10 @@
LockHolder lockHolder(m_layerHitTestMutex);
auto rootContentsLayer = static_cast<ScrollingTreeFrameScrollingNodeMac*>(rootScrollingNode)->rootContentsLayer();
+ auto pointInContentsLayer = [rootContentsLayer convertPoint:point fromLayer:[rootContentsLayer superlayer]];
Vector<CALayer *, 16> layersAtPoint;
- collectDescendantLayersAtPoint(layersAtPoint, rootContentsLayer.get(), point);
+ collectDescendantLayersAtPoint(layersAtPoint, rootContentsLayer.get(), pointInContentsLayer);
LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeMac " << this << " scrollingNodeForPoint " << point << " found " << layersAtPoint.size() << " layers");
#if !LOG_DISABLED