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

Changeset 287031 in webkit


Ignore:
Timestamp:
Dec 14, 2021, 10:30:27 AM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r286999. rdar://problem/86425321

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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286999 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612-branch/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612-branch/Source/WebKit/ChangeLog

    r286991 r287031  
     12021-12-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r286999. rdar://problem/86425321
     4
     5    Momentum Event Dispatcher: Excessive "kick" at the beginning of scrolling (especially on 60fps displays)
     6    https://bugs.webkit.org/show_bug.cgi?id=234279
     7    <rdar://problem/86425321>
     8   
     9    Reviewed by Simon Fraser.
     10   
     11    * WebProcess/WebPage/MomentumEventDispatcher.cpp:
     12    (WebKit::MomentumEventDispatcher::handleWheelEvent):
     13    (WebKit::MomentumEventDispatcher::didStartMomentumPhase):
     14    Instead of back-dating the animation to try to acquire a momentum-start
     15    delta, pass the one we got from the event through, and start the animation
     16    curve at momentum-start time. Also, critically, inset ourselves along
     17    the curve by the amount of that initial delta (since the time starts now).
     18   
     19    Tested at both 60fps and 120fps, this significantly smooths out the
     20    transition from fingers-down phase to the generated momentum phase,
     21    avoiding the overly large initial delta.
     22   
     23    * WebProcess/WebPage/MomentumEventDispatcher.h:
     24   
     25   
     26    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286999 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     27
     28    2021-12-13  Tim Horton  <timothy_horton@apple.com>
     29
     30            Momentum Event Dispatcher: Excessive "kick" at the beginning of scrolling (especially on 60fps displays)
     31            https://bugs.webkit.org/show_bug.cgi?id=234279
     32            <rdar://problem/86425321>
     33
     34            Reviewed by Simon Fraser.
     35
     36            * WebProcess/WebPage/MomentumEventDispatcher.cpp:
     37            (WebKit::MomentumEventDispatcher::handleWheelEvent):
     38            (WebKit::MomentumEventDispatcher::didStartMomentumPhase):
     39            Instead of back-dating the animation to try to acquire a momentum-start
     40            delta, pass the one we got from the event through, and start the animation
     41            curve at momentum-start time. Also, critically, inset ourselves along
     42            the curve by the amount of that initial delta (since the time starts now).
     43
     44            Tested at both 60fps and 120fps, this significantly smooths out the
     45            transition from fingers-down phase to the generated momentum phase,
     46            avoiding the overly large initial delta.
     47
     48            * WebProcess/WebPage/MomentumEventDispatcher.h:
     49
    1502021-12-13  Alan Coon  <alancoon@apple.com>
    251
  • branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp

    r286991 r287031  
    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
  • branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h

    r286991 r287031  
    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.