RTL/overflow scroll tests fail with async overflow enabled
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 May 2019 15:53:40 +0000 (15:53 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 May 2019 15:53:40 +0000 (15:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196013
<rdar://problem/49066649>

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/ios/rtl-overflow-scrolling-2.html

This patch makes the basic RTL cases work in the scrolling tree.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
(WebCore::ScrollingTreeScrollingNode::maximumScrollPosition const):

Add missing scroll offset <-> scroll position conversions.

Source/WebKit:

Add missing scroll offset <-> scroll position conversions.

* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):

LayoutTests:

* compositing/ios/rtl-overflow-scrolling-2-expected.html: Added.
* compositing/ios/rtl-overflow-scrolling-2.html: Added.

Add a reftest version for better coverage.

* compositing/rtl/rtl-overflow-scrolling.html:
* platform/ios-wk1/TestExpectations:
* platform/ios-wk2/TestExpectations:
* platform/ios-wk2/compositing/rtl/rtl-overflow-scrolling-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245568 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/ios/rtl-overflow-scrolling-2-expected.html [new file with mode: 0644]
LayoutTests/compositing/ios/rtl-overflow-scrolling-2.html [new file with mode: 0644]
LayoutTests/compositing/rtl/rtl-overflow-scrolling.html
LayoutTests/platform/ios-wk1/TestExpectations
LayoutTests/platform/ios-wk2/TestExpectations
LayoutTests/platform/ios-wk2/compositing/rtl/rtl-overflow-scrolling-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm

index df95dba..3920a3d 100644 (file)
@@ -1,3 +1,21 @@
+2019-05-21  Antti Koivisto  <antti@apple.com>
+
+        RTL/overflow scroll tests fail with async overflow enabled
+        https://bugs.webkit.org/show_bug.cgi?id=196013
+        <rdar://problem/49066649>
+
+        Reviewed by Simon Fraser.
+
+        * compositing/ios/rtl-overflow-scrolling-2-expected.html: Added.
+        * compositing/ios/rtl-overflow-scrolling-2.html: Added.
+
+        Add a reftest version for better coverage.
+
+        * compositing/rtl/rtl-overflow-scrolling.html:
+        * platform/ios-wk1/TestExpectations:
+        * platform/ios-wk2/TestExpectations:
+        * platform/ios-wk2/compositing/rtl/rtl-overflow-scrolling-expected.txt: Added.
+
 2019-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [WPE] Add initial accessibility support using ATK
diff --git a/LayoutTests/compositing/ios/rtl-overflow-scrolling-2-expected.html b/LayoutTests/compositing/ios/rtl-overflow-scrolling-2-expected.html
new file mode 100644 (file)
index 0000000..aa26a89
--- /dev/null
@@ -0,0 +1,9 @@
+<style>
+#container {
+    width: 300px;
+    height: 300px;
+    background-color: green;
+}
+</style>
+<div id="container">
+</div>
diff --git a/LayoutTests/compositing/ios/rtl-overflow-scrolling-2.html b/LayoutTests/compositing/ios/rtl-overflow-scrolling-2.html
new file mode 100644 (file)
index 0000000..a1bb888
--- /dev/null
@@ -0,0 +1,38 @@
+<!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+<script type="text/javascript">
+    function runTest() {
+        document.getElementById("container").scrollLeft = -500;
+    }
+</script>
+<style>
+#container {
+    direction: rtl;
+    overflow: scroll;
+    width: 300px;
+    height: 300px;
+}
+#overflow {
+    width: 1000px;
+    height: 1000px;
+    background-color: red;
+}
+#inner {
+    margin-left: 200px;
+    margin-right: 500px;
+    width: 300px;
+    height: 1000px;
+    background-color: green;
+}
+</style>
+</head>
+<body onload="runTest();">
+<div id="container">
+<div id="overflow">
+<div id="inner">
+</div>
+</div>
+</div>
+</body>
+</html>
index 4fe8b1a..ee5333a 100644 (file)
@@ -1,4 +1,4 @@
-<!-- webkit-test-runner [ useThreadedScrolling=false ] -->
+<!-- webkit-test-runner [ useThreadedScrolling=false internal:AsyncOverflowScrollingEnabled=true ] -->
 <html>
 <head>
 <script type="text/javascript">
index 416ba5b..0c3193e 100644 (file)
@@ -629,6 +629,7 @@ compositing/overlap-blending/nested-overlap-overflow.html [ ImageOnlyFailure ]
 compositing/overlap-blending/reflection-opacity-huge.html [ ImageOnlyFailure ]
 compositing/text-on-scaled-layer.html [ ImageOnlyFailure ]
 compositing/text-on-scaled-surface.html [ ImageOnlyFailure ]
+compositing/ios/rtl-overflow-scrolling-2.html [ ImageOnlyFailure ]
 
 # Compositing tests that are flaky:
 compositing/cliprect-and-position-change-on-compositing-layer.html [ ImageOnlyFailure Pass ]
index bc18b67..08099af 100644 (file)
@@ -1312,7 +1312,6 @@ webkit.org/b/194253 [ Debug ] scrollingcoordinator/scrolling-tree/fixed-inside-f
 webkit.org/b/195341 fast/viewport/ios/device-width-viewport-after-changing-view-scale.html [ Pass Failure ]
 webkit.org/b/195341 compositing/ios/overflow-scroll-update-overlap.html [ ImageOnlyFailure ]
 
-webkit.org/b/196013 compositing/rtl/rtl-overflow-scrolling.html [ Failure ]
 webkit.org/b/196013 fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html [ ImageOnlyFailure ]
 webkit.org/b/196013 fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html [ ImageOnlyFailure ]
 webkit.org/b/196013 fast/scrolling/rubber-band-shows-background.html [ ImageOnlyFailure ]
