Title: [263838] trunk/Source/WebCore
Revision
263838
Author
commit-qu...@webkit.org
Date
2020-07-02 02:19:12 -0700 (Thu, 02 Jul 2020)

Log Message

[GTK] Kinetic scrolling is still triggered if you wait before lifting fingers
https://bugs.webkit.org/show_bug.cgi?id=213789

Patch by Alexander Mikhaylenko <al...@gnome.org> on 2020-07-02
Reviewed by Carlos Garcia Campos.

The intended behavior for kinetic scrolling is that it's possible to not trigger it by
stopping moving fingers before lifting them, as opposed to doing a fling/swipe. However,
right now it's broken and trying to do this triggers kinetic scrolling as well.

Currently, the last scroll event with (0, 0) deltas isn't added to the scroll history for
kinetic scrolling. However, this is wrong, because the last event, or rather the timespan
between it and the previous scroll event, actually determines the kinetic scrolling velocity:
if this event follows the previous one quickly, the velocity is large, but if there was a long
pause, the velocity would be close to 0.

See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1902 and
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1903 for the equivalent GTK fixes.

* page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
(WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent):
* page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
(WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent):
* platform/generic/ScrollAnimatorGeneric.cpp:
(WebCore::ScrollAnimatorGeneric::handleWheelEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (263837 => 263838)


--- trunk/Source/WebCore/ChangeLog	2020-07-02 08:47:57 UTC (rev 263837)
+++ trunk/Source/WebCore/ChangeLog	2020-07-02 09:19:12 UTC (rev 263838)
@@ -1,3 +1,30 @@
+2020-07-02  Alexander Mikhaylenko  <al...@gnome.org>
+
+        [GTK] Kinetic scrolling is still triggered if you wait before lifting fingers
+        https://bugs.webkit.org/show_bug.cgi?id=213789
+
+        Reviewed by Carlos Garcia Campos.
+
+        The intended behavior for kinetic scrolling is that it's possible to not trigger it by
+        stopping moving fingers before lifting them, as opposed to doing a fling/swipe. However,
+        right now it's broken and trying to do this triggers kinetic scrolling as well.
+
+        Currently, the last scroll event with (0, 0) deltas isn't added to the scroll history for
+        kinetic scrolling. However, this is wrong, because the last event, or rather the timespan
+        between it and the previous scroll event, actually determines the kinetic scrolling velocity:
+        if this event follows the previous one quickly, the velocity is large, but if there was a long
+        pause, the velocity would be close to 0.
+
+        See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1902 and
+        https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1903 for the equivalent GTK fixes.
+
+        * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
+        (WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent):
+        * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
+        (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent):
+        * platform/generic/ScrollAnimatorGeneric.cpp:
+        (WebCore::ScrollAnimatorGeneric::handleWheelEvent):
+
 2020-07-02  Philippe Normand  <pnorm...@igalia.com>
 
         [GStreamer] Rewrite mediastreamsrc element

Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp (263837 => 263838)


--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp	2020-07-02 08:47:57 UTC (rev 263837)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp	2020-07-02 09:19:12 UTC (rev 263838)
@@ -127,10 +127,11 @@
         auto updateScope = compositionLayer.createUpdateScope();
         scrollBy({ -wheelEvent.deltaX(), -wheelEvent.deltaY() });
 
+    }
+
 #if ENABLE(KINETIC_SCROLLING)
-        m_kineticAnimation->appendToScrollHistory(wheelEvent);
+    m_kineticAnimation->appendToScrollHistory(wheelEvent);
 #endif
-    }
 
 #if ENABLE(KINETIC_SCROLLING)
     m_kineticAnimation->stop();

Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp (263837 => 263838)


--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp	2020-07-02 08:47:57 UTC (rev 263837)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp	2020-07-02 09:19:12 UTC (rev 263838)
@@ -111,11 +111,11 @@
 
         auto updateScope = compositionLayer.createUpdateScope();
         scrollBy({ -wheelEvent.deltaX(), -wheelEvent.deltaY() });
+    }
 
 #if ENABLE(KINETIC_SCROLLING)
-        m_kineticAnimation->appendToScrollHistory(wheelEvent);
+    m_kineticAnimation->appendToScrollHistory(wheelEvent);
 #endif
-    }
 
 #if ENABLE(KINETIC_SCROLLING)
     m_kineticAnimation->stop();

Modified: trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp (263837 => 263838)


--- trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp	2020-07-02 08:47:57 UTC (rev 263837)
+++ trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp	2020-07-02 09:19:12 UTC (rev 263838)
@@ -112,8 +112,9 @@
     m_kineticAnimation->stop();
 
 #if ENABLE(KINETIC_SCROLLING)
+    m_kineticAnimation->appendToScrollHistory(event);
+
     if (event.isEndOfNonMomentumScroll()) {
-        // We don't need to add the event to the history as its delta will be (0, 0).
         m_kineticAnimation->start(m_currentPosition, m_kineticAnimation->computeVelocity(), m_scrollableArea.horizontalScrollbar(), m_scrollableArea.verticalScrollbar());
         return true;
     }
@@ -122,8 +123,6 @@
         m_kineticAnimation->start(m_currentPosition, event.swipeVelocity(), m_scrollableArea.horizontalScrollbar(), m_scrollableArea.verticalScrollbar());
         return true;
     }
-
-    m_kineticAnimation->appendToScrollHistory(event);
 #endif
 
     return ScrollAnimator::handleWheelEvent(event);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to