Title: [287376] trunk
Revision
287376
Author
simon.fra...@apple.com
Date
2021-12-22 15:40:25 -0800 (Wed, 22 Dec 2021)

Log Message

Convert css3/scroll-snap/scroll-snap-wheel-event.html to use monitorWheelEvents()
https://bugs.webkit.org/show_bug.cgi?id=234526

Reviewed by Wenson Hsieh.

Source/WebCore:

This test sends a stateless wheel event and waits for the timer and subsequent scroll snap
animation, which is already tracked by WheelEventTestMonitor, but the code had a bug where
the monitor wasn't informed if no animation was required.

* platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::statelessSnapTransitionTimerFired):

LayoutTests:

Convert the test to use a UIHelper function which makes use of WheelEventTestMonitor.

* css3/scroll-snap/scroll-snap-wheel-event.html:
* resources/ui-helper.js:
(window.UIHelper.async statelessMouseWheelScrollAt):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287375 => 287376)


--- trunk/LayoutTests/ChangeLog	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/LayoutTests/ChangeLog	2021-12-22 23:40:25 UTC (rev 287376)
@@ -1,3 +1,16 @@
+2021-12-22  Simon Fraser  <simon.fra...@apple.com>
+
+        Convert css3/scroll-snap/scroll-snap-wheel-event.html to use monitorWheelEvents()
+        https://bugs.webkit.org/show_bug.cgi?id=234526
+
+        Reviewed by Wenson Hsieh.
+
+        Convert the test to use a UIHelper function which makes use of WheelEventTestMonitor.
+
+        * css3/scroll-snap/scroll-snap-wheel-event.html:
+        * resources/ui-helper.js:
+        (window.UIHelper.async statelessMouseWheelScrollAt):
+
 2021-12-22  Kate Cheney  <katherine_che...@apple.com>
 
         PCM tests crashing with 'unlink' errors

Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html (287375 => 287376)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-wheel-event.html	2021-12-22 23:40:25 UTC (rev 287376)
@@ -38,10 +38,9 @@
                 eventSender.mouseMoveTo(80, 190);
                 eventSender.mouseUp();
 
-                eventSender.mouseScrollBy(-1, 0);
+                await UIHelper.statelessMouseWheelScrollAt(80, 190, -1, 0);
 
                 let horizontalContainer = document.getElementById("horizontal-container");
-                await UIHelper.waitForTargetScrollAnimationToSettle(horizontalContainer);
                 expectTrue(horizontalContainer.scrollLeft == 200, "horizontal mouse wheel event snapped");
 
                 eventSender.mouseMoveTo(190, 220);
@@ -49,10 +48,9 @@
                 eventSender.mouseMoveTo(190, 270);
                 eventSender.mouseUp();
 
-                eventSender.mouseScrollBy(0, -1);
+                await UIHelper.statelessMouseWheelScrollAt(190, 270, 0, -1);
 
                 let verticalContainer = document.getElementById("vertical-container");
-                await UIHelper.waitForTargetScrollAnimationToSettle(verticalContainer);
                 expectTrue(verticalContainer.scrollTop == 185, "vertical mouse wheel event snapped");
             } catch (e) {
                 console.log(e);

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (287375 => 287376)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2021-12-22 23:40:25 UTC (rev 287376)
@@ -652,6 +652,9 @@
 webkit.org/b/152620 css3/font-variant-petite-caps-synthesis.html [ ImageOnlyFailure ]
 webkit.org/b/152620 css3/font-variant-small-caps-synthesis.html [ ImageOnlyFailure ]
 
+# monitorWheelEvents doesn't work in this test.
+css3/scroll-snap/scroll-snap-wheel-event.html [ Skip ]
+
 # Requires ENABLE(SAMPLING_PROFILER)
 webkit.org/b/153466 inspector/sampling-profiler [ Skip ]
 

Modified: trunk/LayoutTests/platform/win/TestExpectations (287375 => 287376)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-12-22 23:40:25 UTC (rev 287376)
@@ -590,6 +590,9 @@
 webkit.org/b/149774 css3/font-variant-petite-caps-synthesis.html [ Skip ] # WontFix
 webkit.org/b/149774 css3/font-variant-small-caps-synthesis.html [ Skip ] # WontFix
 
+# monitorWheelEvents doesn't work in this test.
+css3/scroll-snap/scroll-snap-wheel-event.html [ Skip ]
+
 # TODO HiDPI tests require test infrastructure enhancements (e.g. testRunner.setBackingScaleFactor)
 # https://bugs.webkit.org/show_bug.cgi?id=87919
 webkit.org/b/87919 compositing/tiled-layers-hidpi.html

Modified: trunk/LayoutTests/resources/ui-helper.js (287375 => 287376)


--- trunk/LayoutTests/resources/ui-helper.js	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/LayoutTests/resources/ui-helper.js	2021-12-22 23:40:25 UTC (rev 287376)
@@ -94,6 +94,18 @@
         });
     }
 
