Title: [286805] trunk/Source/WebKit
Revision
286805
Author
timothy_hor...@apple.com
Date
2021-12-09 15:01:05 -0800 (Thu, 09 Dec 2021)

Log Message

Momentum Generator: Scroll tail hiccup only when scrolling up on 60Hz displays
https://bugs.webkit.org/show_bug.cgi?id=234104
<rdar://problem/86291413>

Reviewed by Simon Fraser.

* WebProcess/WebPage/MomentumEventDispatcher.cpp:
(WebKit::MomentumEventDispatcher::equalizeTailGaps):
Sort in the correct direction based on the sign of the first delta...

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286804 => 286805)


--- trunk/Source/WebKit/ChangeLog	2021-12-09 22:56:06 UTC (rev 286804)
+++ trunk/Source/WebKit/ChangeLog	2021-12-09 23:01:05 UTC (rev 286805)
@@ -1,3 +1,15 @@
+2021-12-09  Tim Horton  <timothy_hor...@apple.com>
+
+        Momentum Generator: Scroll tail hiccup only when scrolling up on 60Hz displays
+        https://bugs.webkit.org/show_bug.cgi?id=234104
+        <rdar://problem/86291413>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/MomentumEventDispatcher.cpp:
+        (WebKit::MomentumEventDispatcher::equalizeTailGaps):
+        Sort in the correct direction based on the sign of the first delta...
+
 2021-12-09  Chris Dumez  <cdu...@apple.com>
 
         [WPE] Crash under WebProcessProxy::setIsInProcessCache when closing web view in debug builds

Modified: trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp (286804 => 286805)


--- trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp	2021-12-09 22:56:06 UTC (rev 286804)
+++ trunk/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp	2021-12-09 23:01:05 UTC (rev 286805)
@@ -414,6 +414,8 @@
 
     auto& table = m_currentGesture.tailDeltaTable;
     size_t initialTableSize = table.size();
+    if (!initialTableSize)
+        return;
 
     enum Axis { Horizontal, Vertical };
     Vector<float> deltas[2];
@@ -429,12 +431,20 @@
         if (!firstZeroIndex[Vertical] && !table[i].height())
             firstZeroIndex[Vertical] = i;
     }
-    
-    if (auto index = firstZeroIndex[Horizontal])
-        std::sort(deltas[Horizontal].begin(), std::next(deltas[Horizontal].begin(), index));
-    if (auto index = firstZeroIndex[Vertical])
-        std::sort(deltas[Vertical].begin(), std::next(deltas[Vertical].begin(), index));
 
+    auto sortDeltas = [&] (Axis axis) {
+        if (!firstZeroIndex[axis])
+            return;
+
+        if (deltas[axis][0] > 0)
+            std::sort(deltas[axis].begin(), std::next(deltas[axis].begin(), firstZeroIndex[axis]), std::greater<float>());
+        else
+            std::sort(deltas[axis].begin(), std::next(deltas[axis].begin(), firstZeroIndex[axis]), std::less<float>());
+    };
+
+    sortDeltas(Horizontal);
+    sortDeltas(Vertical);
+
     // GapSize is a count of contiguous frames with zero deltas.
     typedef unsigned GapSize[2];
     GapSize minimumGap = { 0, 0 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to