Title: [286999] trunk/Source/WebKit
- Revision
- 286999
- Author
- timothy_hor...@apple.com
- Date
- 2021-12-13 17:50:21 -0800 (Mon, 13 Dec 2021)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (286998 => 286999)
--- trunk/Source/WebKit/ChangeLog 2021-12-14 01:38:11 UTC (rev 286998)
+++ trunk/Source/WebKit/ChangeLog 2021-12-14 01:50:21 UTC (rev 286999)
@@ -1,3 +1,25 @@
+2021-12-13 Tim Horton <timothy_hor...@apple.com>
+
+ 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 J Pascoe <j_pas...@apple.com>
[WebAuthn] Allow same-site, cross-origin iframe get()
Modified: trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp (286998 => 286999)
--- trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp 2021-12-14 01:38:11 UTC (rev 286998)
+++ trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp 2021-12-14 01:50:21 UTC (rev 286999)
@@ -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: trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h (286998 => 286999)
--- trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h 2021-12-14 01:38:11 UTC (rev 286998)
+++ trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h 2021-12-14 01:50:21 UTC (rev 286999)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes