Title: [240789] trunk/Source/WebCore
Revision
240789
Author
[email protected]
Date
2019-01-31 08:52:22 -0800 (Thu, 31 Jan 2019)

Log Message

[GTK] Momentum scrolling stops abruptly before websites end
https://bugs.webkit.org/show_bug.cgi?id=193350

Patch by Alexander Mikhaylenko <[email protected]> on 2019-01-31
Reviewed by Carlos Garcia Campos.

Don't immediately set velocity to 0 when position reaches upper or bottom limit.
Instead, set it to the overshot distance, so that position exactly matches upper
or lower limit on the next frame, and then clamp velocity to 0 using the existing
mechanism.

* platform/ScrollAnimationKinetic.cpp:
(WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240788 => 240789)


--- trunk/Source/WebCore/ChangeLog	2019-01-31 16:37:41 UTC (rev 240788)
+++ trunk/Source/WebCore/ChangeLog	2019-01-31 16:52:22 UTC (rev 240789)
@@ -1,3 +1,18 @@
+2019-01-31  Alexander Mikhaylenko  <[email protected]>
+
+        [GTK] Momentum scrolling stops abruptly before websites end
+        https://bugs.webkit.org/show_bug.cgi?id=193350
+
+        Reviewed by Carlos Garcia Campos.
+
+        Don't immediately set velocity to 0 when position reaches upper or bottom limit.
+        Instead, set it to the overshot distance, so that position exactly matches upper
+        or lower limit on the next frame, and then clamp velocity to 0 using the existing
+        mechanism.
+
+        * platform/ScrollAnimationKinetic.cpp:
+        (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
+
 2019-01-31  Michael Catanzaro  <[email protected]>
 
         Unreviewed, fix incorrect string format

Modified: trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp (240788 => 240789)


--- trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp	2019-01-31 16:37:41 UTC (rev 240788)
+++ trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp	2019-01-31 16:52:22 UTC (rev 240789)
@@ -89,12 +89,14 @@
     m_velocity = -decelFriction * m_coef2 * exponentialPart;
 
     if (m_position < m_lower) {
+        m_velocity = m_lower - m_position;
         m_position = m_lower;
-        m_velocity = 0;
     } else if (m_position > m_upper) {
+        m_velocity = m_upper - m_position;
         m_position = m_upper;
-        m_velocity = 0;
-    } else if (fabs(m_velocity) < 1 || (lastTime && fabs(m_position - lastPosition) < 1)) {
+    }
+
+    if (fabs(m_velocity) < 1 || (lastTime && fabs(m_position - lastPosition) < 1)) {
         m_position = round(m_position);
         m_velocity = 0;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to