⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286999 in webkit


Ignore:
Timestamp:
Dec 13, 2021, 5:50:21 PM (5 years ago)
Author:
timothy_horton@apple.com
Message:

Momentum Event Dispatcher: Excessive "kick" at the beginning of scrolling (especially on 60fps displays)
https://bugs.webkit.org/show_bug.cgi?id=234279
<rdar://problem/86425321>

Reviewed by Simon Fraser.

  • WebProcess/WebPage/MomentumEventDispatcher.cpp:

(WebKit::MomentumEventDispatcher::handleWheelEvent):
(WebKit::MomentumEventDispatcher::didStartMomentumPhase):
Instead of back-dating the animation to try to acquire a momentum-start
delta, pass the one we got from the event through, and start the animation
curve at momentum-start time. Also, critically, inset ourselves along
the curve by the amount of that initial delta (since the time starts now).

Tested at both 60fps and 120fps, this significantly smooths out the
transition from fingers-down phase to the generated momentum phase,
avoiding the overly large initial delta.

  • WebProcess/WebPage/MomentumEventDispatcher.h:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r286993 r286999  
     12021-12-13  Tim Horton  <timothy_horton@apple.com>
     2
     3        Momentum Event Dispatcher: Excessive "kick" at the beginning of scrolling (especially on 60fps displays)
     4        https://bugs.webkit.org/show_bug.cgi?id=234279
     5        <rdar://problem/86425321>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * WebProcess/WebPage/MomentumEventDispatcher.cpp:
     10        (WebKit::MomentumEventDispatcher::handleWheelEvent):
     11        (WebKit::MomentumEventDispatcher::didStartMomentumPhase):
     12        Instead of back-dating the animation to try to acquire a momentum-start
     13        delta, pass the one we got from the event through, and start the animation
     14        curve at momentum-start time. Also, critically, inset ourselves along
     15        the curve by the amount of that initial delta (since the time starts now).
     16
     17        Tested at both 60fps and 120fps, this significantly smooths out the
     18        transition from fingers-down phase to the generated momentum phase,
     19        avoiding the overly large initial delta.
     20
     21        * WebProcess/WebPage/MomentumEventDispatcher.h:
     22
    1232021-12-13  J Pascoe  <j_pascoe@apple.com>
    224
  • trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp

    r286919 r286999  
    101101    }
    102102
    103     if (event.phase() == WebWheelEvent::PhaseEnded)
    104         m_lastEndedEventTimestamp = event.ioHIDEventTimestamp();
    105 
    106103    if (eventShouldStartSyntheticMomentumPhase(pageIdentifier, event))
    107104        didStartMomentumPhase(pageIdentifier, event);
     
    191188    tracePoint(SyntheticMomentumStart);
    192189
    193     auto momentumStartInterval = event.ioHIDEventTimestamp() - m_lastEndedEventTimestamp;
    194 
    195190    m_currentGesture.active = true;
    196191    m_currentGesture.pageIdentifier = pageIdentifier;
    197192    m_currentGesture.initiatingEvent = event;
    198193    m_currentGesture.currentOffset = { };
    199     m_currentGesture.startTime = MonotonicTime::now() - momentumStartInterval;
     194    m_currentGesture.startTime = MonotonicTime::now();
    200195    m_currentGesture.displayNominalFrameRate = displayProperties->nominalFrameRate;
    201196    m_currentGesture.accelerationCurve = [&] () -> std::optional<ScrollingAccelerationCurve> {
     
    214209    buildOffsetTableWithInitialDelta(*event.rawPlatformDelta() * idealCurveMultiplier);
    215210
    216     dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseBegan, consumeDeltaForCurrentTime());
     211    WebCore::FloatSize consumedDelta = event.delta();
     212    if (m_currentGesture.initiatingEvent->directionInvertedFromDevice())
     213        consumedDelta.scale(-1);
     214    m_currentGesture.currentOffset += consumedDelta;
     215   
     216    dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseBegan, event.delta());
    217217}
    218218
  • trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h

    r286919 r286999  
    124124
    125125    std::optional<WallTime> m_lastScrollTimestamp;
    126     WallTime m_lastEndedEventTimestamp;
    127126    std::optional<WebWheelEvent> m_lastIncomingEvent;
    128127    WebCore::RectEdges<bool> m_lastRubberBandableEdges;
Note: See TracChangeset for help on using the changeset viewer.