Diff
Modified: branches/safari-613.1.9.0-branch/LayoutTests/ChangeLog (285941 => 285942)
--- branches/safari-613.1.9.0-branch/LayoutTests/ChangeLog 2021-11-17 19:14:31 UTC (rev 285941)
+++ branches/safari-613.1.9.0-branch/LayoutTests/ChangeLog 2021-11-17 19:14:37 UTC (rev 285942)
@@ -1,3 +1,50 @@
+2021-11-17 Alan Coon <[email protected]>
+
+ Cherry-pick r285797. rdar://problem/85512520
+
+ Fingers down on the trackpad should stop an animated scroll
+ https://bugs.webkit.org/show_bug.cgi?id=233114
+
+ Reviewed by Wenson Hsieh.
+ Source/WebCore:
+
+ Fingers down on the trackpad sends a "MayBegin" event; this needs to stop any in-progress
+ animated momentum scroll.
+
+ This failed because ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent() early-returned
+ on the MayBegin event before it got to ScrollingEffectsController. Fix that, and have
+ ScrollingEffectsController::handleWheelEvent() return true to say it was handled.
+
+ This triggered an assertion in ScrollingTreeGestureState, but for "post-main-thread"
+ handling for which the assertion was wrong.
+
+ Test: fast/scrolling/mac/momentum-animator-maybegin-stops.html
+
+ * page/scrolling/ScrollingTreeGestureState.cpp:
+ (WebCore::ScrollingTreeGestureState::nodeDidHandleEvent):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
+ * platform/mac/ScrollingEffectsController.mm:
+ (WebCore::ScrollingEffectsController::handleWheelEvent):
+
+ LayoutTests:
+
+ * fast/scrolling/mac/momentum-animator-maybegin-stops-expected.txt: Added.
+ * fast/scrolling/mac/momentum-animator-maybegin-stops.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-11-14 Simon Fraser <[email protected]>
+
+ Fingers down on the trackpad should stop an animated scroll
+ https://bugs.webkit.org/show_bug.cgi?id=233114
+
+ Reviewed by Wenson Hsieh.
+
+ * fast/scrolling/mac/momentum-animator-maybegin-stops-expected.txt: Added.
+ * fast/scrolling/mac/momentum-animator-maybegin-stops.html: Added.
+
2021-11-13 Simon Fraser <[email protected]>
Run a ScrollAnimationMomentum for the momentum phase of a scroll
Added: branches/safari-613.1.9.0-branch/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops-expected.txt (0 => 285942)
--- branches/safari-613.1.9.0-branch/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops-expected.txt (rev 0)
+++ branches/safari-613.1.9.0-branch/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops-expected.txt 2021-11-17 19:14:37 UTC (rev 285942)
@@ -0,0 +1,7 @@
+Momentum event reached main thread
+PASS scrollEventCount > 0 is true
+PASS scrollEventCount is scrollEventCountAtMayBegin
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-613.1.9.0-branch/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops.html (0 => 285942)
--- branches/safari-613.1.9.0-branch/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops.html (rev 0)
+++ branches/safari-613.1.9.0-branch/LayoutTests/fast/scrolling/mac/momentum-animator-maybegin-stops.html 2021-11-17 19:14:37 UTC (rev 285942)
@@ -0,0 +1,119 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ MomentumScrollingAnimatorEnabled=true ] -->
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ width: 200%;
+ }
+ </style>
+ <script src=""
+ <script src=""
+ <script>
+ var jsTestIsAsync = true;
+
+ let sawMomentumEvent = false;
+ let sawFingersDown = false;
+ let scrollEventCount = 0;
+ let scrollEventCountAtMayBegin = 0;
+
+ async function testEventSequence()
+ {
+ const events = [
+ {
+ type : "wheel",
+ viewX : 100,
+ viewY : 100,
+ deltaY : -10, // Note that this delta is currently ignored.
+ phase : "began"
+ },
+ {
+ type : "wheel",
+ deltaY : -50,
+ phase : "changed"
+ },
+ {
+ type : "wheel",
+ phase : "ended"
+ },
+ {
+ type : "wheel",
+ deltaY : -60,
+ momentumPhase : "began"
+ },
+ {
+ type: "wheel",
+ viewX : 101, // defeat coalescing
+ deltaY : -99,
+ momentumPhase: "changed"
+ },
+ {
+ type: "wheel",
+ viewX : 102, // defeat coalescing
+ deltaY : -80,
+ momentumPhase: "changed"
+ },
+ {
+ type : "wheel",
+ momentumPhase : "ended"
+ }
+ ];
+
+ await UIHelper.mouseWheelSequence({ events }, { waitForCompletion: false});
+ await UIHelper.waitForCondition(() => { return sawMomentumEvent });
+ shouldBeTrue('scrollEventCount > 0');
+
+ const fingersDownGesture = [
+ {
+ type : "wheel",
+ viewX : 100,
+ viewY : 100,
+ phase : "maybegin"
+ }
+ ];
+
+ await UIHelper.mouseWheelSequence({ events: fingersDownGesture }, { waitForCompletion: false});
+ // We can't detect the "mayBegin" via events. so wait for a presentation update to make
+ // sure it got to the main thread.
+ await UIHelper.ensurePresentationUpdate();
+
+ scrollEventCountAtMayBegin = scrollEventCount;
+ await UIHelper.renderingUpdate();
+ await UIHelper.renderingUpdate();
+
+ // Make sure no more scroll events fire.
+ shouldBe('scrollEventCount', 'scrollEventCountAtMayBegin');
+ finishJSTest();
+ }
+
+ async function scrollTest()
+ {
+ await testEventSequence();
+ }
+
+ window.addEventListener('load', () => {
+ window.addEventListener('wheel', (event) => {
+ if (event.deltaY == 99) {
+ debug('Momentum event reached main thread');
+ sawMomentumEvent = true;
+ }
+
+ if (event.deltaY == 12) {
+ debug('Saw the fingers down gesture');
+ sawFingersDown = true;
+ }
+ // console.log(`wheel ${event.deltaX} ${event.deltaY}`);
+ }, { passive: true });
+
+ window.addEventListener('scroll', (event) => {
+ ++scrollEventCount;
+ });
+
+ setTimeout(scrollTest, 0);
+ }, false);
+ </script>
+</head>
+<body>
+ <script src=""
+</body>
+</html>
Modified: branches/safari-613.1.9.0-branch/Source/WebCore/ChangeLog (285941 => 285942)
--- branches/safari-613.1.9.0-branch/Source/WebCore/ChangeLog 2021-11-17 19:14:31 UTC (rev 285941)
+++ branches/safari-613.1.9.0-branch/Source/WebCore/ChangeLog 2021-11-17 19:14:37 UTC (rev 285942)
@@ -1,5 +1,68 @@
2021-11-17 Alan Coon <[email protected]>
+ Cherry-pick r285797. rdar://problem/85512520
+
+ Fingers down on the trackpad should stop an animated scroll
+ https://bugs.webkit.org/show_bug.cgi?id=233114
+
+ Reviewed by Wenson Hsieh.
+ Source/WebCore:
+
+ Fingers down on the trackpad sends a "MayBegin" event; this needs to stop any in-progress
+ animated momentum scroll.
+
+ This failed because ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent() early-returned
+ on the MayBegin event before it got to ScrollingEffectsController. Fix that, and have
+ ScrollingEffectsController::handleWheelEvent() return true to say it was handled.
+
+ This triggered an assertion in ScrollingTreeGestureState, but for "post-main-thread"
+ handling for which the assertion was wrong.
+
+ Test: fast/scrolling/mac/momentum-animator-maybegin-stops.html
+
+ * page/scrolling/ScrollingTreeGestureState.cpp:
+ (WebCore::ScrollingTreeGestureState::nodeDidHandleEvent):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
+ * platform/mac/ScrollingEffectsController.mm:
+ (WebCore::ScrollingEffectsController::handleWheelEvent):
+
+ LayoutTests:
+
+ * fast/scrolling/mac/momentum-animator-maybegin-stops-expected.txt: Added.
+ * fast/scrolling/mac/momentum-animator-maybegin-stops.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-11-14 Simon Fraser <[email protected]>
+
+ Fingers down on the trackpad should stop an animated scroll
+ https://bugs.webkit.org/show_bug.cgi?id=233114
+
+ Reviewed by Wenson Hsieh.
+
+ Fingers down on the trackpad sends a "MayBegin" event; this needs to stop any in-progress
+ animated momentum scroll.
+
+ This failed because ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent() early-returned
+ on the MayBegin event before it got to ScrollingEffectsController. Fix that, and have
+ ScrollingEffectsController::handleWheelEvent() return true to say it was handled.
+
+ This triggered an assertion in ScrollingTreeGestureState, but for "post-main-thread"
+ handling for which the assertion was wrong.
+
+ Test: fast/scrolling/mac/momentum-animator-maybegin-stops.html
+
+ * page/scrolling/ScrollingTreeGestureState.cpp:
+ (WebCore::ScrollingTreeGestureState::nodeDidHandleEvent):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
+ * platform/mac/ScrollingEffectsController.mm:
+ (WebCore::ScrollingEffectsController::handleWheelEvent):
+
+2021-11-17 Alan Coon <[email protected]>
+
Cherry-pick r285790. rdar://problem/85512520
Attach IOHIDEvent timestamps to wheel events
Modified: branches/safari-613.1.9.0-branch/Source/WebCore/page/scrolling/ScrollingTreeGestureState.cpp (285941 => 285942)
--- branches/safari-613.1.9.0-branch/Source/WebCore/page/scrolling/ScrollingTreeGestureState.cpp 2021-11-17 19:14:31 UTC (rev 285941)
+++ branches/safari-613.1.9.0-branch/Source/WebCore/page/scrolling/ScrollingTreeGestureState.cpp 2021-11-17 19:14:37 UTC (rev 285942)
@@ -66,8 +66,8 @@
m_scrollingTree.handleWheelEventPhase(nodeID, event.phase());
break;
case PlatformWheelEventPhase::Cancelled:
- // handleGestureCancel() should have been called first.
- ASSERT_NOT_REACHED();
+ // We can get here for via handleWheelEventAfterMainThread(), in which case handleGestureCancel() was not called first.
+ handleGestureCancel(event);
break;
case PlatformWheelEventPhase::Began:
m_activeNodeID = nodeID;
Modified: branches/safari-613.1.9.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (285941 => 285942)
--- branches/safari-613.1.9.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-11-17 19:14:31 UTC (rev 285941)
+++ branches/safari-613.1.9.0-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-11-17 19:14:37 UTC (rev 285942)
@@ -106,11 +106,6 @@
if (isInUserScroll != wasInUserScroll)
scrollingNode().setUserScrollInProgress(isInUserScroll);
- // PlatformWheelEventPhase::MayBegin fires when two fingers touch the trackpad, and is used to flash overlay scrollbars.
- // We know we're scrollable at this point, so handle the event.
- if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin)
- return true;
-
return m_scrollController.handleWheelEvent(wheelEvent);
}
Modified: branches/safari-613.1.9.0-branch/Source/WebCore/platform/mac/ScrollingEffectsController.mm (285941 => 285942)
--- branches/safari-613.1.9.0-branch/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-11-17 19:14:31 UTC (rev 285941)
+++ branches/safari-613.1.9.0-branch/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-11-17 19:14:37 UTC (rev 285942)
@@ -140,7 +140,7 @@
LOG(ScrollAnimations, "Event (%s, %s): stopping animated scroll", phaseToString(wheelEvent.phase()), phaseToString(wheelEvent.momentumPhase()));
stopAnimatedScroll();
}
- return false;
+ return true;
}
if (wheelEvent.phase() == PlatformWheelEventPhase::Began) {