Title: [245743] branches/safari-608.1.24.20-branch
Revision
245743
Author
[email protected]
Date
2019-05-23 22:27:33 -0700 (Thu, 23 May 2019)

Log Message

Cherry-pick r245742. rdar://problem/49720087

    With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
    https://bugs.webkit.org/show_bug.cgi?id=198208
    <rdar://problem/49720087>

    Reviewed by Zalan Bujtas.

    Source/WebCore:

    RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
    otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.

    Test: fast/scrolling/programmatic-scroll-to-negative-offset.html

    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::scrollToOffset):

    LayoutTests:

    * fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt: Added.
    * fast/scrolling/programmatic-scroll-to-negative-offset.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog (245742 => 245743)


--- branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog	2019-05-24 03:25:27 UTC (rev 245742)
+++ branches/safari-608.1.24.20-branch/LayoutTests/ChangeLog	2019-05-24 05:27:33 UTC (rev 245743)
@@ -1,3 +1,42 @@
+2019-05-23  Babak Shafiei  <[email protected]>
+
+        Cherry-pick r245742. rdar://problem/49720087
+
+    With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
+    https://bugs.webkit.org/show_bug.cgi?id=198208
+    <rdar://problem/49720087>
+    
+    Reviewed by Zalan Bujtas.
+    
+    Source/WebCore:
+    
+    RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
+    otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.
+    
+    Test: fast/scrolling/programmatic-scroll-to-negative-offset.html
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::scrollToOffset):
+    
+    LayoutTests:
+    
+    * fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt: Added.
+    * fast/scrolling/programmatic-scroll-to-negative-offset.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-23  Simon Fraser  <[email protected]>
+
+            With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
+            https://bugs.webkit.org/show_bug.cgi?id=198208
+            <rdar://problem/49720087>
+
+            Reviewed by Zalan Bujtas.
+
+            * fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt: Added.
+            * fast/scrolling/programmatic-scroll-to-negative-offset.html: Added.
+
 2019-05-23  Kocsen Chung  <[email protected]>
 
         Cherry-pick r245661. rdar://problem/50613388

Added: branches/safari-608.1.24.20-branch/LayoutTests/fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt (0 => 245743)


--- branches/safari-608.1.24.20-branch/LayoutTests/fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt	                        (rev 0)
+++ branches/safari-608.1.24.20-branch/LayoutTests/fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt	2019-05-24 05:27:33 UTC (rev 245743)
@@ -0,0 +1,11 @@
+Tests a programmatic scroll to a negative offset does not result in negative scrollLeft/scrollTop
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS scroller.scrollLeft is 0
+PASS scroller.scrollLeft is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-608.1.24.20-branch/LayoutTests/fast/scrolling/programmatic-scroll-to-negative-offset.html (0 => 245743)


--- branches/safari-608.1.24.20-branch/LayoutTests/fast/scrolling/programmatic-scroll-to-negative-offset.html	                        (rev 0)
+++ branches/safari-608.1.24.20-branch/LayoutTests/fast/scrolling/programmatic-scroll-to-negative-offset.html	2019-05-24 05:27:33 UTC (rev 245743)
@@ -0,0 +1,49 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        .container {
+            height: 200px;
+            width: 200px;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+        .contents {
+            height: 500px;
+            width: 500px;
+            background-color: silver;
+        }
+    </style>
+	<script src=""
+    <script>
+		jsTestIsAsync = true;
+		description("Tests a programmatic scroll to a negative offset does not result in negative scrollLeft/scrollTop");
+
+		var scroller;
+		function doScroll()
+        {
+            scroller = document.getElementById('scroller');
+			scroller.scrollLeft = 50;
+
+			scroller.addEventListener('scroll', (event) => {
+				shouldBe("scroller.scrollLeft", "0");
+				shouldBe("scroller.scrollLeft", "0");
+				finishJSTest();
+			}, false);
+
+			setTimeout(() => {
+				scroller.scrollLeft = -200;
+				scroller.scrollTop = -100;
+			}, 0)
+        }
+        window.addEventListener('load', doScroll, false);
+    </script>
+</head>
+<body>
+    <div id="scroller" class="container">
+        <div class="contents">
+        </div>
+    </div>
+<script src=""
+</body>
+</html>

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog (245742 => 245743)


--- branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-24 03:25:27 UTC (rev 245742)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-24 05:27:33 UTC (rev 245743)
@@ -1,3 +1,47 @@
+2019-05-23  Babak Shafiei  <[email protected]>
+
+        Cherry-pick r245742. rdar://problem/49720087
+
+    With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
+    https://bugs.webkit.org/show_bug.cgi?id=198208
+    <rdar://problem/49720087>
+    
+    Reviewed by Zalan Bujtas.
+    
+    Source/WebCore:
+    
+    RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
+    otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.
+    
+    Test: fast/scrolling/programmatic-scroll-to-negative-offset.html
+    
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::scrollToOffset):
+    
+    LayoutTests:
+    
+    * fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt: Added.
+    * fast/scrolling/programmatic-scroll-to-negative-offset.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-23  Simon Fraser  <[email protected]>
+
+            With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
+            https://bugs.webkit.org/show_bug.cgi?id=198208
+            <rdar://problem/49720087>
+
+            Reviewed by Zalan Bujtas.
+
+            RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
+            otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.
+
+            Test: fast/scrolling/programmatic-scroll-to-negative-offset.html
+
+            * rendering/RenderLayer.cpp:
+            (WebCore::RenderLayer::scrollToOffset):
+
 2019-05-22  Kocsen Chung  <[email protected]>
 
         Cherry-pick r245220. rdar://problem/50686229

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayer.cpp (245742 => 245743)


--- branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayer.cpp	2019-05-24 03:25:27 UTC (rev 245742)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayer.cpp	2019-05-24 05:27:33 UTC (rev 245743)
@@ -2421,8 +2421,8 @@
 
 void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollType scrollType, ScrollClamping clamping)
 {
-    ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset;
-    if (newScrollOffset == this->scrollOffset())
+    ScrollOffset clampedScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset;
+    if (clampedScrollOffset == this->scrollOffset())
         return;
 
     auto previousScrollType = currentScrollType();
@@ -2431,11 +2431,11 @@
     bool handled = false;
 #if ENABLE(ASYNC_SCROLLING)
     if (ScrollingCoordinator* scrollingCoordinator = page().scrollingCoordinator())
-        handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(scrollOffset));
+        handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(clampedScrollOffset));
 #endif
 
     if (!handled)
-        scrollToOffsetWithoutAnimation(newScrollOffset, clamping);
+        scrollToOffsetWithoutAnimation(clampedScrollOffset, clamping);
 
     setCurrentScrollType(previousScrollType);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to