Title: [259820] trunk/Source
Revision
259820
Author
[email protected]
Date
2020-04-09 13:36:21 -0700 (Thu, 09 Apr 2020)

Log Message

eventSender.monitorWheelEvents() should clear latching state
https://bugs.webkit.org/show_bug.cgi?id=210288

Reviewed by Tim Horton.

Use monitorWheelEvents() as a trigger to clear scroll latching state, both main-thread (via Page)
and scrolling thread (via ScrollingTree).

Page::ensureWheelEventTestMonitor() had side-effects, so hide it, and have clients explicitly call Page::startMonitoringWheelEvents().

Source/WebCore:

* page/Page.cpp:
(WebCore::Page::startMonitoringWheelEvents):
(WebCore::Page::ensureWheelEventTestMonitor):
* page/Page.h:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::monitorWheelEvents):
(WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring):

Source/WebKit:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259819 => 259820)


--- trunk/Source/WebCore/ChangeLog	2020-04-09 20:16:38 UTC (rev 259819)
+++ trunk/Source/WebCore/ChangeLog	2020-04-09 20:36:21 UTC (rev 259820)
@@ -1,3 +1,23 @@
+2020-04-09  Simon Fraser  <[email protected]>
+
+        eventSender.monitorWheelEvents() should clear latching state
+        https://bugs.webkit.org/show_bug.cgi?id=210288
+
+        Reviewed by Tim Horton.
+
+        Use monitorWheelEvents() as a trigger to clear scroll latching state, both main-thread (via Page)
+        and scrolling thread (via ScrollingTree).
+
+        Page::ensureWheelEventTestMonitor() had side-effects, so hide it, and have clients explicitly call Page::startMonitoringWheelEvents().
+
+        * page/Page.cpp:
+        (WebCore::Page::startMonitoringWheelEvents):
+        (WebCore::Page::ensureWheelEventTestMonitor):
+        * page/Page.h:
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::monitorWheelEvents):
+        (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring):
+
 2020-04-09  Wenson Hsieh  <[email protected]>
 
         Add an API test for <https://trac.webkit.org/r259766>

Modified: trunk/Source/WebCore/page/Page.cpp (259819 => 259820)


--- trunk/Source/WebCore/page/Page.cpp	2020-04-09 20:16:38 UTC (rev 259819)
+++ trunk/Source/WebCore/page/Page.cpp	2020-04-09 20:36:21 UTC (rev 259820)
@@ -2641,19 +2641,27 @@
     return !!m_wheelEventTestMonitor;
 }
 
-WheelEventTestMonitor& Page::ensureWheelEventTestMonitor()
+void Page::startMonitoringWheelEvents()
 {
-    if (!m_wheelEventTestMonitor) {
-        m_wheelEventTestMonitor = adoptRef(new WheelEventTestMonitor(*this));
-        // We need to update the scrolling coordinator so that the mainframe scrolling node can expect wheel event test triggers.
-        if (auto* frameView = mainFrame().view()) {
-            if (m_scrollingCoordinator) {
-                m_scrollingCoordinator->startMonitoringWheelEvents();
-                m_scrollingCoordinator->updateIsMonitoringWheelEventsForFrameView(*frameView);
-            }
+    ensureWheelEventTestMonitor().clearAllTestDeferrals();
+
+#if ENABLE(WHEEL_EVENT_LATCHING)
+    resetLatchingState();
+#endif
+
+    if (auto* frameView = mainFrame().view()) {
+        if (m_scrollingCoordinator) {
+            m_scrollingCoordinator->startMonitoringWheelEvents();
+            m_scrollingCoordinator->updateIsMonitoringWheelEventsForFrameView(*frameView);
         }
     }
+}
 
+WheelEventTestMonitor& Page::ensureWheelEventTestMonitor()
+{
+    if (!m_wheelEventTestMonitor)
+        m_wheelEventTestMonitor = adoptRef(new WheelEventTestMonitor(*this));
+
     return *m_wheelEventTestMonitor;
 }
 

Modified: trunk/Source/WebCore/page/Page.h (259819 => 259820)


--- trunk/Source/WebCore/page/Page.h	2020-04-09 20:16:38 UTC (rev 259819)
+++ trunk/Source/WebCore/page/Page.h	2020-04-09 20:36:21 UTC (rev 259820)
@@ -652,8 +652,8 @@
 #endif
 
     WEBCORE_EXPORT RefPtr<WheelEventTestMonitor> wheelEventTestMonitor() const;
-    WEBCORE_EXPORT WheelEventTestMonitor& ensureWheelEventTestMonitor();
     WEBCORE_EXPORT void clearWheelEventTestMonitor();
+    WEBCORE_EXPORT void startMonitoringWheelEvents();
     WEBCORE_EXPORT bool isMonitoringWheelEvents() const;
 
 #if ENABLE(VIDEO)
@@ -778,6 +778,8 @@
 
     void doAfterUpdateRendering();
 
+    WheelEventTestMonitor& ensureWheelEventTestMonitor();
+
     const std::unique_ptr<Chrome> m_chrome;
     const std::unique_ptr<DragCaretController> m_dragCaretController;
 

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-04-09 20:16:38 UTC (rev 259819)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-04-09 20:36:21 UTC (rev 259820)
@@ -138,6 +138,7 @@
 
 void ScrollingCoordinatorMac::startMonitoringWheelEvents()
 {
+    scrollingTree()->clearLatchedNode();
     auto monitor = m_page->wheelEventTestMonitor();
     scrollingTree()->setWheelEventTestMonitor(WTFMove(monitor));
 }

Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (259819 => 259820)


--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2020-04-09 20:16:38 UTC (rev 259819)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2020-04-09 20:36:21 UTC (rev 259820)
@@ -85,7 +85,7 @@
     if (!page)
         return;
 
-    page->ensureWheelEventTestMonitor().clearAllTestDeferrals();
+    page->startMonitoringWheelEvents();
 }
 
 void setWheelEventMonitorTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WebCore::Frame& frame, JSContextRef context, JSObjectRef jsCallbackFunction)
