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

Changeset 286724 in webkit


Ignore:
Timestamp:
Dec 8, 2021, 1:26:01 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r286483. rdar://problem/85928816

MomentumEventDispatcher curve sometimes doesn't match the system curve
https://bugs.webkit.org/show_bug.cgi?id=233801
<rdar://problem/85870287>

Reviewed by Simon Fraser.

Three small changes to get us closer to the system curve:

1) Fetch the momentum event dispatch interval from the system, and use
it to scale the momentum start event's delta (which we use as our
initial velocity) into the "ideal" curve's frame rate (which is always
60fps regardless).

2) Back-date the animation start time to the fingers-down phase end event,
so that the momentum start phase has a delta. This seems to match what
the system does.

3) Switch to MonotonicTime for the animation time, since it doesn't need
to be in the same timebase as events (which are oddly in WallTime), and
certainly should be monotonic.

  • Shared/ScrollingAccelerationCurve.cpp: (WebKit::ScrollingAccelerationCurve::ScrollingAccelerationCurve): (WebKit::ScrollingAccelerationCurve::interpolate): (WebKit::ScrollingAccelerationCurve::encode const): (WebKit::ScrollingAccelerationCurve::decode): (WebKit::operator<<):
  • Shared/ScrollingAccelerationCurve.h: (WebKit::ScrollingAccelerationCurve::frameRate): (WebKit::ScrollingAccelerationCurve::operator== const):
  • Shared/mac/ScrollingAccelerationCurveMac.mm: (WebKit::fromIOHIDCurve): (WebKit::fromIOHIDCurveArrayWithAcceleration): (WebKit::fromIOHIDDevice): Fetch and propagate the dispatch frame rate. This isn't *really* a ScrollingAccelerationCurve property, but neither is resolution; this is just currently the only place we look up HID properties and push them to the Web Content process; some re-architecture is warranted here in the future.
  • WebProcess/WebPage/MomentumEventDispatcher.cpp: (WebKit::MomentumEventDispatcher::handleWheelEvent): Keep track of the last fingers-down phase ended event timestamp.

(WebKit::MomentumEventDispatcher::didStartMomentumPhase):
Backdate the start time so that the first event has the appropriate delta.
Divide out the dispatch frame rate so that the initial velocity is
as if the curve were running at 60fps (since we *will* run it at 60fps and interpolate).

(WebKit::MomentumEventDispatcher::didEndMomentumPhase):
(WebKit::MomentumEventDispatcher::consumeDeltaForTime):
(WebKit::MomentumEventDispatcher::displayWasRefreshed):
Factor the consume-a-delta-from-the-ideal-curve code out from displayWasRefreshed
so we can use it in the start phase too.

(WebKit::MomentumEventDispatcher::offsetAtTime):
(WebKit::MomentumEventDispatcher::computeNextDelta):
Rename idealCurveFrameRate->idealCurveFrameInterval for accuracy.

  • WebProcess/WebPage/MomentumEventDispatcher.h:

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

Location:
branches/safari-612.4.2.1-branch/Source/WebKit
Files:
6 edited

