⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259820 in webkit


Ignore:
Timestamp:
Apr 9, 2020, 1:36:21 PM (6 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r259819 r259820  
     12020-04-09  Simon Fraser  <simon.fraser@apple.com>
     2
     3        eventSender.monitorWheelEvents() should clear latching state
     4        https://bugs.webkit.org/show_bug.cgi?id=210288
     5
     6        Reviewed by Tim Horton.
     7
     8        Use monitorWheelEvents() as a trigger to clear scroll latching state, both main-thread (via Page)
     9        and scrolling thread (via ScrollingTree).
     10
     11        Page::ensureWheelEventTestMonitor() had side-effects, so hide it, and have clients explicitly call Page::startMonitoringWheelEvents().
     12
     13        * page/Page.cpp:
     14        (WebCore::Page::startMonitoringWheelEvents):
     15        (WebCore::Page::ensureWheelEventTestMonitor):
     16        * page/Page.h:
     17        * testing/js/WebCoreTestSupport.cpp:
     18        (WebCoreTestSupport::monitorWheelEvents):
     19        (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring):
     20
    1212020-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
    222
  • trunk/Source/WebCore/page/Page.cpp

    r259772 r259820  
    26422642}
    26432643
     2644void Page::startMonitoringWheelEvents()
     2645{
     2646    ensureWheelEventTestMonitor().clearAllTestDeferrals();
     2647
     2648#if ENABLE(WHEEL_EVENT_LATCHING)
     2649    resetLatchingState();
     2650#endif
     2651
     2652    if (auto* frameView = mainFrame().view()) {
     2653        if (m_scrollingCoordinator) {
     2654            m_scrollingCoordinator->startMonitoringWheelEvents();
     2655            m_scrollingCoordinator->updateIsMonitoringWheelEventsForFrameView(*frameView);
     2656        }
     2657    }
     2658}
     2659
    26442660WheelEventTestMonitor& Page::ensureWheelEventTestMonitor()
    26452661{
    2646     if (!m_wheelEventTestMonitor) {
     2662    if (!m_wheelEventTestMonitor)
    26472663        m_wheelEventTestMonitor = adoptRef(new WheelEventTestMonitor(*this));
    2648         // We need to update the scrolling coordinator so that the mainframe scrolling node can expect wheel event test triggers.
    2649         if (auto* frameView = mainFrame().view()) {
    2650             if (m_scrollingCoordinator) {
    2651                 m_scrollingCoordinator->startMonitoringWheelEvents();
    2652                 m_scrollingCoordinator->updateIsMonitoringWheelEventsForFrameView(*frameView);
    2653             }
    2654         }
    2655     }
    26562664
    26572665    return *m_wheelEventTestMonitor;
  • trunk/Source/WebCore/page/Page.h

    r259523 r259820  
    653653
    654654    WEBCORE_EXPORT RefPtr<WheelEventTestMonitor> wheelEventTestMonitor() const;
    655     WEBCORE_EXPORT WheelEventTestMonitor& ensureWheelEventTestMonitor();
    656655    WEBCORE_EXPORT void clearWheelEventTestMonitor();
     656    WEBCORE_EXPORT void startMonitoringWheelEvents();
    657657    WEBCORE_EXPORT bool isMonitoringWheelEvents() const;
    658658
     
    778778
    779779    void doAfterUpdateRendering();
     780
     781    WheelEventTestMonitor& ensureWheelEventTestMonitor();
    780782
    781783    const std::unique_ptr<Chrome> m_chrome;
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r258679 r259820  
    139139void ScrollingCoordinatorMac::startMonitoringWheelEvents()
    140140{
     141    scrollingTree()->clearLatchedNode();
    141142    auto monitor = m_page->wheelEventTestMonitor();
    142143    scrollingTree()->setWheelEventTestMonitor(WTFMove(monitor));
  • trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp

    r258679 r259820  
    8686        return;
    8787
    88     page->ensureWheelEventTestMonitor().clearAllTestDeferrals();
     88    page->startMonitoringWheelEvents();
    8989}
    9090
     
    9696
    9797    JSValueProtect(context, jsCallbackFunction);
    98    
    99     page->ensureWheelEventTestMonitor().setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=](void) {
    100         JSObjectCallAsFunction(context, jsCallbackFunction, nullptr, 0, nullptr, nullptr);
    101         JSValueUnprotect(context, jsCallbackFunction);
    102     });
     98
     99    if (auto wheelEventTestMonitor = page->wheelEventTestMonitor()) {
     100        wheelEventTestMonitor->setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=](void) {
     101            JSObjectCallAsFunction(context, jsCallbackFunction, nullptr, 0, nullptr, nullptr);
     102            JSValueUnprotect(context, jsCallbackFunction);
     103        });
     104    }
    103105}
    104106
  • trunk/Source/WebKit/ChangeLog

    r259818 r259820  
     12020-04-09  Simon Fraser  <simon.fraser@apple.com>
     2
     3        eventSender.monitorWheelEvents() should clear latching state
     4        https://bugs.webkit.org/show_bug.cgi?id=210288
     5
     6        Reviewed by Tim Horton.
     7
     8        Use monitorWheelEvents() as a trigger to clear scroll latching state, both main-thread (via Page)
     9        and scrolling thread (via ScrollingTree).
     10
     11        Page::ensureWheelEventTestMonitor() had side-effects, so hide it, and have clients explicitly call Page::startMonitoringWheelEvents().
     12
     13        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     14        (WKBundlePageStartMonitoringScrollOperations):
     15        (WKBundlePageRegisterScrollOperationCompletionCallback):
     16
    1172020-04-09  Simon Fraser  <simon.fraser@apple.com>
    218
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r259159 r259820  
    703703        return;
    704704
    705     page->ensureWheelEventTestMonitor().clearAllTestDeferrals();
     705    page->startMonitoringWheelEvents();
    706706}
    707707
     
    716716        return false;
    717717   
    718     page->ensureWheelEventTestMonitor().setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=]() {
    719         callback(context);
    720     });
     718    if (auto wheelEventTestMonitor = page->wheelEventTestMonitor()) {
     719        wheelEventTestMonitor->setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=]() {
     720            callback(context);
     721        });
     722    }
    721723    return true;
    722724}
Note: See TracChangeset for help on using the changeset viewer.