Title: [261539] trunk
Revision
261539
Author
simon.fra...@apple.com
Date
2020-05-11 19:10:08 -0700 (Mon, 11 May 2020)

Log Message

[ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=211747

Reviewed by Tim Horton.

Source/WebCore:

Add an option to monitorWheelEvents to reset latching.

* page/Page.cpp:
(WebCore::Page::startMonitoringWheelEvents):
* page/Page.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::startMonitoringWheelEvents):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents):
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::monitorWheelEvents):
* testing/js/WebCoreTestSupport.h:

Source/WebKit:

Add an option to monitorWheelEvents to reset latching.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageStartMonitoringScrollOperations):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:

Tools:

Add an option to monitorWheelEvents to reset latching.

* DumpRenderTree/mac/EventSendingController.mm:
(+[EventSendingController isSelectorExcludedFromWebScript:]):
(+[EventSendingController webScriptNameForSelector:]):
(-[EventSendingController monitorWheelEventsWithOptions:]):
(-[EventSendingController monitorWheelEvents]): Deleted.
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::toMonitorWheelEventsOptions): We have to return a pointer to a static, because the generated code
doesn't use smart pointers.
(WTR::EventSendingController::monitorWheelEvents):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
(WTR::MonitorWheelEventsOptions::MonitorWheelEventsOptions):

LayoutTests:

Change the test to use monitorWheelEvents() for each phase.

* scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261538 => 261539)


--- trunk/LayoutTests/ChangeLog	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/LayoutTests/ChangeLog	2020-05-12 02:10:08 UTC (rev 261539)
@@ -1,3 +1,14 @@
+2020-05-11  Simon Fraser  <simon.fra...@apple.com>
+
+        [ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=211747
+
+        Reviewed by Tim Horton.
+
+        Change the test to use monitorWheelEvents() for each phase.
+
+        * scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html:
+
 2020-05-11  Ben Nham  <n...@apple.com>
 
         Improve accuracy of IndexedDB estimated write size computation

Modified: trunk/LayoutTests/scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html (261538 => 261539)


--- trunk/LayoutTests/scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/LayoutTests/scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html	2020-05-12 02:10:08 UTC (rev 261539)
@@ -35,7 +35,6 @@
             const x = selectBounds.left + 10;
             const y = selectBounds.top + 10;
 
-            // We have to send all these as one sequence, because monitorWheelEvents() clears the latching state.
             eventSender.monitorWheelEvents();
             eventSender.mouseMoveTo(x, y);
 
@@ -45,16 +44,18 @@
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 20, "changed", "none");
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
 
-            await UIHelper.animationFrame();
+            await UIHelper.waitForScrollCompletion();
 
             // Scroll up again to trigger a document bounce.
+            eventSender.monitorWheelEvents({ resetLatching: false });
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 1, "began", "none");
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 20, "changed", "none");
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
 
-            await UIHelper.animationFrame();
+            await UIHelper.waitForScrollCompletion();
 
             // Scroll down. This should scroll the select, not the document.
+            eventSender.monitorWheelEvents({ resetLatching: false });
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -2, "began", "none");
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -20, "changed", "none");
             eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -20, "changed", "none");

Modified: trunk/Source/WebCore/ChangeLog (261538 => 261539)


--- trunk/Source/WebCore/ChangeLog	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/ChangeLog	2020-05-12 02:10:08 UTC (rev 261539)
@@ -1,3 +1,24 @@
+2020-05-11  Simon Fraser  <simon.fra...@apple.com>
+
+        [ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=211747
+
+        Reviewed by Tim Horton.
+
+        Add an option to monitorWheelEvents to reset latching.
+
+        * page/Page.cpp:
+        (WebCore::Page::startMonitoringWheelEvents):
+        * page/Page.h:
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::startMonitoringWheelEvents):
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents):
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::monitorWheelEvents):
+        * testing/js/WebCoreTestSupport.h:
+
 2020-05-11  Andres Gonzalez  <andresg...@apple.com>
 
         Fixes for crashes in isolated tree mode.

Modified: trunk/Source/WebCore/page/Page.cpp (261538 => 261539)


--- trunk/Source/WebCore/page/Page.cpp	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/page/Page.cpp	2020-05-12 02:10:08 UTC (rev 261539)
@@ -2720,17 +2720,18 @@
     return !!m_wheelEventTestMonitor;
 }
 
-void Page::startMonitoringWheelEvents()
+void Page::startMonitoringWheelEvents(bool clearLatchingState)
 {
     ensureWheelEventTestMonitor().clearAllTestDeferrals();
 
 #if ENABLE(WHEEL_EVENT_LATCHING)
-    resetLatchingState();
+    if (clearLatchingState)
+        resetLatchingState();
 #endif
 
     if (auto* frameView = mainFrame().view()) {
         if (m_scrollingCoordinator) {
-            m_scrollingCoordinator->startMonitoringWheelEvents();
+            m_scrollingCoordinator->startMonitoringWheelEvents(clearLatchingState);
             m_scrollingCoordinator->updateIsMonitoringWheelEventsForFrameView(*frameView);
         }
     }

Modified: trunk/Source/WebCore/page/Page.h (261538 => 261539)


--- trunk/Source/WebCore/page/Page.h	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/page/Page.h	2020-05-12 02:10:08 UTC (rev 261539)
@@ -668,7 +668,7 @@
 
     WEBCORE_EXPORT RefPtr<WheelEventTestMonitor> wheelEventTestMonitor() const;
     WEBCORE_EXPORT void clearWheelEventTestMonitor();
-    WEBCORE_EXPORT void startMonitoringWheelEvents();
+    WEBCORE_EXPORT void startMonitoringWheelEvents(bool clearLatchingState);
     WEBCORE_EXPORT bool isMonitoringWheelEvents() const;
 
 #if ENABLE(VIDEO)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (261538 => 261539)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-05-12 02:10:08 UTC (rev 261539)
@@ -185,7 +185,7 @@
     EventTrackingRegions absoluteEventTrackingRegions() const;
     virtual void updateIsMonitoringWheelEventsForFrameView(const FrameView&) { }
 
-    virtual void startMonitoringWheelEvents() { }
+    virtual void startMonitoringWheelEvents(bool /* clearLatchingState */) { }
     virtual void stopMonitoringWheelEvents() { }
 
 protected:

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (261538 => 261539)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2020-05-12 02:10:08 UTC (rev 261539)
@@ -48,7 +48,7 @@
 
     void updateTiledScrollingIndicator();
 
-    void startMonitoringWheelEvents() final;
+    void startMonitoringWheelEvents(bool clearLatchingState) final;
     void stopMonitoringWheelEvents() final;
 };
 

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (261538 => 261539)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-05-12 02:10:08 UTC (rev 261539)
@@ -129,9 +129,10 @@
     tiledBacking->setScrollingModeIndication(indicatorMode);
 }
 
-void ScrollingCoordinatorMac::startMonitoringWheelEvents()
+void ScrollingCoordinatorMac::startMonitoringWheelEvents(bool clearLatchingState)
 {
-    scrollingTree()->clearLatchedNode();
+    if (clearLatchingState)
+        scrollingTree()->clearLatchedNode();
     auto monitor = m_page->wheelEventTestMonitor();
     scrollingTree()->setWheelEventTestMonitor(WTFMove(monitor));
 }

Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (261538 => 261539)


--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2020-05-12 02:10:08 UTC (rev 261539)
@@ -79,13 +79,13 @@
     InternalSettings::from(page)->resetToConsistentState();
 }
 
-void monitorWheelEvents(WebCore::Frame& frame)
+void monitorWheelEvents(WebCore::Frame& frame, bool clearLatchingState)
 {
     Page* page = frame.page();
     if (!page)
         return;
 
-    page->startMonitoringWheelEvents();
+    page->startMonitoringWheelEvents(clearLatchingState);
 }
 
 void setWheelEventMonitorTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WebCore::Frame& frame, JSContextRef context, JSObjectRef jsCallbackFunction)

Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.h (261538 => 261539)


--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.h	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.h	2020-05-12 02:10:08 UTC (rev 261539)
@@ -46,7 +46,7 @@
 
 void injectInternalsObject(JSContextRef) TEST_SUPPORT_EXPORT;
 void resetInternalsObject(JSContextRef) TEST_SUPPORT_EXPORT;
-void monitorWheelEvents(WebCore::Frame&) TEST_SUPPORT_EXPORT;
+void monitorWheelEvents(WebCore::Frame&, bool clearLatchingState) TEST_SUPPORT_EXPORT;
 void setWheelEventMonitorTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WebCore::Frame&, JSContextRef, JSObjectRef) TEST_SUPPORT_EXPORT;
 void clearWheelEventTestMonitor(WebCore::Frame&) TEST_SUPPORT_EXPORT;
 

Modified: trunk/Source/WebKit/ChangeLog (261538 => 261539)


--- trunk/Source/WebKit/ChangeLog	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebKit/ChangeLog	2020-05-12 02:10:08 UTC (rev 261539)
@@ -1,3 +1,16 @@
+2020-05-11  Simon Fraser  <simon.fra...@apple.com>
+
+        [ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=211747
+
+        Reviewed by Tim Horton.
+
+        Add an option to monitorWheelEvents to reset latching.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageStartMonitoringScrollOperations):
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+
 2020-05-11  Kate Cheney  <katherine_che...@apple.com>
 
         Fail navigations to non app-bound domains after use of app-bound APIs

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (261538 => 261539)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2020-05-12 02:10:08 UTC (rev 261539)
@@ -694,7 +694,7 @@
 }
 #endif
 
