Title: [287031] branches/safari-612-branch/Source/WebKit
Revision
287031
Author
[email protected]
Date
2021-12-14 10:30:27 -0800 (Tue, 14 Dec 2021)

Log 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

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (287030 => 287031)


--- branches/safari-612-branch/Source/WebKit/ChangeLog	2021-12-14 18:20:24 UTC (rev 287030)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog	2021-12-14 18:30:27 UTC (rev 287031)
@@ -1,3 +1,52 @@
+2021-12-14  Alan Coon  <[email protected]>
+
+        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
+
+    2021-12-13  Tim Horton  <[email protected]>
+
+            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:
+
 2021-12-13  Alan Coon  <[email protected]>
 
         Cherry-pick r286919. rdar://problem/86247557

Modified: branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp (287030 => 287031)


--- branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp	2021-12-14 18:20:24 UTC (rev 287030)
+++ branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp	2021-12-14 18:30:27 UTC (rev 287031)
@@ -100,9 +100,6 @@
 #endif
     }
 
-    if (event.phase() == WebWheelEvent::PhaseEnded)
-        m_lastEndedEventTimestamp = event.ioHIDEventTimestamp();
-
     if (eventShouldStartSyntheticMomentumPhase(pageIdentifier, event))
         didStartMomentumPhase(pageIdentifier, event);
 
@@ -190,13 +187,11 @@
 
     tracePoint(SyntheticMomentumStart);
 
-    auto momentumStartInterval = event.ioHIDEventTimestamp() - m_lastEndedEventTimestamp;
-
     m_currentGesture.active = true;
     m_currentGesture.pageIdentifier = pageIdentifier;
     m_currentGesture.initiatingEvent = event;
     m_currentGesture.currentOffset = { };
-    m_currentGesture.startTime = MonotonicTime::now() - momentumStartInterval;
+    m_currentGesture.startTime = MonotonicTime::now();
     m_currentGesture.displayNominalFrameRate = displayProperties->nominalFrameRate;
     m_currentGesture.accelerationCurve = [&] () -> std::optional<ScrollingAccelerationCurve> {
         auto curveIterator = m_accelerationCurves.find(m_currentGesture.pageIdentifier);
@@ -213,7 +208,12 @@
     float idealCurveMultiplier = m_currentGesture.accelerationCurve->frameRate() / idealCurveFrameRate;
     buildOffsetTableWithInitialDelta(*event.rawPlatformDelta() * idealCurveMultiplier);
 
-    dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseBegan, consumeDeltaForCurrentTime());
+    WebCore::FloatSize consumedDelta = event.delta();
+    if (m_currentGesture.initiatingEvent->directionInvertedFromDevice())
+        consumedDelta.scale(-1);
+    m_currentGesture.currentOffset += consumedDelta;
+    
+    dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseBegan, event.delta());
 }
 
 void MomentumEventDispatcher::didEndMomentumPhase()

Modified: branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h (287030 => 287031)


--- branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h	2021-12-14 18:20:24 UTC (rev 287030)
+++ branches/safari-612-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h	2021-12-14 18:30:27 UTC (rev 287031)
@@ -123,7 +123,6 @@
     HistoricalDeltas m_deltaHistoryY;
 
     std::optional<WallTime> m_lastScrollTimestamp;
-    WallTime m_lastEndedEventTimestamp;
     std::optional<WebWheelEvent> m_lastIncomingEvent;
     WebCore::RectEdges<bool> m_lastRubberBandableEdges;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to