Changeset 244649 in webkit


Ignore:
Timestamp:
Apr 25, 2019 9:59:04 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Alexander Mikhaylenko <exalm7659@gmail.com> 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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244648 r244649  
     12019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
     2
     3        [GTK] Back/Forward gesture interferes with scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=197168
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        When the gesture is released with 0 velocity close to an edge of the webview,
     9        the finishing animation is way too long, and in some cases it can look like the
     10        gesture is already over, when it's still animating. By scrolling vertically while
     11        that happens, it's possible to reset animation over and over again.
     12
     13        To reduce the duration in this case, instead of using maximum possible duration
     14        (400ms), introduce a base velocity and use it for calculating the duration if
     15        the actual velocity, relative to the end point, is equal to or less than 0.
     16
     17        * UIProcess/gtk/ViewGestureControllerGtk.cpp:
     18        (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
     19
    1202019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
    221
  • trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp

    r241952 r244649  
    3535static const Seconds swipeMinAnimationDuration = 100_ms;
    3636static const Seconds swipeMaxAnimationDuration = 400_ms;
     37static const double swipeAnimationBaseVelocity = 0.002;
    3738
    3839// This is derivative of the easing function at t=0
     
    214215        m_endProgress = m_viewGestureController.isPhysicallySwipingLeft(m_direction) ? 1 : -1;
    215216
    216     Seconds duration = swipeMaxAnimationDuration;
    217     if ((m_endProgress - m_progress) * m_velocity > 0) {
    218         duration = Seconds::fromMilliseconds(std::abs((m_progress - m_endProgress) / m_velocity * swipeAnimationDurationMultiplier));
    219         duration = clampTo<WTF::Seconds>(duration, swipeMinAnimationDuration, swipeMaxAnimationDuration);
    220     }
     217    double velocity = swipeAnimationBaseVelocity;
     218    if ((m_endProgress - m_progress) * m_velocity > 0)
     219        velocity = m_velocity;
     220
     221    Seconds duration = Seconds::fromMilliseconds(std::abs((m_progress - m_endProgress) / velocity * swipeAnimationDurationMultiplier));
     222    duration = clampTo<Seconds>(duration, swipeMinAnimationDuration, swipeMaxAnimationDuration);
    221223
    222224    GtkWidget* widget = m_webPageProxy.viewWidget();
Note: See TracChangeset for help on using the changeset viewer.