Legend:

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

    r286723 r286724  
     12021-12-03  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r286483. rdar://problem/85928816
     4
     5    MomentumEventDispatcher curve sometimes doesn't match the system curve
     6    https://bugs.webkit.org/show_bug.cgi?id=233801
     7    <rdar://problem/85870287>
     8   
     9    Reviewed by Simon Fraser.
     10   
     11    Three small changes to get us closer to the system curve:
     12   
     13    1) Fetch the momentum event dispatch interval from the system, and use
     14    it to scale the momentum start event's delta (which we use as our
     15    initial velocity) into the "ideal" curve's frame rate (which is always
     16    60fps regardless).
     17   
     18    2) Back-date the animation start time to the fingers-down phase end event,
     19    so that the momentum start phase has a delta. This seems to match what
     20    the system does.
     21   
     22    3) Switch to MonotonicTime for the animation time, since it doesn't need
     23    to be in the same timebase as events (which are oddly in WallTime), and
     24    certainly should be monotonic.
     25   
     26    * Shared/ScrollingAccelerationCurve.cpp:
     27    (WebKit::ScrollingAccelerationCurve::ScrollingAccelerationCurve):
     28    (WebKit::ScrollingAccelerationCurve::interpolate):
     29    (WebKit::ScrollingAccelerationCurve::encode const):
     30    (WebKit::ScrollingAccelerationCurve::decode):
     31    (WebKit::operator<<):
     32    * Shared/ScrollingAccelerationCurve.h:
     33    (WebKit::ScrollingAccelerationCurve::frameRate):
     34    (WebKit::ScrollingAccelerationCurve::operator== const):
     35    * Shared/mac/ScrollingAccelerationCurveMac.mm:
     36    (WebKit::fromIOHIDCurve):
     37    (WebKit::fromIOHIDCurveArrayWithAcceleration):
     38    (WebKit::fromIOHIDDevice):
     39    Fetch and propagate the dispatch frame rate. This isn't *really* a
     40    ScrollingAccelerationCurve property, but neither is `resolution`;
     41    this is just currently the only place we look up HID properties
     42    and push them to the Web Content process; some re-architecture is
     43    warranted here in the future.
     44   
     45    * WebProcess/WebPage/MomentumEventDispatcher.cpp:
     46    (WebKit::MomentumEventDispatcher::handleWheelEvent):
     47    Keep track of the last fingers-down phase ended event timestamp.
     48   
     49    (WebKit::MomentumEventDispatcher::didStartMomentumPhase):
     50    Backdate the start time so that the first event has the appropriate delta.
     51    Divide out the dispatch frame rate so that the initial velocity is
     52    as if the curve were running at 60fps (since we *will* run it at 60fps and interpolate).
     53   
     54    (WebKit::MomentumEventDispatcher::didEndMomentumPhase):
     55    (WebKit::MomentumEventDispatcher::consumeDeltaForTime):
     56    (WebKit::MomentumEventDispatcher::displayWasRefreshed):
     57    Factor the consume-a-delta-from-the-ideal-curve code out from displayWasRefreshed
     58    so we can use it in the start phase too.
     59   
     60    (WebKit::MomentumEventDispatcher::offsetAtTime):
     61    (WebKit::MomentumEventDispatcher::computeNextDelta):
     62    Rename idealCurveFrameRate->idealCurveFrameInterval for accuracy.
     63   
     64    * WebProcess/WebPage/MomentumEventDispatcher.h:
     65   
     66   
     67    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     68
     69    2021-12-02  Tim Horton  <timothy_horton@apple.com>
     70
     71            MomentumEventDispatcher curve sometimes doesn't match the system curve
     72            https://bugs.webkit.org/show_bug.cgi?id=233801
     73            <rdar://problem/85870287>
     74
     75            Reviewed by Simon Fraser.
     76
     77            Three small changes to get us closer to the system curve:
     78
     79            1) Fetch the momentum event dispatch interval from the system, and use
     80            it to scale the momentum start event's delta (which we use as our
     81            initial velocity) into the "ideal" curve's frame rate (which is always
     82            60fps regardless).
     83
     84            2) Back-date the animation start time to the fingers-down phase end event,
     85            so that the momentum start phase has a delta. This seems to match what
     86            the system does.
     87
     88            3) Switch to MonotonicTime for the animation time, since it doesn't need
     89            to be in the same timebase as events (which are oddly in WallTime), and
     90            certainly should be monotonic.
     91
     92            * Shared/ScrollingAccelerationCurve.cpp:
     93            (WebKit::ScrollingAccelerationCurve::ScrollingAccelerationCurve):
     94            (WebKit::ScrollingAccelerationCurve::interpolate):
     95            (WebKit::ScrollingAccelerationCurve::encode const):
     96            (WebKit::ScrollingAccelerationCurve::decode):
     97            (WebKit::operator<<):
     98            * Shared/ScrollingAccelerationCurve.h:
     99            (WebKit::ScrollingAccelerationCurve::frameRate):
     100            (WebKit::ScrollingAccelerationCurve::operator== const):
     101            * Shared/mac/ScrollingAccelerationCurveMac.mm:
     102            (WebKit::fromIOHIDCurve):
     103            (WebKit::fromIOHIDCurveArrayWithAcceleration):
     104            (WebKit::fromIOHIDDevice):
     105            Fetch and propagate the dispatch frame rate. This isn't *really* a
     106            ScrollingAccelerationCurve property, but neither is `resolution`;
     107            this is just currently the only place we look up HID properties
     108            and push them to the Web Content process; some re-architecture is
     109            warranted here in the future.
     110
     111            * WebProcess/WebPage/MomentumEventDispatcher.cpp:
     112            (WebKit::MomentumEventDispatcher::handleWheelEvent):
     113            Keep track of the last fingers-down phase ended event timestamp.
     114
     115            (WebKit::MomentumEventDispatcher::didStartMomentumPhase):
     116            Backdate the start time so that the first event has the appropriate delta.
     117            Divide out the dispatch frame rate so that the initial velocity is
     118            as if the curve were running at 60fps (since we *will* run it at 60fps and interpolate).
     119
     120            (WebKit::MomentumEventDispatcher::didEndMomentumPhase):
     121            (WebKit::MomentumEventDispatcher::consumeDeltaForTime):
     122            (WebKit::MomentumEventDispatcher::displayWasRefreshed):
     123            Factor the consume-a-delta-from-the-ideal-curve code out from displayWasRefreshed
     124            so we can use it in the start phase too.
     125
     126            (WebKit::MomentumEventDispatcher::offsetAtTime):
     127            (WebKit::MomentumEventDispatcher::computeNextDelta):
     128            Rename idealCurveFrameRate->idealCurveFrameInterval for accuracy.
     129
     130            * WebProcess/WebPage/MomentumEventDispatcher.h:
     131
    11322021-12-03  Russell Epstein  <repstein@apple.com>
    2133
  • branches/safari-612.4.2.1-branch/Source/WebKit/Shared/ScrollingAccelerationCurve.cpp

    r286717 r286724  
    3535namespace WebKit {
    3636
    37 ScrollingAccelerationCurve::ScrollingAccelerationCurve(float gainLinear, float gainParabolic, float gainCubic, float gainQuartic, float tangentSpeedLinear, float tangentSpeedParabolicRoot, float resolution)
    38     : m_parameters { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, resolution }
     37ScrollingAccelerationCurve::ScrollingAccelerationCurve(float gainLinear, float gainParabolic, float gainCubic, float gainQuartic, float tangentSpeedLinear, float tangentSpeedParabolicRoot, float resolution, float frameRate)
     38    : m_parameters { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, resolution, frameRate }
    3939{
    4040}
     
    5454    auto tangentSpeedParabolicRoot = interpolate(from.m_parameters.tangentSpeedParabolicRoot, to.m_parameters.tangentSpeedParabolicRoot);
    5555
    56     return { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, from.m_parameters.resolution };
     56    return { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, from.m_parameters.resolution, from.m_parameters.frameRate };
    5757}
    5858
     
    128128
    129129    encoder << m_parameters.resolution;
     130    encoder << m_parameters.frameRate;
    130131}
    131132
     
    155156    if (!decoder.decode(resolution))
    156157        return std::nullopt;
     158    float frameRate;
     159    if (!decoder.decode(frameRate))
     160        return std::nullopt;
    157161
    158     return { { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, resolution } };
     162    return { { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, resolution, frameRate } };
    159163}
    160164
     
    172176    ts.dumpProperty("tangentSpeedParabolicRoot", curve.m_parameters.tangentSpeedParabolicRoot);
    173177    ts.dumpProperty("resolution", curve.m_parameters.resolution);
     178    ts.dumpProperty("frameRate", curve.m_parameters.frameRate);
    174179
    175180    return ts;
  • branches/safari-612.4.2.1-branch/Source/WebKit/Shared/ScrollingAccelerationCurve.h

    r286717 r286724  
    4242class ScrollingAccelerationCurve {
    4343public:
    44     ScrollingAccelerationCurve(float gainLinear, float gainParabolic, float gainCubic, float gainQuartic, float tangentSpeedLinear, float tangentSpeedParabolicRoot, float resolution);
     44    ScrollingAccelerationCurve(float gainLinear, float gainParabolic, float gainCubic, float gainQuartic, float tangentSpeedLinear, float tangentSpeedParabolicRoot, float resolution, float frameRate);
    4545
    4646    static std::optional<ScrollingAccelerationCurve> fromNativeWheelEvent(const NativeWebWheelEvent&);
     
    4949
    5050    float accelerationFactor(float);
     51    float frameRate() const { return m_parameters.frameRate; }
    5152
    5253    void encode(IPC::Encoder&) const;
     
    6162            && m_parameters.tangentSpeedLinear == other.m_parameters.tangentSpeedLinear
    6263            && m_parameters.tangentSpeedParabolicRoot == other.m_parameters.tangentSpeedParabolicRoot
    63             && m_parameters.resolution == other.m_parameters.resolution;
     64            && m_parameters.resolution == other.m_parameters.resolution
     65            && m_parameters.frameRate == other.m_parameters.frameRate;
    6466    }
    6567
     
    8082        float tangentSpeedLinear { 0 };
    8183        float tangentSpeedParabolicRoot { 0 };
     84
     85        // FIXME: Resolution and frame rate are not technically properties
     86        // of the curve, just required to use it; they should be plumbed separately.
    8287        float resolution { 0 };
     88        float frameRate { 0 };
    8389    } m_parameters;
    8490
  • branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/ScrollingAccelerationCurveMac.mm

    r286717 r286724  
    4040}
    4141
     42static float fromCFNumber(CFNumberRef number)
     43{
     44    float value;
     45    CFNumberGetValue(number, kCFNumberFloatType, &value);
     46    return value;
     47}
     48
    4249static float readFixedPointParameter(NSDictionary *parameters, const char *key)
    4350{
     
    4552}
    4653
    47 static ScrollingAccelerationCurve fromIOHIDCurve(NSDictionary *parameters, float resolution)
     54static ScrollingAccelerationCurve fromIOHIDCurve(NSDictionary *parameters, float resolution, float frameRate)
    4855{
    4956    auto gainLinear = readFixedPointParameter(parameters, kHIDAccelGainLinearKey);
     
    5562    auto tangentSpeedParabolicRoot = readFixedPointParameter(parameters, kHIDAccelTangentSpeedParabolicRootKey);
    5663
    57     return { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, resolution };
     64    return { gainLinear, gainParabolic, gainCubic, gainQuartic, tangentSpeedLinear, tangentSpeedParabolicRoot, resolution, frameRate };
    5865}
    5966
    60 static ScrollingAccelerationCurve fromIOHIDCurveArrayWithAcceleration(NSArray<NSDictionary *> *ioHIDCurves, float desiredAcceleration, float resolution)
     67static ScrollingAccelerationCurve fromIOHIDCurveArrayWithAcceleration(NSArray<NSDictionary *> *ioHIDCurves, float desiredAcceleration, float resolution, float frameRate)
    6168{
    6269    __block size_t currentIndex = 0;
     
    6572    [ioHIDCurves enumerateObjectsUsingBlock:^(NSDictionary *parameters, NSUInteger i, BOOL *) {
    6673        auto curveAcceleration = readFixedPointParameter(parameters, kHIDAccelIndexKey);
    67         auto curve = fromIOHIDCurve(parameters, resolution);
     74        auto curve = fromIOHIDCurve(parameters, resolution, frameRate);
    6875
    6976        if (desiredAcceleration > curveAcceleration)
     
    117124    }
    118125
    119     auto scrollAcceleration = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), scrollAccelerationType.get())));
    120     if (!scrollAcceleration) {
     126    auto scrollAccelerationCF = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), scrollAccelerationType.get())));
     127    if (!scrollAccelerationCF) {
    121128        RELEASE_LOG(ScrollAnimations, "ScrollingAccelerationCurve::fromIOHIDDevice failed to look up acceleration value");
    122129        return std::nullopt;
    123130    }
     131    auto scrollAcceleration = fromFixedPoint(fromCFNumber(scrollAccelerationCF.get()));
    124132
    125     auto resolution = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), CFSTR(kIOHIDScrollResolutionKey))));
    126     if (!resolution) {
     133    auto resolutionCF = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), CFSTR(kIOHIDScrollResolutionKey))));
     134    if (!resolutionCF) {
    127135        RELEASE_LOG(ScrollAnimations, "ScrollingAccelerationCurve::fromIOHIDDevice failed to look up resolution");
    128136        return std::nullopt;
    129137    }
     138    auto resolution = fromFixedPoint([(NSNumber *)resolutionCF.get() floatValue]);
    130139
    131     return fromIOHIDCurveArrayWithAcceleration((NSArray *)curves.get(), fromFixedPoint([(NSNumber *)scrollAcceleration.get() floatValue]), fromFixedPoint([(NSNumber *)resolution.get() floatValue]));
     140    static CFStringRef dispatchFrameRateKey = CFSTR("ScrollMomentumDispatchRate");
     141    static constexpr float defaultDispatchFrameRate = 60;
     142    auto frameRateCF = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), dispatchFrameRateKey)));
     143    float frameRate = frameRateCF ? fromCFNumber(frameRateCF.get()) : defaultDispatchFrameRate;
     144
     145    return fromIOHIDCurveArrayWithAcceleration((NSArray *)curves.get(), scrollAcceleration, resolution, frameRate);
    132146}
    133147
  • branches/safari-612.4.2.1-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp

    r286722 r286724  
    4040static constexpr Seconds deltaHistoryMaximumAge = 500_ms;
    4141static constexpr Seconds deltaHistoryMaximumInterval = 150_ms;
    42 static constexpr Seconds idealCurveFrameRate = 1_s / 60;
     42static constexpr float idealCurveFrameRate = 60;
     43static constexpr Seconds idealCurveFrameInterval = 1_s / idealCurveFrameRate;
    4344
    4445MomentumEventDispatcher::MomentumEventDispatcher(EventDispatcher& dispatcher)
     
    9697            m_lastActivePhaseDelta = *lastActivePhaseDelta;
    9798    }
     99
     100    if (event.phase() == WebWheelEvent::PhaseEnded)
     101        m_lastEndedEventTimestamp = event.ioHIDEventTimestamp();
    98102
    99103    if (eventShouldStartSyntheticMomentumPhase(pageIdentifier, event))
     
    160164void MomentumEventDispatcher::didStartMomentumPhase(WebCore::PageIdentifier pageIdentifier, const WebWheelEvent& event)
    161165{
     166    auto momentumStartInterval = event.ioHIDEventTimestamp() - m_lastEndedEventTimestamp;
     167
    162168    m_currentGesture.active = true;
    163169    m_currentGesture.pageIdentifier = pageIdentifier;
    164170    m_currentGesture.initiatingEvent = event;
    165171    m_currentGesture.currentOffset = { };
    166     m_currentGesture.startTime = WallTime::now();
     172    m_currentGesture.startTime = MonotonicTime::now() - momentumStartInterval;
    167173    m_currentGesture.accelerationCurve = [&] () -> std::optional<ScrollingAccelerationCurve> {
    168174        auto curveIterator = m_accelerationCurves.find(m_currentGesture.pageIdentifier);
     
    177183    // directly when the frame interval is within 20fps of idealCurveFrameRate;
    178184    // we should perhaps do the same.
    179     buildOffsetTableWithInitialDelta(*event.rawPlatformDelta());
    180 
    181     dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseBegan, { });
     185    float idealCurveMultiplier = m_currentGesture.accelerationCurve->frameRate() / idealCurveFrameRate;
     186    buildOffsetTableWithInitialDelta(*event.rawPlatformDelta() * idealCurveMultiplier);
     187
     188    dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseBegan, consumeDeltaForCurrentTime());
    182189}
    183190
     
    188195    dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseEnded, { });
    189196
    190     RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher saw momentum end phase with total offset %.1f %.1f, duration %f (event offset would have been %.1f %.1f)", m_currentGesture.currentOffset.width(), m_currentGesture.currentOffset.height(), (WallTime::now() - m_currentGesture.startTime).seconds(), m_currentGesture.accumulatedEventOffset.width(), m_currentGesture.accumulatedEventOffset.height());
     197    RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher saw momentum end phase with total offset %.1f %.1f, duration %f (event offset would have been %.1f %.1f)", m_currentGesture.currentOffset.width(), m_currentGesture.currentOffset.height(), (MonotonicTime::now() - m_currentGesture.startTime).seconds(), m_currentGesture.accumulatedEventOffset.width(), m_currentGesture.accumulatedEventOffset.height());
    191198
    192199    stopDisplayLink();
     
    252259}
    253260
    254 void MomentumEventDispatcher::displayWasRefreshed(WebCore::PlatformDisplayID displayID, const WebCore::DisplayUpdate&)
    255 {
    256     if (!m_currentGesture.active)
    257         return;
    258 
    259     if (displayID != this->displayID())
    260         return;
    261 
    262     auto animationTime = WallTime::now() - m_currentGesture.startTime;
     261WebCore::FloatSize MomentumEventDispatcher::consumeDeltaForCurrentTime()
     262{
     263    auto animationTime = MonotonicTime::now() - m_currentGesture.startTime;
    263264    auto desiredOffset = offsetAtTime(animationTime);
    264265
     
    270271#endif
    271272
    272     dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseChanged, -delta);
    273 
    274273    m_currentGesture.currentOffset += delta;
     274
     275    return -delta;
     276}
     277
     278void MomentumEventDispatcher::displayWasRefreshed(WebCore::PlatformDisplayID displayID, const WebCore::DisplayUpdate&)
     279{
     280    if (!m_currentGesture.active)
     281        return;
     282
     283    if (displayID != this->displayID())
     284        return;
     285
     286    dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseChanged, consumeDeltaForCurrentTime());
    275287}
    276288
     
    344356        return { };
    345357
    346     float fractionalFrameNumber = time.seconds() / idealCurveFrameRate.seconds();
     358    float fractionalFrameNumber = time.seconds() / idealCurveFrameInterval.seconds();
    347359    unsigned long lowerFrameNumber = std::min<unsigned long>(m_currentGesture.offsetTable.size() - 1, floor(fractionalFrameNumber));
    348360    unsigned long upperFrameNumber = std::min<unsigned long>(m_currentGesture.offsetTable.size() - 1, lowerFrameNumber + 1);
     
    380392    WebCore::FloatSize unacceleratedDelta = currentUnacceleratedDelta;
    381393
    382     float decayRate = momentumDecayRate(unacceleratedDelta, idealCurveFrameRate);
     394    float decayRate = momentumDecayRate(unacceleratedDelta, idealCurveFrameInterval);
    383395    unacceleratedDelta.scale(decayRate);
    384396
     
    404416
    405417    // The delta queue operates on pre-acceleration deltas, so insert the new event *before* accelerating.
    406     didReceiveScrollEventWithInterval(quantizedUnacceleratedDelta, idealCurveFrameRate);
     418    didReceiveScrollEventWithInterval(quantizedUnacceleratedDelta, idealCurveFrameInterval);
    407419
    408420    auto accelerateAxis = [&] (HistoricalDeltas& deltas, float value) {
  • branches/safari-612.4.2.1-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h

    r286722 r286724  
    4040#include <memory>
    4141#include <wtf/Deque.h>
     42#include <wtf/MonotonicTime.h>
    4243#include <wtf/Noncopyable.h>
    4344
     
    8182    void buildOffsetTableWithInitialDelta(WebCore::FloatSize);
    8283
     84    // Once consumed, this delta *must* be dispatched in an event.
     85    WebCore::FloatSize consumeDeltaForCurrentTime();
     86
    8387    WebCore::FloatSize offsetAtTime(Seconds);
    8488    std::pair<WebCore::FloatSize, WebCore::FloatSize> computeNextDelta(WebCore::FloatSize currentUnacceleratedDelta);
     
    97101
    98102    std::optional<WallTime> m_lastScrollTimestamp;
     103    WallTime m_lastEndedEventTimestamp;
    99104    std::optional<WebWheelEvent> m_lastIncomingEvent;
    100105    WebCore::RectEdges<bool> m_lastRubberBandableEdges;
     
    111116
    112117        WebCore::FloatSize currentOffset;
    113         WallTime startTime;
     118        MonotonicTime startTime;
    114119
    115120        Vector<WebCore::FloatSize> offsetTable;
Note: See TracChangeset for help on using the changeset viewer.