-void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef pageRef)
+void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef pageRef, bool clearLatchingState)
 {
     WebKit::WebPage* webPage = WebKit::toImpl(pageRef);
     WebCore::Page* page = webPage ? webPage->corePage() : nullptr;
@@ -702,7 +702,7 @@
     if (!page)
         return;
 
-    page->startMonitoringWheelEvents();
+    page->startMonitoringWheelEvents(clearLatchingState);
 }
 
 bool WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, bool expectWheelEndOrCancel, bool expectMomentumEnd, void* context)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h (261538 => 261539)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2020-05-12 02:10:08 UTC (rev 261539)
@@ -115,7 +115,7 @@
 
 WK_EXPORT bool WKBundlePageIsControlledByAutomation(WKBundlePageRef page);
 
-WK_EXPORT void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef page);
+WK_EXPORT void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef page, bool clearLatchingState);
 
 WK_EXPORT WKStringRef WKBundlePageCopyGroupIdentifier(WKBundlePageRef page);
 

Modified: trunk/Tools/ChangeLog (261538 => 261539)


--- trunk/Tools/ChangeLog	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Tools/ChangeLog	2020-05-12 02:10:08 UTC (rev 261539)
@@ -1,3 +1,25 @@
+2020-05-11  Simon Fraser  <simon.fra...@apple.com>
+
+        [ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=211747
+
+        Reviewed by Tim Horton.
+
+        Add an option to monitorWheelEvents to reset latching.
+
+        * DumpRenderTree/mac/EventSendingController.mm:
+        (+[EventSendingController isSelectorExcludedFromWebScript:]):
+        (+[EventSendingController webScriptNameForSelector:]):
+        (-[EventSendingController monitorWheelEventsWithOptions:]):
+        (-[EventSendingController monitorWheelEvents]): Deleted.
+        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
+        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+        (WTR::toMonitorWheelEventsOptions): We have to return a pointer to a static, because the generated code
+        doesn't use smart pointers.
+        (WTR::EventSendingController::monitorWheelEvents):
+        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+        (WTR::MonitorWheelEventsOptions::MonitorWheelEventsOptions):
+
 2020-05-11  Kate Cheney  <katherine_che...@apple.com>
 
         Fail navigations to non app-bound domains after use of app-bound APIs

Modified: trunk/Tools/DumpRenderTree/mac/EventSendingController.mm (261538 => 261539)


--- trunk/Tools/DumpRenderTree/mac/EventSendingController.mm	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Tools/DumpRenderTree/mac/EventSendingController.mm	2020-05-12 02:10:08 UTC (rev 261539)
@@ -253,7 +253,7 @@
             || aSelector == @selector(mouseScrollByX:andY:)
             || aSelector == @selector(mouseScrollByX:andY:withWheel:andMomentumPhases:)
             || aSelector == @selector(continuousMouseScrollByX:andY:)
-            || aSelector == @selector(monitorWheelEvents)
+            || aSelector == @selector(monitorWheelEventsWithOptions:)
             || aSelector == @selector(callAfterScrollingCompletes:)
 #if PLATFORM(MAC)
             || aSelector == @selector(beginDragWithFiles:)
@@ -318,7 +318,7 @@
         return @"continuousMouseScrollBy";
     if (aSelector == @selector(scalePageBy:atX:andY:))
         return @"scalePageBy";
-    if (aSelector == @selector(monitorWheelEvents))
+    if (aSelector == @selector(monitorWheelEventsWithOptions:))
         return @"monitorWheelEvents";
     if (aSelector == @selector(callAfterScrollingCompletes:))
         return @"callAfterScrollingCompletes";
@@ -1387,7 +1387,7 @@
     
 }
 
-- (void)monitorWheelEvents
+- (void)monitorWheelEventsWithOptions:(WebScriptObject*)options
 {
 #if PLATFORM(MAC)
     WebCore::Frame* frame = [[mainFrame webView] _mainCoreFrame];
@@ -1396,7 +1396,17 @@
 
     _sentWheelPhaseEndOrCancel = NO;
     _sentMomentumPhaseEnd = NO;
-    WebCoreTestSupport::monitorWheelEvents(*frame);
+
+    bool resetLatching = true;
+
+    if (![options isKindOfClass:[WebUndefined self]]) {
+        if (id resetLatchingValue = [options valueForKey:@"resetLatching"]) {
+            if ([resetLatchingValue isKindOfClass:[NSNumber self]])
+                resetLatching = [resetLatchingValue boolValue];
+        }
+    }
+
+    WebCoreTestSupport::monitorWheelEvents(*frame, resetLatching);
 #endif
 }
 

Modified: trunk/Tools/DumpRenderTree/win/EventSender.cpp (261538 => 261539)