diff --git a/LayoutTests/platform/ios-wk2/compositing/rtl/rtl-overflow-scrolling-expected.txt b/LayoutTests/platform/ios-wk2/compositing/rtl/rtl-overflow-scrolling-expected.txt
new file mode 100644 (file)
index 0000000..20c9a3d
--- /dev/null
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+layer at (8,8) size 300x300 scrollX -15 scrollWidth 1000 scrollHeight 1000
+  RenderBlock {DIV} at (0,0) size 300x300
+    RenderBlock {DIV} at (-700,0) size 1000x1000 [bgcolor=#008000]
index 1c6d3a0..48edb2b 100644 (file)
@@ -1,3 +1,23 @@
+2019-05-21  Antti Koivisto  <antti@apple.com>
+
+        RTL/overflow scroll tests fail with async overflow enabled
+        https://bugs.webkit.org/show_bug.cgi?id=196013
+        <rdar://problem/49066649>
+
+        Reviewed by Simon Fraser.
+
+        Test: compositing/ios/rtl-overflow-scrolling-2.html
+
+        This patch makes the basic RTL cases work in the scrolling tree.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
+        (WebCore::ScrollingTreeScrollingNode::maximumScrollPosition const):
+
+        Add missing scroll offset <-> scroll position conversions.
+
 2019-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [WPE] Add initial accessibility support using ATK
index bfeef77..d5e447b 100644 (file)
@@ -335,7 +335,7 @@ void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNo
     if (auto* scrollableArea = frameView.scrollableAreaForScrollLayerID(scrollingNodeID)) {
         auto previousScrollType = scrollableArea->currentScrollType();
         scrollableArea->setCurrentScrollType(scrollType);
-        scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition);
+        scrollableArea->scrollToOffsetWithoutAnimation(ScrollableArea::scrollOffsetFromPosition(scrollPosition, toFloatSize(scrollableArea->scrollOrigin())));
         scrollableArea->setCurrentScrollType(previousScrollType);
 
         if (scrollingLayerPositionAction == ScrollingLayerPositionAction::Set)
index 581d153..1f7907f 100644 (file)
@@ -125,13 +125,15 @@ FloatPoint ScrollingTreeScrollingNode::clampScrollPosition(const FloatPoint& scr
 
 FloatPoint ScrollingTreeScrollingNode::minimumScrollPosition() const
 {
-    return { };
+    auto minimumScrollOffset = FloatPoint { };
+    return ScrollableArea::scrollPositionFromOffset(minimumScrollOffset, toFloatSize(scrollOrigin()));
 }
 
 FloatPoint ScrollingTreeScrollingNode::maximumScrollPosition() const
 {
     FloatPoint contentSizePoint(totalContentsSize());
-    return FloatPoint(contentSizePoint - scrollableAreaSize()).expandedTo(FloatPoint());
+    auto maximumScrollOffset = FloatPoint(contentSizePoint - scrollableAreaSize()).expandedTo(FloatPoint());
+    return ScrollableArea::scrollPositionFromOffset(maximumScrollOffset, toFloatSize(scrollOrigin()));
 }
 
 bool ScrollingTreeScrollingNode::scrollLimitReached(const PlatformWheelEvent& wheelEvent) const
index 6c4c217..f500baa 100644 (file)
@@ -1,3 +1,18 @@
+2019-05-21  Antti Koivisto  <antti@apple.com>
+
+        RTL/overflow scroll tests fail with async overflow enabled
+        https://bugs.webkit.org/show_bug.cgi?id=196013
+        <rdar://problem/49066649>
+
+        Reviewed by Simon Fraser.
+
+        Add missing scroll offset <-> scroll position conversions.
+
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
+
 2019-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [WPE] Add initial accessibility support using ATK
index b0c00ee..ab8bf5c 100644 (file)
@@ -55,7 +55,7 @@ public:
     void scrollWillStart() const;
     void scrollDidEnd() const;
     void scrollViewWillStartPanGesture() const;
-    void scrollViewDidScroll(const WebCore::FloatPoint& scrollPosition, bool inUserInteraction);
+    void scrollViewDidScroll(const WebCore::FloatPoint& scrollOffset, bool inUserInteraction);
 
     void currentSnapPointIndicesDidChange(unsigned horizontal, unsigned vertical) const;
     CALayer *scrollLayer() const { return m_scrollLayer.get(); }
index 921bac1..5c39e78 100644 (file)
@@ -294,10 +294,9 @@ void ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren(const Scrol
 
 void ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers()
 {
-    auto scrollPosition = scrollingNode().currentScrollPosition();
-
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [scrollView() setContentOffset:scrollPosition];
+    auto scrollOffset = ScrollableArea::scrollOffsetFromPosition(scrollingNode().currentScrollPosition(), toFloatSize(scrollOrigin()));
+    [scrollView() setContentOffset:scrollOffset];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
@@ -316,11 +315,12 @@ void ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture() cons
     scrollingTree().scrollingTreeNodeWillStartPanGesture();
 }
 
-void ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll(const FloatPoint& scrollPosition, bool inUserInteraction)
+void ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll(const FloatPoint& scrollOffset, bool inUserInteraction)
 {
     if (m_updatingFromStateNode)
         return;
 
+    auto scrollPosition = ScrollableArea::scrollPositionFromOffset(scrollOffset, toFloatSize(scrollOrigin()));
     scrollingNode().wasScrolledByDelegatedScrolling(scrollPosition);
 }