Title: [287151] branches/safari-612-branch/Source/WebCore

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (287150 => 287151)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-12-16 20:40:45 UTC (rev 287150)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-12-16 20:41:57 UTC (rev 287151)
@@ -1,3 +1,27 @@
+2021-12-16  Alan Coon  <[email protected]>
+
+        Apply patch. rdar://problem/86505382
+
+    2021-12-16  Simon Fraser  <[email protected]>
+
+            rdar://86505382 ([root] StarE21E179 / J314c : Slight but noticeable J-shaped "wobble" at tail end of sm-med scrolls)
+
+            Branch patch reviewed by Tim Horton. 
+
+            During momentum scrolling, we axis-lock on a per-event basis by zeroing out the smaller
+            of the X and Y deltas. This is a problem for slightly diagonal scrolls, where, towards
+            the tail, in a Y-biased scroll we can get individual events whose X delta is later than
+            their Y delta.
+
+            To fix this, use the same axis locking for all the events in a gesture, based on the
+            scrollingVelocity() of the last fingers-down event. This velocity is not strictly
+            X- or Y-locked; it can contain both X and Y deltas for strongly diagonal gestures,
+            but that's what we want.
+
+            * platform/ScrollController.h:
+            * platform/mac/ScrollController.mm:
+            (WebCore::ScrollController::handleWheelEvent):
+
 2021-12-13  Alan Coon  <[email protected]>
 
         Cherry-pick r286907. rdar://problem/86307593

Modified: branches/safari-612-branch/Source/WebCore/platform/ScrollController.h (287150 => 287151)


--- branches/safari-612-branch/Source/WebCore/platform/ScrollController.h	2021-12-16 20:40:45 UTC (rev 287150)
+++ branches/safari-612-branch/Source/WebCore/platform/ScrollController.h	2021-12-16 20:41:57 UTC (rev 287151)
@@ -217,6 +217,7 @@
     FloatSize m_overflowScrollDelta;
     FloatSize m_stretchScrollForce;
     FloatSize m_momentumVelocity;
+    FloatSize m_lastActivePhaseVelocity;
 
     bool m_inScrollGesture { false };
     bool m_momentumScrollInProgress { false };

Modified: branches/safari-612-branch/Source/WebCore/platform/mac/ScrollController.mm (287150 => 287151)


--- branches/safari-612-branch/Source/WebCore/platform/mac/ScrollController.mm	2021-12-16 20:40:45 UTC (rev 287150)
+++ branches/safari-612-branch/Source/WebCore/platform/mac/ScrollController.mm	2021-12-16 20:41:57 UTC (rev 287151)
@@ -125,6 +125,9 @@
         return true;
     }
 
+    if (wheelEvent.phase() == PlatformWheelEventPhase::Changed)
+        m_lastActivePhaseVelocity = -wheelEvent.scrollingVelocity();
+
     bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhase::None);
     if (m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_isAnimatingRubberBand)) {
         if (wheelEvent.momentumPhase() == PlatformWheelEventPhase::Ended) {
@@ -162,21 +165,28 @@
     deltaX += eventCoalescedDeltaX;
     deltaY += eventCoalescedDeltaY;
 
+    auto momentumPhase = wheelEvent.momentumPhase();
+    // If we are starting momentum scrolling then do some setup.
+    if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhase::Began || momentumPhase == PlatformWheelEventPhase::Changed))
+        m_momentumScrollInProgress = true;
+
     // Slightly prefer scrolling vertically by applying the = case to deltaY
     // FIXME: Use wheelDeltaBiasingTowardsVertical().
-    if (fabsf(deltaY) >= fabsf(deltaX))
-        deltaX = 0;
-    else
-        deltaY = 0;
+    if (m_momentumScrollInProgress) {
+        // Use the same axis locking for the duration of a momentum scroll.
+        if (!m_lastActivePhaseVelocity.width())
+            deltaX = 0;
+        else if (!m_lastActivePhaseVelocity.height())
+            deltaY = 0;
+    } else {
+        if (fabsf(deltaY) >= fabsf(deltaX))
+            deltaX = 0;
+        else
+            deltaY = 0;
+    }
 
     bool shouldStretch = false;
 
-    PlatformWheelEventPhase momentumPhase = wheelEvent.momentumPhase();
-
-    // If we are starting momentum scrolling then do some setup.
-    if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhase::Began || momentumPhase == PlatformWheelEventPhase::Changed))
-        m_momentumScrollInProgress = true;
-
     auto timeDelta = wheelEvent.timestamp() - m_lastMomentumScrollTimestamp;
     if (m_inScrollGesture || m_momentumScrollInProgress) {
         if (m_lastMomentumScrollTimestamp && timeDelta > 0_s && timeDelta < scrollVelocityZeroingTimeout) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to