+    static async statelessMouseWheelScrollAt(x, y, deltaX, deltaY)
+    {
+        eventSender.monitorWheelEvents();
+        eventSender.mouseMoveTo(x, y);
+        eventSender.mouseScrollBy(deltaX, deltaY);
+        return new Promise(resolve => {
+            eventSender.callAfterScrollingCompletes(() => {
+                requestAnimationFrame(resolve);
+            });
+        });
+    }
+
     static async mouseWheelMayBeginAt(x, y)
     {
         eventSender.mouseMoveTo(x, y);

Modified: trunk/Source/WebCore/ChangeLog (287375 => 287376)


--- trunk/Source/WebCore/ChangeLog	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/Source/WebCore/ChangeLog	2021-12-22 23:40:25 UTC (rev 287376)
@@ -1,3 +1,17 @@
+2021-12-22  Simon Fraser  <simon.fra...@apple.com>
+
+        Convert css3/scroll-snap/scroll-snap-wheel-event.html to use monitorWheelEvents()
+        https://bugs.webkit.org/show_bug.cgi?id=234526
+
+        Reviewed by Wenson Hsieh.
+
+        This test sends a stateless wheel event and waits for the timer and subsequent scroll snap
+        animation, which is already tracked by WheelEventTestMonitor, but the code had a bug where
+        the monitor wasn't informed if no animation was required.
+
+        * platform/mac/ScrollingEffectsController.mm:
+        (WebCore::ScrollingEffectsController::statelessSnapTransitionTimerFired):
+
 2021-12-22  Alan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Close/open nested bidi contexts for new lines after force line breaks

Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (287375 => 287376)


--- trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-12-22 23:40:25 UTC (rev 287376)
@@ -377,7 +377,6 @@
     m_scrollAnimationScheduled = false;
 }
 
-#if PLATFORM(MAC)
 void ScrollAnimator::deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason) const
 {
     if (!m_wheelEventTestMonitor)
@@ -393,7 +392,6 @@
     
     m_wheelEventTestMonitor->removeDeferralForReason(identifier, reason);
 }
-#endif
 
 #if PLATFORM(GTK) || USE(NICOSIA)
 bool ScrollAnimator::scrollAnimationEnabled() const

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (287375 => 287376)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2021-12-22 23:40:25 UTC (rev 287376)
@@ -158,10 +158,8 @@
     bool isPinnedOnSide(BoxSide) const final;
 #endif
 
-#if PLATFORM(MAC)
     void deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) const final;
     void removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) const final;
-#endif
 
 #if PLATFORM(GTK) || USE(NICOSIA)
     bool scrollAnimationEnabled() const final;

Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (287375 => 287376)


--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-22 23:34:30 UTC (rev 287375)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-12-22 23:40:25 UTC (rev 287376)
@@ -609,6 +609,8 @@
 
     if (m_scrollSnapState->transitionToSnapAnimationState(m_client.scrollExtents(), m_client.pageScaleFactor(), m_client.scrollOffset()))
         startScrollSnapAnimation();
+    else
+        stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollSnapInProgress);
 }
 
 bool ScrollingEffectsController::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to