Title: [284778] trunk
Revision
284778
Author
[email protected]
Date
2021-10-25 05:35:28 -0700 (Mon, 25 Oct 2021)

Log Message

[GTK][WPE] REGRESSION(r284596): Scrolling sometimes jumps to the top of the page during smooth mouse-wheel scrolling
https://bugs.webkit.org/show_bug.cgi?id=232229

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Make sure that retargeting a smooth scroll animation before a frame
callback is called works correctly.

Test: fast/scrolling/gtk/repeated-mouse-wheel-smooth.html

* platform/ScrollAnimationSmooth.cpp:
(WebCore::ScrollAnimationSmooth::startAnimatedScrollToDestination):

LayoutTests:

Add test to make sure that retargeted smooth scrolling doesn't jump to
the top of the page unexpectedly.

* fast/scrolling/gtk/repeated-mouse-wheel-smooth-expected.txt: Added.
* fast/scrolling/gtk/repeated-mouse-wheel-smooth.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284777 => 284778)


--- trunk/LayoutTests/ChangeLog	2021-10-25 12:11:45 UTC (rev 284777)
+++ trunk/LayoutTests/ChangeLog	2021-10-25 12:35:28 UTC (rev 284778)
@@ -1,3 +1,16 @@
+2021-10-25  Chris Lord  <[email protected]>
+
+        [GTK][WPE] REGRESSION(r284596): Scrolling sometimes jumps to the top of the page during smooth mouse-wheel scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=232229
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add test to make sure that retargeted smooth scrolling doesn't jump to
+        the top of the page unexpectedly.
+
+        * fast/scrolling/gtk/repeated-mouse-wheel-smooth-expected.txt: Added.
+        * fast/scrolling/gtk/repeated-mouse-wheel-smooth.html: Added.
+
 2021-10-25  Arcady Goldmints-Orlov  <[email protected]>
 
         [GLIB] Update test baselines after r284521

Added: trunk/LayoutTests/fast/scrolling/gtk/repeated-mouse-wheel-smooth-expected.txt (0 => 284778)


--- trunk/LayoutTests/fast/scrolling/gtk/repeated-mouse-wheel-smooth-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/gtk/repeated-mouse-wheel-smooth-expected.txt	2021-10-25 12:35:28 UTC (rev 284778)
@@ -0,0 +1,7 @@
+PASS Scroll downwards by 1 tick
+PASS Scroll downwards by another tick
+PASS Scroll downwards by two more ticks, interrupting the first
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/scrolling/gtk/repeated-mouse-wheel-smooth.html (0 => 284778)


--- trunk/LayoutTests/fast/scrolling/gtk/repeated-mouse-wheel-smooth.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/gtk/repeated-mouse-wheel-smooth.html	2021-10-25 12:35:28 UTC (rev 284778)
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <script src=""
+  <title>Repeated mouse-wheel scrolling does not scroll to top of page</title>
+  <style>
+    body {
+      margin: 0;
+      height: 5000px;
+    }
+  </style>
+</head>
+<body>
+</body>
+<script>
+var wheelTick = 40;
+var expectedMinimum;
+var expectedScrollTop;
+var testsPassed = 0;
+var testDescription;
+
+function triggerNextTest() {
+    if (testsPassed)
+        debug("PASS " + testDescription);
+
+    switch (testsPassed) {
+    case 0:
+        testDescription = "Scroll downwards by 1 tick"
+        expectedMinimum = 0;
+        expectedScrollTop = wheelTick;
+        eventSender.mouseScrollBy(0, -1);
+        return;
+
+    case 1:
+        testDescription = "Scroll downwards by another tick"
+        expectedMinimum = expectedScrollTop;
+        expectedScrollTop = wheelTick * 2;
+        eventSender.mouseScrollBy(0, -1);
+        return;
+
+    case 2:
+        testDescription = "Scroll downwards by two more ticks, interrupting the first"
+        expectedMinimum = expectedScrollTop;
+        expectedScrollTop = wheelTick * 4;
+        eventSender.mouseScrollBy(0, -1);
+        eventSender.mouseScrollBy(0, -1);
+        return;
+    }
+
+    isSuccessfullyParsed();
+    testRunner.notifyDone();
+
+    return;
+}
+
+function scrollEventCallback() {
+    if (document.scrollingElement.scrollTop < expectedMinimum)
+        debug("FAIL Repeated mouse-wheel scrolling doesn't go backwards");
+    if (document.scrollingElement.scrollTop == expectedScrollTop) {
+        ++testsPassed;
+        if (window.testRunner)
+            triggerNextTest();
+    }
+}
+
+
+document.addEventListener("scroll", scrollEventCallback, false);
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+}
+
+if (window.eventSender) {
+    triggerNextTest();
+}
+</script>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (284777 => 284778)


--- trunk/Source/WebCore/ChangeLog	2021-10-25 12:11:45 UTC (rev 284777)
+++ trunk/Source/WebCore/ChangeLog	2021-10-25 12:35:28 UTC (rev 284778)
@@ -1,3 +1,18 @@
+2021-10-25  Chris Lord  <[email protected]>
+
+        [GTK][WPE] REGRESSION(r284596): Scrolling sometimes jumps to the top of the page during smooth mouse-wheel scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=232229
+
+        Reviewed by Carlos Garcia Campos.
+
+        Make sure that retargeting a smooth scroll animation before a frame
+        callback is called works correctly.
+
+        Test: fast/scrolling/gtk/repeated-mouse-wheel-smooth.html
+
+        * platform/ScrollAnimationSmooth.cpp:
+        (WebCore::ScrollAnimationSmooth::startAnimatedScrollToDestination):
+
 2021-10-25  Ziran Sun  <[email protected]>
 
         [css-writing-modes] Fix sizing of orthogonal elements with percentage margins

Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp (284777 => 284778)


--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp	2021-10-25 12:11:45 UTC (rev 284777)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp	2021-10-25 12:35:28 UTC (rev 284778)
@@ -55,7 +55,7 @@
     auto extents = m_client.scrollExtentsForAnimation(*this);
 
     m_startTime = MonotonicTime::now();
-    m_startOffset = fromOffset;
+    m_currentOffset = m_startOffset = fromOffset;
     m_destinationOffset = destinationOffset.constrainedBetween(extents.minimumScrollOffset(), extents.maximumScrollOffset());
     m_duration = durationFromDistance(m_destinationOffset - m_startOffset);
     downcast<CubicBezierTimingFunction>(*m_timingFunction).setTimingFunctionPreset(CubicBezierTimingFunction::TimingFunctionPreset::EaseInOut);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to