@@ -95,11 +95,13 @@
         return;
 
     JSValueProtect(context, jsCallbackFunction);
-    
-    page->ensureWheelEventTestMonitor().setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=](void) {
-        JSObjectCallAsFunction(context, jsCallbackFunction, nullptr, 0, nullptr, nullptr);
-        JSValueUnprotect(context, jsCallbackFunction);
-    });
+
+    if (auto wheelEventTestMonitor = page->wheelEventTestMonitor()) {
+        wheelEventTestMonitor->setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=](void) {
+            JSObjectCallAsFunction(context, jsCallbackFunction, nullptr, 0, nullptr, nullptr);
+            JSValueUnprotect(context, jsCallbackFunction);
+        });
+    }
 }
 
 void clearWheelEventTestMonitor(WebCore::Frame& frame)

Modified: trunk/Source/WebKit/ChangeLog (259819 => 259820)


--- trunk/Source/WebKit/ChangeLog	2020-04-09 20:16:38 UTC (rev 259819)
+++ trunk/Source/WebKit/ChangeLog	2020-04-09 20:36:21 UTC (rev 259820)
@@ -1,5 +1,21 @@
 2020-04-09  Simon Fraser  <[email protected]>
 
+        eventSender.monitorWheelEvents() should clear latching state
+        https://bugs.webkit.org/show_bug.cgi?id=210288
+
+        Reviewed by Tim Horton.
+
+        Use monitorWheelEvents() as a trigger to clear scroll latching state, both main-thread (via Page)
+        and scrolling thread (via ScrollingTree).
+
+        Page::ensureWheelEventTestMonitor() had side-effects, so hide it, and have clients explicitly call Page::startMonitoringWheelEvents().
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageStartMonitoringScrollOperations):
+        (WKBundlePageRegisterScrollOperationCompletionCallback):
+
+2020-04-09  Simon Fraser  <[email protected]>
+
         Reset view navigation gesture state between tests
         https://bugs.webkit.org/show_bug.cgi?id=210283
 

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


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2020-04-09 20:16:38 UTC (rev 259819)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2020-04-09 20:36:21 UTC (rev 259820)
@@ -702,7 +702,7 @@
     if (!page)
         return;
 
-    page->ensureWheelEventTestMonitor().clearAllTestDeferrals();
+    page->startMonitoringWheelEvents();
 }
 
 bool WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, bool expectWheelEndOrCancel, bool expectMomentumEnd, void* context)
@@ -715,9 +715,11 @@
     if (!page || !page->isMonitoringWheelEvents())
         return false;
     
-    page->ensureWheelEventTestMonitor().setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=]() {
-        callback(context);
-    });
+    if (auto wheelEventTestMonitor = page->wheelEventTestMonitor()) {
+        wheelEventTestMonitor->setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=]() {
+            callback(context);
+        });
+    }
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to