diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp index 1a35ef10578c..94c013b6317e 100644 --- a/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp +++ b/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp @@ -199,7 +199,7 @@ void RemoteScrollingTree::deferWheelEventTestCompletionForReason(ScrollingNodeID { ASSERT(isMainRunLoop()); - if (!m_scrollingCoordinatorProxy) + if (!m_scrollingCoordinatorProxy || !isMonitoringWheelEvents()) return; m_scrollingCoordinatorProxy->deferWheelEventTestCompletionForReason(nodeID, reason); @@ -209,7 +209,7 @@ void RemoteScrollingTree::removeWheelEventTestCompletionDeferralForReason(Scroll { ASSERT(isMainRunLoop()); - if (!m_scrollingCoordinatorProxy) + if (!m_scrollingCoordinatorProxy || !isMonitoringWheelEvents()) return; m_scrollingCoordinatorProxy->removeWheelEventTestCompletionDeferralForReason(nodeID, reason); diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm b/Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm index b375c871e83f..838c42e36fca 100644 --- a/Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm +++ b/Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm @@ -323,6 +323,9 @@ void RemoteScrollingTreeMac::deferWheelEventTestCompletionForReason(ScrollingNodeID nodeID, WheelEventTestMonitor::DeferReason reason) { + if (!isMonitoringWheelEvents()) + return; + RunLoop::main().dispatch([strongThis = Ref { *this }, nodeID, reason] { if (auto* scrollingCoordinatorProxy = strongThis->scrollingCoordinatorProxy()) scrollingCoordinatorProxy->deferWheelEventTestCompletionForReason(nodeID, reason); @@ -331,6 +334,9 @@ void RemoteScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason(ScrollingNodeID nodeID, WheelEventTestMonitor::DeferReason reason) { + if (!isMonitoringWheelEvents()) + return; + RunLoop::main().dispatch([strongThis = Ref { *this }, nodeID, reason] { if (auto* scrollingCoordinatorProxy = strongThis->scrollingCoordinatorProxy()) scrollingCoordinatorProxy->removeWheelEventTestCompletionDeferralForReason(nodeID, reason);