Title: [220638] trunk/Source/WebCore
Revision
220638
Author
[email protected]
Date
2017-08-13 23:23:27 -0700 (Sun, 13 Aug 2017)

Log Message

[GTK] stop kinetic scrolling when a zero movement is reached
https://bugs.webkit.org/show_bug.cgi?id=175468

Reviewed by Michael Catanzaro.

This is GTK+ change by Christian Hergert.
https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=4f63d839550f7a9038b391e7d3e1e6fc8bdfafa6

When the kinetic scrolling reduces its speed, there can be multiple frames where the movement is zero pixels,
followed by a 1 pixel movement later on. This causes a "jitter" right at the end of the scroll which makes it
feel less quality than other platforms. Instead, we should just clamp it as soon as we get a zero movement.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220637 => 220638)


--- trunk/Source/WebCore/ChangeLog	2017-08-14 06:06:35 UTC (rev 220637)
+++ trunk/Source/WebCore/ChangeLog	2017-08-14 06:23:27 UTC (rev 220638)
@@ -1,3 +1,20 @@
+2017-08-13  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] stop kinetic scrolling when a zero movement is reached
+        https://bugs.webkit.org/show_bug.cgi?id=175468
+
+        Reviewed by Michael Catanzaro.
+
+        This is GTK+ change by Christian Hergert.
+        https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=4f63d839550f7a9038b391e7d3e1e6fc8bdfafa6
+
+        When the kinetic scrolling reduces its speed, there can be multiple frames where the movement is zero pixels,
+        followed by a 1 pixel movement later on. This causes a "jitter" right at the end of the scroll which makes it
+        feel less quality than other platforms. Instead, we should just clamp it as soon as we get a zero movement.
+
+        * platform/ScrollAnimationKinetic.cpp:
+        (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
+
 2017-08-13  Chris Dumez  <[email protected]>
 
         Drop non-const getter for CachedResource::resourceRequest()

Modified: trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp (220637 => 220638)


--- trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp	2017-08-14 06:06:35 UTC (rev 220637)
+++ trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp	2017-08-14 06:23:27 UTC (rev 220638)
@@ -81,6 +81,8 @@
 
 bool ScrollAnimationKinetic::PerAxisData::animateScroll(Seconds timeDelta)
 {
+    auto lastPosition = m_position;
+    auto lastTime = m_elapsedTime;
     m_elapsedTime += timeDelta;
 
     double exponentialPart = exp(-decelFriction * m_elapsedTime.value());
@@ -93,7 +95,7 @@
     } else if (m_position > m_upper) {
         m_position = m_upper;
         m_velocity = 0;
-    } else if (fabs(m_velocity) < 1) {
+    } else 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