- Revision
- 286035
- Author
- [email protected]
- Date
- 2021-11-18 15:20:09 -0800 (Thu, 18 Nov 2021)
Log Message
Teach WheelEventTestMonitor about scroll animations
https://bugs.webkit.org/show_bug.cgi?id=233296
Reviewed by Tim Horton.
There was no way for a test to wait for a scroll animation to finish, so enhance
WheelEventTestMonitor to know about scroll animations.
ScrollAnimationInProgress should probably subsume the RubberbandInProgress and
ScrollSnapInProgress reasons, but those are left alone for now.
* page/WheelEventTestMonitor.cpp:
(WebCore::operator<<):
* page/WheelEventTestMonitor.h:
* platform/ScrollingEffectsController.cpp:
(WebCore::ScrollingEffectsController::startScrollSnapAnimation):
(WebCore::ScrollingEffectsController::stopScrollSnapAnimation):
(WebCore::ScrollingEffectsController::scrollAnimationWillStart):
(WebCore::ScrollingEffectsController::scrollAnimationDidEnd):
(WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletion):
(WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletion):
* platform/ScrollingEffectsController.h:
* platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::scheduleStatelessScrollSnap):
(WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.
(WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (286034 => 286035)
--- trunk/Source/WebCore/ChangeLog 2021-11-18 23:19:03 UTC (rev 286034)
+++ trunk/Source/WebCore/ChangeLog 2021-11-18 23:20:09 UTC (rev 286035)
@@ -1,3 +1,32 @@
+2021-11-18 Simon Fraser <[email protected]>
+
+ Teach WheelEventTestMonitor about scroll animations
+ https://bugs.webkit.org/show_bug.cgi?id=233296
+
+ Reviewed by Tim Horton.
+
+ There was no way for a test to wait for a scroll animation to finish, so enhance
+ WheelEventTestMonitor to know about scroll animations.
+
+ ScrollAnimationInProgress should probably subsume the RubberbandInProgress and
+ ScrollSnapInProgress reasons, but those are left alone for now.
+
+ * page/WheelEventTestMonitor.cpp:
+ (WebCore::operator<<):
+ * page/WheelEventTestMonitor.h:
+ * platform/ScrollingEffectsController.cpp:
+ (WebCore::ScrollingEffectsController::startScrollSnapAnimation):
+ (WebCore::ScrollingEffectsController::stopScrollSnapAnimation):
+ (WebCore::ScrollingEffectsController::scrollAnimationWillStart):
+ (WebCore::ScrollingEffectsController::scrollAnimationDidEnd):
+ (WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletion):
+ (WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletion):
+ * platform/ScrollingEffectsController.h:
+ * platform/mac/ScrollingEffectsController.mm:
+ (WebCore::ScrollingEffectsController::scheduleStatelessScrollSnap):
+ (WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.
+ (WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.
+
2021-11-18 Chris Dumez <[email protected]>
Unreviewed, fix Linux build after r286025.
Modified: trunk/Source/WebCore/page/WheelEventTestMonitor.cpp (286034 => 286035)
--- trunk/Source/WebCore/page/WheelEventTestMonitor.cpp 2021-11-18 23:19:03 UTC (rev 286034)
+++ trunk/Source/WebCore/page/WheelEventTestMonitor.cpp 2021-11-18 23:20:09 UTC (rev 286035)
@@ -174,6 +174,7 @@
case WheelEventTestMonitor::PostMainThreadWheelEventHandling: ts << "post-main thread event handling"; break;
case WheelEventTestMonitor::RubberbandInProgress: ts << "rubberbanding"; break;
case WheelEventTestMonitor::ScrollSnapInProgress: ts << "scroll-snapping"; break;
+ case WheelEventTestMonitor::ScrollAnimationInProgress: ts << "scroll animation"; break;
case WheelEventTestMonitor::ScrollingThreadSyncNeeded: ts << "scrolling thread sync needed"; break;
case WheelEventTestMonitor::ContentScrollInProgress: ts << "content scrolling"; break;
case WheelEventTestMonitor::RequestedScrollPosition: ts << "requested scroll position"; break;
Modified: trunk/Source/WebCore/page/WheelEventTestMonitor.h (286034 => 286035)
--- trunk/Source/WebCore/page/WheelEventTestMonitor.h 2021-11-18 23:19:03 UTC (rev 286034)
+++ trunk/Source/WebCore/page/WheelEventTestMonitor.h 2021-11-18 23:20:09 UTC (rev 286035)
@@ -53,9 +53,10 @@
PostMainThreadWheelEventHandling = 1 << 2,
RubberbandInProgress = 1 << 3,
ScrollSnapInProgress = 1 << 4,
- ScrollingThreadSyncNeeded = 1 << 5,
- ContentScrollInProgress = 1 << 6,
- RequestedScrollPosition = 1 << 7,
+ ScrollAnimationInProgress = 1 << 5,
+ ScrollingThreadSyncNeeded = 1 << 6,
+ ContentScrollInProgress = 1 << 7,
+ RequestedScrollPosition = 1 << 8,
};
typedef const void* ScrollableAreaIdentifier;
Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.cpp (286034 => 286035)
--- trunk/Source/WebCore/platform/ScrollingEffectsController.cpp 2021-11-18 23:19:03 UTC (rev 286034)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.cpp 2021-11-18 23:20:09 UTC (rev 286035)
@@ -34,7 +34,6 @@
#include "ScrollAnimationSmooth.h"
#include "ScrollExtents.h"
#include "ScrollableArea.h"
-#include "WheelEventTestMonitor.h"
#include <wtf/text/TextStream.h>
#if ENABLE(KINETIC_SCROLLING) && !PLATFORM(MAC)
@@ -446,9 +445,7 @@
LOG_WITH_STREAM(ScrollSnap, stream << "ScrollingEffectsController " << this << " startScrollSnapAnimation (main thread " << isMainThread() << ")");
-#if PLATFORM(MAC)
- startDeferringWheelEventTestCompletionDueToScrollSnapping();
-#endif
+ startDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollSnapInProgress);
m_client.willStartScrollSnapAnimation();
setIsAnimatingScrollSnap(true);
}
@@ -460,9 +457,7 @@
LOG_WITH_STREAM(ScrollSnap, stream << "ScrollingEffectsController " << this << " stopScrollSnapAnimation (main thread " << isMainThread() << ")");
-#if PLATFORM(MAC)
- stopDeferringWheelEventTestCompletionDueToScrollSnapping();
-#endif
+ stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollSnapInProgress);
m_client.didStopScrollSnapAnimation();
setIsAnimatingScrollSnap(false);
@@ -497,6 +492,7 @@
UNUSED_PARAM(animation);
#endif
+ startDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollAnimationInProgress);
startOrStopAnimationCallbacks();
}
@@ -519,6 +515,7 @@
// FIXME: Need to track state better and only call this when the running animation is for CSS smooth scrolling. Calling should be harmless, though.
m_client.didStopAnimatedScroll();
startOrStopAnimationCallbacks();
+ stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollAnimationInProgress);
}
ScrollExtents ScrollingEffectsController::scrollExtentsForAnimation(ScrollAnimation&)
@@ -526,6 +523,16 @@
return m_client.scrollExtents();
}
+void ScrollingEffectsController::startDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason reason)
+{
+ m_client.deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), reason);
+}
+
+void ScrollingEffectsController::stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason reason)
+{
+ m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), reason);
+}
+
// Currently, only Mac supports momentum srolling-based scrollsnapping and rubber banding
// so all of these methods are a noop on non-Mac platforms.
#if !PLATFORM(MAC)
Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.h (286034 => 286035)
--- trunk/Source/WebCore/platform/ScrollingEffectsController.h 2021-11-18 23:19:03 UTC (rev 286034)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.h 2021-11-18 23:20:09 UTC (rev 286035)
@@ -201,8 +201,6 @@
bool shouldOverrideMomentumScrolling() const;
void statelessSnapTransitionTimerFired();
void scheduleStatelessScrollSnap();
- void startDeferringWheelEventTestCompletionDueToScrollSnapping();
- void stopDeferringWheelEventTestCompletionDueToScrollSnapping();
bool modifyScrollDeltaForStretching(const PlatformWheelEvent&, FloatSize&, bool isHorizontallyStretched, bool isVerticallyStretched);
bool applyScrollDeltaWithStretching(const PlatformWheelEvent&, FloatSize, bool isHorizontallyStretched, bool isVerticallyStretched);
@@ -225,6 +223,9 @@
bool momentumScrollingAnimatorEnabled() const { return m_momentumScrollingAnimatorEnabled; }
+ void startDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason);
+ void stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason);
+
// ScrollAnimationClient
void scrollAnimationDidUpdate(ScrollAnimation&, const FloatPoint& /* currentOffset */) final;
void scrollAnimationWillStart(ScrollAnimation&) final;
Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (286034 => 286035)
--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-11-18 23:19:03 UTC (rev 286034)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm 2021-11-18 23:20:09 UTC (rev 286035)
@@ -31,7 +31,6 @@
#import "ScrollAnimationRubberBand.h"
#import "ScrollExtents.h"
#import "WheelEventDeltaFilter.h"
-#import "WheelEventTestMonitor.h"
#import <pal/spi/mac/NSScrollViewSPI.h>
#import <sys/sysctl.h>
#import <sys/time.h>
@@ -680,7 +679,7 @@
statelessSnapTransitionTimerFired();
});
m_statelessSnapTransitionTimer->startOneShot(statelessScrollSnapDelay);
- startDeferringWheelEventTestCompletionDueToScrollSnapping();
+ startDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollSnapInProgress);
}
void ScrollingEffectsController::statelessSnapTransitionTimerFired()
@@ -694,16 +693,6 @@
startScrollSnapAnimation();
}
-void ScrollingEffectsController::startDeferringWheelEventTestCompletionDueToScrollSnapping()
-{
- m_client.deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::ScrollSnapInProgress);
-}
-
-void ScrollingEffectsController::stopDeferringWheelEventTestCompletionDueToScrollSnapping()
-{
- m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::ScrollSnapInProgress);
-}
-
bool ScrollingEffectsController::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent)
{
if (!usesScrollSnap())