Title: [244649] trunk/Source/WebKit
Revision
244649
Author
[email protected]
Date
2019-04-25 09:59:04 -0700 (Thu, 25 Apr 2019)

Log Message

[GTK] Back/Forward gesture interferes with scrolling
https://bugs.webkit.org/show_bug.cgi?id=197168

Patch by Alexander Mikhaylenko <[email protected]> on 2019-04-25
Reviewed by Michael Catanzaro.

When the gesture is released with 0 velocity close to an edge of the webview,
the finishing animation is way too long, and in some cases it can look like the
gesture is already over, when it's still animating. By scrolling vertically while
that happens, it's possible to reset animation over and over again.

To reduce the duration in this case, instead of using maximum possible duration
(400ms), introduce a base velocity and use it for calculating the duration if
the actual velocity, relative to the end point, is equal to or less than 0.

* UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244648 => 244649)


--- trunk/Source/WebKit/ChangeLog	2019-04-25 16:58:09 UTC (rev 244648)
+++ trunk/Source/WebKit/ChangeLog	2019-04-25 16:59:04 UTC (rev 244649)
@@ -1,5 +1,24 @@
 2019-04-25  Alexander Mikhaylenko  <[email protected]>
 
+        [GTK] Back/Forward gesture interferes with scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=197168
+
+        Reviewed by Michael Catanzaro.
+
+        When the gesture is released with 0 velocity close to an edge of the webview,
+        the finishing animation is way too long, and in some cases it can look like the
+        gesture is already over, when it's still animating. By scrolling vertically while
+        that happens, it's possible to reset animation over and over again.
+
+        To reduce the duration in this case, instead of using maximum possible duration
+        (400ms), introduce a base velocity and use it for calculating the duration if
+        the actual velocity, relative to the end point, is equal to or less than 0.
+
+        * UIProcess/gtk/ViewGestureControllerGtk.cpp:
+        (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
+
+2019-04-25  Alexander Mikhaylenko  <[email protected]>
+
         [GTK] Back/forward gesture snapshot always times out
         https://bugs.webkit.org/show_bug.cgi?id=197233
 

Modified: trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp (244648 => 244649)


--- trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp	2019-04-25 16:58:09 UTC (rev 244648)
+++ trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp	2019-04-25 16:59:04 UTC (rev 244649)
@@ -34,6 +34,7 @@
 
 static const Seconds swipeMinAnimationDuration = 100_ms;
 static const Seconds swipeMaxAnimationDuration = 400_ms;
+static const double swipeAnimationBaseVelocity = 0.002;
 
 // This is derivative of the easing function at t=0
 static const double swipeAnimationDurationMultiplier = 3;
@@ -213,12 +214,13 @@
     else
         m_endProgress = m_viewGestureController.isPhysicallySwipingLeft(m_direction) ? 1 : -1;
 
-    Seconds duration = swipeMaxAnimationDuration;
-    if ((m_endProgress - m_progress) * m_velocity > 0) {
-        duration = Seconds::fromMilliseconds(std::abs((m_progress - m_endProgress) / m_velocity * swipeAnimationDurationMultiplier));
-        duration = clampTo<WTF::Seconds>(duration, swipeMinAnimationDuration, swipeMaxAnimationDuration);
-    }
+    double velocity = swipeAnimationBaseVelocity;
+    if ((m_endProgress - m_progress) * m_velocity > 0)
+        velocity = m_velocity;
 
+    Seconds duration = Seconds::fromMilliseconds(std::abs((m_progress - m_endProgress) / velocity * swipeAnimationDurationMultiplier));
+    duration = clampTo<Seconds>(duration, swipeMinAnimationDuration, swipeMaxAnimationDuration);
+
     GtkWidget* widget = m_webPageProxy.viewWidget();
     m_startTime = Seconds::fromMicroseconds(gdk_frame_clock_get_frame_time(gtk_widget_get_frame_clock(widget)));
     m_endTime = m_startTime + duration;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to