Title: [245771] trunk
Revision
245771
Author
[email protected]
Date
2019-05-25 08:01:09 -0700 (Sat, 25 May 2019)

Log Message

[macOS] Fix programmatic scroll in RTL overflow with async scrolling enabled
https://bugs.webkit.org/show_bug.cgi?id=198226

Reviewed by Antti Koivisto.

Source/WebCore:

On macOS we need to use a scroll offset to set the layer position, not
a scroll position.

Test: scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html

* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
(WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):

Source/WebCore/../../LayoutTests:

* scrollingcoordinator/mac/rtl-programmatic-overflow-scroll-expected.html: Added.
* scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245770 => 245771)


--- trunk/LayoutTests/ChangeLog	2019-05-25 14:33:43 UTC (rev 245770)
+++ trunk/LayoutTests/ChangeLog	2019-05-25 15:01:09 UTC (rev 245771)
@@ -1,3 +1,13 @@
+2019-05-25  Simon Fraser  <[email protected]>
+
+        [macOS] Fix programmatic scroll in RTL overflow with async scrolling enabled
+        https://bugs.webkit.org/show_bug.cgi?id=198226
+
+        Reviewed by Antti Koivisto.
+
+        * scrollingcoordinator/mac/rtl-programmatic-overflow-scroll-expected.html: Added.
+        * scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html: Added.
+
 2019-05-24  Joonghun Park  <[email protected]>
 
         Make computed width of non-replaced inline return computed style.

Added: trunk/LayoutTests/scrollingcoordinator/mac/rtl-programmatic-overflow-scroll-expected.html (0 => 245771)


--- trunk/LayoutTests/scrollingcoordinator/mac/rtl-programmatic-overflow-scroll-expected.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/rtl-programmatic-overflow-scroll-expected.html	2019-05-25 15:01:09 UTC (rev 245771)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            margin: 0;
+        }
+        
+        #scroller {
+		    direction: rtl;
+            overflow-x: scroll;
+            margin: 10px;
+            height: 300px;
+            width: 300px;
+        }
+        
+        .contents {
+		    width: 200%;
+		    height: 100%;
+			background-image: linear-gradient(to right, red, red 50%, green 50%, green);
+        }
+
+        .scrollbar-hider {
+            position: absolute;
+            width: 300px;
+            height: 16px;
+            left: 10px;
+            top: calc(310px - 16px);
+            background-color: gray;
+        }
+    </style>
+</head>
+<body>
+    <div id="scroller">
+        <div class="contents"></div>
+    </div>
+    <div class="scrollbar-hider"></div>
+</body>
+</html>

Added: trunk/LayoutTests/scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html (0 => 245771)


--- trunk/LayoutTests/scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html	2019-05-25 15:01:09 UTC (rev 245771)
@@ -0,0 +1,44 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        body {
+            margin: 0;
+        }
+        
+        #scroller {
+		    direction: rtl;
+            overflow-x: scroll;
+            margin: 10px;
+            height: 300px;
+            width: 300px;
+        }
+        
+        .contents {
+		    width: 200%;
+		    height: 100%;
+			background-image: linear-gradient(to right, green, green 50%, red 50%, red);
+        }
+
+        .scrollbar-hider {
+            position: absolute;
+            width: 300px;
+            height: 16px;
+            left: 10px;
+            top: calc(310px - 16px);
+            background-color: gray;
+        }
+    </style>
+    <script>
+        window.addEventListener('load', () => {
+            scroller.scrollLeft = -300;
+        }, false);
+    </script>
+</head>
+<body>
+    <div id="scroller">
+        <div class="contents"></div>
+    </div>
+    <div class="scrollbar-hider"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (245770 => 245771)


--- trunk/Source/WebCore/ChangeLog	2019-05-25 14:33:43 UTC (rev 245770)
+++ trunk/Source/WebCore/ChangeLog	2019-05-25 15:01:09 UTC (rev 245771)
@@ -1,3 +1,18 @@
+2019-05-25  Simon Fraser  <[email protected]>
+
+        [macOS] Fix programmatic scroll in RTL overflow with async scrolling enabled
+        https://bugs.webkit.org/show_bug.cgi?id=198226
+
+        Reviewed by Antti Koivisto.
+
+        On macOS we need to use a scroll offset to set the layer position, not
+        a scroll position.
+
+        Test: scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html
+
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
+
 2019-05-24  Joonghun Park  <[email protected]>
 
         Make computed width of non-replaced inline return computed style.

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (245770 => 245771)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2019-05-25 14:33:43 UTC (rev 245770)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2019-05-25 15:01:09 UTC (rev 245771)
@@ -90,8 +90,8 @@
 
 void ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers()
 {
-    auto scrollPosition = currentScrollPosition();
-    scrolledContentsLayer().position = -scrollPosition;
+    auto scrollOffset = ScrollableArea::scrollOffsetFromPosition(currentScrollPosition(), toFloatSize(scrollOrigin()));
+    scrolledContentsLayer().position = -scrollOffset;
 }
 
 void ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to