--- trunk/Tools/DumpRenderTree/win/EventSender.cpp	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Tools/DumpRenderTree/win/EventSender.cpp	2020-05-12 02:10:08 UTC (rev 261539)
@@ -36,6 +36,7 @@
 #include "DumpRenderTree.h"
 #include "WebCoreTestSupport.h"
 
+#include <_javascript_Core/JSRetainPtr.h>
 #include <_javascript_Core/_javascript_Core.h>
 #include <WebCore/COMPtr.h>
 #include <WebCore/PlatformWheelEvent.h>
@@ -903,7 +904,17 @@
         return JSValueMakeUndefined(context);
 
     WebCore::Frame* coreFrame = core(static_cast<WebFrame*>(frame2.get()));
-    WebCoreTestSupport::monitorWheelEvents(*coreFrame);
+
+    bool resetLatching = true;
+    if (argumentCount > 0) {
+        auto resetLatchingString = adopt(JSStringCreateWithUTF8CString("resetLatching"));
+        auto resetLatchingValue = JSObjectGetProperty(context, JSValueToObject(context, arguments[0], nullptr), resetLatchingString.get(), nullptr);
+
+        if (resetLatchingValue && JSValueIsBoolean(context, resetLatchingValue))
+            resetLatching = JSValueToBoolean(context, resetLatchingValue);
+    }
+
+    WebCoreTestSupport::monitorWheelEvents(*coreFrame, resetLatching);
     
     return JSValueMakeUndefined(context);
 }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl (261538 => 261539)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2020-05-12 02:10:08 UTC (rev 261539)
@@ -23,6 +23,10 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+dictionary MonitorWheelEventsOptions {
+    boolean resetLatching = true;
+};
+
 interface EventSendingController {
     void mouseDown(long buttonNumber, object modifierArray);
     void mouseUp(long buttonNumber, object modifierArray);
@@ -50,7 +54,7 @@
     void zoomPageOut();
     void scalePageBy(double scale, double x, double y);
 
-    void monitorWheelEvents();
+    void monitorWheelEvents(optional MonitorWheelEventsOptions options);
     void callAfterScrollingCompletes(object functionCallback);
 
 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (261538 => 261539)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2020-05-12 02:10:08 UTC (rev 261539)
@@ -610,13 +610,30 @@
     WKBundlePageSetScaleAtOrigin(InjectedBundle::singleton().page()->page(), scale, origin);
 }
 
-void EventSendingController::monitorWheelEvents()
+MonitorWheelEventsOptions* toMonitorWheelEventsOptions(JSContextRef context, JSValueRef argument)
 {
+    if (!JSValueIsObject(context, argument))
+        return nullptr;
+
+    auto resetLatchingString = adopt(JSStringCreateWithUTF8CString("resetLatching"));
+    auto resetLatchingValue = JSObjectGetProperty(context, JSValueToObject(context, argument, nullptr), resetLatchingString.get(), nullptr);
+
+    bool resetLatching = true;
+    if (resetLatchingValue && JSValueIsBoolean(context, resetLatchingValue))
+        resetLatching = JSValueToBoolean(context, resetLatchingValue);
+
+    static MonitorWheelEventsOptions options;
+    options.resetLatching = resetLatching;
+    return &options;
+}
+
+void EventSendingController::monitorWheelEvents(MonitorWheelEventsOptions* options)
+{
     WKBundlePageRef page = InjectedBundle::singleton().page()->page();
     
     m_sentWheelPhaseEndOrCancel = false;
     m_sentWheelMomentumPhaseEnd = false;
-    WKBundlePageStartMonitoringScrollOperations(page);
+    WKBundlePageStartMonitoringScrollOperations(page, options ? options->resetLatching : true);
 }
 
 struct ScrollCompletionCallbackData {

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h (261538 => 261539)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2020-05-12 02:10:05 UTC (rev 261538)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2020-05-12 02:10:08 UTC (rev 261539)
@@ -32,6 +32,16 @@
 
 namespace WTR {
 
+struct MonitorWheelEventsOptions {
+    MonitorWheelEventsOptions(bool resetLatching = true)
+        : resetLatching(resetLatching)
+    { }
+
+    bool resetLatching { true };
+};
+
+MonitorWheelEventsOptions* toMonitorWheelEventsOptions(JSContextRef, JSValueRef);
+
 class EventSendingController : public JSWrappable {
 public:
     static Ref<EventSendingController> create();
@@ -56,7 +66,8 @@
     JSValueRef contextClick();
     void leapForward(int milliseconds);
     void scheduleAsynchronousClick();
-    void monitorWheelEvents();
+
+    void monitorWheelEvents(MonitorWheelEventsOptions*);
     void callAfterScrollingCompletes(JSValueRef functionCallback);
 
     void keyDown(JSStringRef key, JSValueRef modifierArray, int location);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to