Title: [270278] trunk/Source
Revision
270278
Author
[email protected]
Date
2020-11-30 17:29:36 -0800 (Mon, 30 Nov 2020)

Log Message

Pass OptionSet<EventHandling> to various wheel event handler functions
https://bugs.webkit.org/show_bug.cgi?id=219373

Reviewed by Tim Horton.

Source/WebCore:

Fixing webkit.org/b/218764 will require that code that dispatches wheel events
can tell later whether script called preventDefault() on the event, since this
will affect whether the rest of the wheel events in a gesture are cancelable.

To prepare for this, pass OptionSet<EventHandling> around in event handling
code.

No behavior change.

* dom/Element.cpp:
(WebCore::Element::dispatchWheelEvent):
* page/EventHandler.cpp:
(WebCore::handleWheelEventInAppropriateEnclosingBox):
(WebCore::EventHandler::processWheelEventForScrolling):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::handleWheelEventInternal):
(WebCore::EventHandler::defaultWheelEventHandler):
* page/EventHandler.h:
* page/FrameView.cpp:
(WebCore::FrameView::handleWheelEventForScrolling):
* page/FrameView.h:
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::wheelEvent):
(WebCore::EventHandler::processWheelEventForScrolling):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::handleWheelEventForScrolling):
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread):
* page/scrolling/ThreadedScrollingTree.h:
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::handleWheelEventForScrolling):
* page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
(WebCore::ScrollingCoordinatorNicosia::handleWheelEventForScrolling):
(WebCore::ScrollingCoordinatorNicosia::wheelEventWasProcessedByMainThread):
* page/scrolling/nicosia/ScrollingCoordinatorNicosia.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::handleWheelEventForScrolling):
* platform/ScrollableArea.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::handleWheelEventForScrolling):
* rendering/RenderLayer.h:

Source/WebKit:

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::handleWheelEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270277 => 270278)


--- trunk/Source/WebCore/ChangeLog	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/ChangeLog	2020-12-01 01:29:36 UTC (rev 270278)
@@ -1,3 +1,53 @@
+2020-11-30  Simon Fraser  <[email protected]>
+
+        Pass OptionSet<EventHandling> to various wheel event handler functions
+        https://bugs.webkit.org/show_bug.cgi?id=219373
+
+        Reviewed by Tim Horton.
+
+        Fixing webkit.org/b/218764 will require that code that dispatches wheel events
+        can tell later whether script called preventDefault() on the event, since this
+        will affect whether the rest of the wheel events in a gesture are cancelable.
+
+        To prepare for this, pass OptionSet<EventHandling> around in event handling
+        code.
+
+        No behavior change.
+
+        * dom/Element.cpp:
+        (WebCore::Element::dispatchWheelEvent):
+        * page/EventHandler.cpp:
+        (WebCore::handleWheelEventInAppropriateEnclosingBox):
+        (WebCore::EventHandler::processWheelEventForScrolling):
+        (WebCore::EventHandler::handleWheelEvent):
+        (WebCore::EventHandler::handleWheelEventInternal):
+        (WebCore::EventHandler::defaultWheelEventHandler):
+        * page/EventHandler.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::handleWheelEventForScrolling):
+        * page/FrameView.h:
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::wheelEvent):
+        (WebCore::EventHandler::processWheelEventForScrolling):
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::handleWheelEventForScrolling):
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread):
+        * page/scrolling/ThreadedScrollingTree.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::handleWheelEventForScrolling):
+        * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
+        (WebCore::ScrollingCoordinatorNicosia::handleWheelEventForScrolling):
+        (WebCore::ScrollingCoordinatorNicosia::wheelEventWasProcessedByMainThread):
+        * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::handleWheelEventForScrolling):
+        * platform/ScrollableArea.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::handleWheelEventForScrolling):
+        * rendering/RenderLayer.h:
+
 2020-11-30  Chris Dumez  <[email protected]>
 
         sessionStorage should not be cloned when a window is opened with rel=noopener

Modified: trunk/Source/WebCore/dom/Element.cpp (270277 => 270278)


--- trunk/Source/WebCore/dom/Element.cpp	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/dom/Element.cpp	2020-12-01 01:29:36 UTC (rev 270278)
@@ -437,7 +437,7 @@
 
     dispatchEvent(event);
     
-    LOG_WITH_STREAM(Scrolling, stream << "Element " << *this << " dispatchWheelEvent: defaultPrevented " << event->defaultPrevented() << " defaultHandled " << event->defaultHandled());
+    LOG_WITH_STREAM(Scrolling, stream << "Element " << *this << " dispatchWheelEvent: (cancelable " << event->cancelable() << ") defaultPrevented " << event->defaultPrevented() << " defaultHandled " << event->defaultHandled());
     
     if (event->defaultPrevented())
         processing.add(EventHandling::DefaultPrevented);

Modified: trunk/Source/WebCore/page/EventHandler.cpp (270277 => 270278)


--- trunk/Source/WebCore/page/EventHandler.cpp	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2020-12-01 01:29:36 UTC (rev 270278)
@@ -315,7 +315,7 @@
     return didHandleWheelEvent;
 }
 
-static bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, const WheelEvent& wheelEvent, const FloatSize& filteredPlatformDelta, const FloatSize& filteredVelocity)
+static bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, const WheelEvent& wheelEvent, const FloatSize& filteredPlatformDelta, const FloatSize& filteredVelocity, OptionSet<EventHandling> eventHandling)
 {
     bool shouldHandleEvent = wheelEvent.deltaX() || wheelEvent.deltaY();
 #if ENABLE(WHEEL_EVENT_LATCHING)
@@ -346,7 +346,7 @@
             bool scrollingWasHandled;
             if (platformEvent) {
                 auto copiedEvent = platformEvent->copyWithDeltasAndVelocity(filteredPlatformDelta.width(), filteredPlatformDelta.height(), filteredVelocity);
-                scrollingWasHandled = boxLayer->handleWheelEventForScrolling(copiedEvent);
+                scrollingWasHandled = boxLayer->handleWheelEventForScrolling(copiedEvent, eventHandling);
             } else
                 scrollingWasHandled = didScrollInScrollableArea(*boxLayer, wheelEvent);
 
@@ -2780,7 +2780,7 @@
         page->wheelEventDeltaFilter()->updateFromDelta(FloatSize(event.deltaX(), event.deltaY()));
 }
 
-bool EventHandler::processWheelEventForScrolling(const PlatformWheelEvent& event, const WeakPtr<ScrollableArea>&)
+bool EventHandler::processWheelEventForScrolling(const PlatformWheelEvent& event, const WeakPtr<ScrollableArea>&, OptionSet<EventHandling> eventHandling)
 {
     Ref<Frame> protectedFrame(m_frame);
 
@@ -2787,7 +2787,7 @@
     // We do another check on the frame view because the event handler can run JS which results in the frame getting destroyed.
     FrameView* view = m_frame.view();
     
-    bool didHandleEvent = view ? view->handleWheelEventForScrolling(event) : false;
+    bool didHandleEvent = view ? view->handleWheelEventForScrolling(event, eventHandling) : false;
     m_isHandlingWheelEvent = false;
     return didHandleEvent;
 }
@@ -2869,6 +2869,7 @@
 {
     OptionSet<EventHandling> handling;
     bool handled = handleWheelEventInternal(event, processingSteps, handling);
+    // wheelEventWasProcessedByMainThread() may have already been called via performDefaultWheelEventHandling(), but this ensures that it's always called if that code path doesn't run.
     wheelEventWasProcessedByMainThread(event, handling);
     return handled;
 }
@@ -2965,7 +2966,7 @@
 #endif
     if (allowScrolling) {
         // FIXME: processWheelEventForScrolling() is only called for FrameView scrolling, not overflow scrolling, which is confusing.
-        handledEvent = processWheelEventForScrolling(event, scrollableArea);
+        handledEvent = processWheelEventForScrolling(event, scrollableArea, handling);
         processWheelEventForScrollSnap(event, scrollableArea);
     }
 
@@ -3007,6 +3008,10 @@
         filteredPlatformDelta.setHeight(platformWheelEvent->deltaY());
     }
 
+    OptionSet<EventHandling> eventHandling = { EventHandling::DispatchedToDOM };
+    if (wheelEvent.defaultPrevented())
+        eventHandling.add(EventHandling::DefaultPrevented);
+
 #if ENABLE(WHEEL_EVENT_LATCHING)
     if (m_frame.page()->wheelEventDeltaFilter()->isFilteringDeltas()) {
         filteredPlatformDelta = m_frame.page()->wheelEventDeltaFilter()->filteredDelta();
@@ -3026,7 +3031,7 @@
         auto platformEvent = wheelEvent.underlyingPlatformEvent();
         if (platformEvent) {
             auto copiedEvent = platformEvent->copyWithDeltasAndVelocity(filteredPlatformDelta.width(), filteredPlatformDelta.height(), filteredVelocity);
-            if (latchedScroller->handleWheelEventForScrolling(copiedEvent))
+            if (latchedScroller->handleWheelEventForScrolling(copiedEvent, eventHandling))
                 wheelEvent.setDefaultHandled();
             return;
         }
@@ -3033,7 +3038,7 @@
     }
 #endif
 
-    if (handleWheelEventInAppropriateEnclosingBox(startNode, wheelEvent, filteredPlatformDelta, filteredVelocity))
+    if (handleWheelEventInAppropriateEnclosingBox(startNode, wheelEvent, filteredPlatformDelta, filteredVelocity, eventHandling))
         wheelEvent.setDefaultHandled();
 }
 

Modified: trunk/Source/WebCore/page/EventHandler.h (270277 => 270278)


--- trunk/Source/WebCore/page/EventHandler.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/EventHandler.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -459,7 +459,7 @@
     bool passWheelEventToWidget(const PlatformWheelEvent&, Widget&, OptionSet<WheelEventProcessingSteps>);
     void determineWheelEventTarget(const PlatformWheelEvent&, RefPtr<Element>& eventTarget, WeakPtr<ScrollableArea>&, bool& isOverWidget);
     void recordWheelEventForDeltaFilter(const PlatformWheelEvent&);
-    bool processWheelEventForScrolling(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&);
+    bool processWheelEventForScrolling(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&, OptionSet<EventHandling>);
     void processWheelEventForScrollSnap(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&);
     bool completeWidgetWheelEvent(const PlatformWheelEvent&, const WeakPtr<Widget>&, const WeakPtr<ScrollableArea>&);
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (270277 => 270278)


--- trunk/Source/WebCore/page/FrameView.cpp	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/FrameView.cpp	2020-12-01 01:29:36 UTC (rev 270278)
@@ -5098,7 +5098,7 @@
     ScrollView::removeChild(widget);
 }
 
-bool FrameView::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent)
+bool FrameView::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, OptionSet<EventHandling> eventHandling)
 {
     // Note that to allow for rubber-band over-scroll behavior, even non-scrollable views
     // should handle wheel events.
@@ -5128,11 +5128,11 @@
 #if ENABLE(ASYNC_SCROLLING)
     if (auto scrollingCoordinator = this->scrollingCoordinator()) {
         if (scrollingCoordinator->coordinatesScrollingForFrameView(*this))
-            return scrollingCoordinator->handleWheelEventForScrolling(wheelEvent, scrollingNodeID());
+            return scrollingCoordinator->handleWheelEventForScrolling(wheelEvent, scrollingNodeID(), eventHandling);
     }
 #endif
 
-    return ScrollableArea::handleWheelEventForScrolling(wheelEvent);
+    return ScrollableArea::handleWheelEventForScrolling(wheelEvent, eventHandling);
 }
 
 bool FrameView::isVerticalDocument() const

Modified: trunk/Source/WebCore/page/FrameView.h (270277 => 270278)


--- trunk/Source/WebCore/page/FrameView.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/FrameView.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -565,7 +565,7 @@
     // This function exists for ports that need to handle wheel events manually.
     // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
     // we need this function in order to do the scroll ourselves.
-    bool handleWheelEventForScrolling(const PlatformWheelEvent&) final;
+    bool handleWheelEventForScrolling(const PlatformWheelEvent&, OptionSet<EventHandling>) final;
 
     WEBCORE_EXPORT void setScrollingPerformanceLoggingEnabled(bool);
 

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (270277 => 270278)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-12-01 01:29:36 UTC (rev 270278)
@@ -147,7 +147,9 @@
         return false;
 
     CurrentEventScope scope(event, nil);
-    return handleWheelEvent(PlatformEventFactory::createPlatformWheelEvent(event, page->chrome().platformPageClient()), { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch });
+    auto wheelEvent = PlatformEventFactory::createPlatformWheelEvent(event, page->chrome().platformPageClient());
+    OptionSet<WheelEventProcessingSteps> processingSteps = { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch };
+    return handleWheelEvent(wheelEvent, processingSteps);
 }
 
 bool EventHandler::keyEvent(NSEvent *event)
@@ -904,7 +906,7 @@
     page->wheelEventDeltaFilter()->updateFromDelta(FloatSize(wheelEvent.deltaX(), wheelEvent.deltaY()));
 }
 
-bool EventHandler::processWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, const WeakPtr<ScrollableArea>& scrollableArea)
+bool EventHandler::processWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, const WeakPtr<ScrollableArea>& scrollableArea, OptionSet<EventHandling> eventHandling)
 {
     LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::processWheelEventForScrolling " << wheelEvent << " - scrollableArea " << ValueOrNull(scrollableArea.get()) << " use latched element " << wheelEvent.useLatchedEventElement());
 
@@ -939,7 +941,7 @@
 
         LOG_WITH_STREAM(ScrollLatching, stream << " sending to view " << *view);
 
-        bool didHandleWheelEvent = view->handleWheelEventForScrolling(wheelEvent);
+        bool didHandleWheelEvent = view->handleWheelEventForScrolling(wheelEvent, eventHandling);
         // If the platform widget is handling the event, we always want to return false.
         if (view->platformWidget())
             didHandleWheelEvent = false;
@@ -948,7 +950,7 @@
         return didHandleWheelEvent;
     }
     
-    bool didHandleEvent = view->handleWheelEventForScrolling(wheelEvent);
+    bool didHandleEvent = view->handleWheelEventForScrolling(wheelEvent, eventHandling);
     m_isHandlingWheelEvent = false;
     return didHandleEvent;
 }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (270277 => 270278)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -127,7 +127,7 @@
     // These virtual functions are currently unique to the threaded scrolling architecture. 
     virtual void commitTreeStateIfNeeded() { }
     virtual bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped) { return false; }
-    virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID) { return false; }
+    virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID, OptionSet<EventHandling>) { return false; }
     virtual void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, OptionSet<EventHandling>) { }
 
     // Create an unparented node.

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (270277 => 270278)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-12-01 01:29:36 UTC (rev 270278)
@@ -64,7 +64,7 @@
     return ScrollingTree::handleWheelEvent(wheelEvent, processingSteps);
 }
 
-bool ThreadedScrollingTree::handleWheelEventAfterMainThread(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNodeID)
+bool ThreadedScrollingTree::handleWheelEventAfterMainThread(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNodeID, OptionSet<EventHandling>)
 {
     LOG_WITH_STREAM(Scrolling, stream << "ThreadedScrollingTree::handleWheelEventAfterMainThread " << wheelEvent << " node " << targetNodeID);
 

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (270277 => 270278)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -47,7 +47,7 @@
 
     WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, OptionSet<WheelEventProcessingSteps>) override;
 
-    bool handleWheelEventAfterMainThread(const PlatformWheelEvent&, ScrollingNodeID);
+    bool handleWheelEventAfterMainThread(const PlatformWheelEvent&, ScrollingNodeID, OptionSet<EventHandling>);
     void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, OptionSet<EventHandling>);
 
     void invalidate() override;

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -41,7 +41,7 @@
     void commitTreeStateIfNeeded() final;
 
     // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
-    bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID) final;
+    bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID, OptionSet<EventHandling>) final;
     void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, OptionSet<EventHandling>) final;
 
 private:

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-12-01 01:29:36 UTC (rev 270278)
@@ -73,7 +73,7 @@
     });
 }
 
-bool ScrollingCoordinatorMac::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNodeID)
+bool ScrollingCoordinatorMac::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNodeID, OptionSet<EventHandling> eventHandling)
 {
     ASSERT(isMainThread());
     ASSERT(m_page);
@@ -84,8 +84,8 @@
     LOG_WITH_STREAM(Scrolling, stream << "ScrollingCoordinatorMac::handleWheelEventForScrolling - sending event to scrolling thread, node " << targetNodeID);
     
     RefPtr<ThreadedScrollingTree> threadedScrollingTree = downcast<ThreadedScrollingTree>(scrollingTree());
-    ScrollingThread::dispatch([threadedScrollingTree, wheelEvent, targetNodeID] {
-        threadedScrollingTree->handleWheelEventAfterMainThread(wheelEvent, targetNodeID);
+    ScrollingThread::dispatch([threadedScrollingTree, wheelEvent, targetNodeID, eventHandling] {
+        threadedScrollingTree->handleWheelEventAfterMainThread(wheelEvent, targetNodeID, eventHandling);
     });
     return true;
 }

Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp (270277 => 270278)


--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp	2020-12-01 01:29:36 UTC (rev 270278)
@@ -69,22 +69,22 @@
     m_scrollingStateTreeCommitterTimer.stop();
 }
 
-bool ScrollingCoordinatorNicosia::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNode)
+bool ScrollingCoordinatorNicosia::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNode, OptionSet<EventHandling> eventHandling)
 {
     ASSERT(isMainThread());
     ASSERT(m_page);
     ASSERT(scrollingTree());
 
-    ScrollingThread::dispatch([threadedScrollingTree = makeRef(downcast<ThreadedScrollingTree>(*scrollingTree())), wheelEvent, targetNode] {
-        threadedScrollingTree->handleWheelEventAfterMainThread(wheelEvent, targetNode);
+    ScrollingThread::dispatch([threadedScrollingTree = makeRef(downcast<ThreadedScrollingTree>(*scrollingTree())), wheelEvent, targetNode, eventHandling] {
+        threadedScrollingTree->handleWheelEventAfterMainThread(wheelEvent, targetNode, eventHandling);
     });
     return true;
 }
 
-void ScrollingCoordinatorNicosia::wheelEventWasProcessedByMainThread(const PlatformWheelEvent& wheelEvent, OptionSet<EventHandling> defaultHandling)
+void ScrollingCoordinatorNicosia::wheelEventWasProcessedByMainThread(const PlatformWheelEvent& wheelEvent, OptionSet<EventHandling> eventHandling)
 {
-    ScrollingThread::dispatch([threadedScrollingTree = makeRef(downcast<ThreadedScrollingTree>(*scrollingTree())), wheelEvent, defaultHandling] {
-        threadedScrollingTree->wheelEventWasProcessedByMainThread(wheelEvent, defaultHandling);
+    ScrollingThread::dispatch([threadedScrollingTree = makeRef(downcast<ThreadedScrollingTree>(*scrollingTree())), wheelEvent, eventHandling] {
+        threadedScrollingTree->wheelEventWasProcessedByMainThread(wheelEvent, eventHandling);
     });
 }
 

Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.h (270277 => 270278)


--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -44,7 +44,7 @@
 
     void commitTreeStateIfNeeded() override;
 
-    bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID) override;
+    bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID, OptionSet<EventHandling>) override;
     void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, OptionSet<EventHandling>) override;
 
 private:

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (270277 => 270278)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2020-12-01 01:29:36 UTC (rev 270278)
@@ -203,7 +203,7 @@
         scrollAnimator().notifyContentAreaScrolled(scrollPosition() - oldPosition);
 }
 
-bool ScrollableArea::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent)
+bool ScrollableArea::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, OptionSet<EventHandling>)
 {
     if (!isScrollableOrRubberbandable())
         return false;

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (270277 => 270278)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -48,6 +48,8 @@
 class GraphicsLayer;
 class TiledBacking;
 
+enum class EventHandling : uint8_t;
+
 inline int offsetForOrientation(ScrollOffset offset, ScrollbarOrientation orientation)
 {
     switch (orientation) {
@@ -82,7 +84,7 @@
     // expect it to happen sometime in the future.
     virtual bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) { return false; }
 
-    WEBCORE_EXPORT virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&);
+    WEBCORE_EXPORT virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&, OptionSet<EventHandling>);
 
     bool usesScrollSnap() const;
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (270277 => 270278)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-12-01 01:29:36 UTC (rev 270278)
@@ -3165,7 +3165,7 @@
     return backing()->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling);
 }
 
-bool RenderLayer::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent)
+bool RenderLayer::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, OptionSet<EventHandling> eventHandling)
 {
     if (!isScrollableOrRubberbandable())
         return false;
@@ -3173,11 +3173,11 @@
 #if ENABLE(ASYNC_SCROLLING)
     if (usesAsyncScrolling() && scrollingNodeID()) {
         if (auto* scrollingCoordinator = page().scrollingCoordinator())
-            return scrollingCoordinator->handleWheelEventForScrolling(wheelEvent, scrollingNodeID());
+            return scrollingCoordinator->handleWheelEventForScrolling(wheelEvent, scrollingNodeID(), eventHandling);
     }
 #endif
 
-    return ScrollableArea::handleWheelEventForScrolling(wheelEvent);
+    return ScrollableArea::handleWheelEventForScrolling(wheelEvent, eventHandling);
 }
 
 IntRect RenderLayer::visibleContentRectInternal(VisibleContentRectIncludesScrollbars scrollbarInclusion, VisibleContentRectBehavior) const

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (270277 => 270278)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2020-12-01 01:29:36 UTC (rev 270278)
@@ -493,7 +493,7 @@
     Scrollbar* verticalScrollbar() const final { return m_vBar.get(); }
     ScrollableArea* enclosingScrollableArea() const final;
 
-    bool handleWheelEventForScrolling(const PlatformWheelEvent&) final;
+    bool handleWheelEventForScrolling(const PlatformWheelEvent&, OptionSet<EventHandling>) final;
     bool isScrollableOrRubberbandable() final;
     bool hasScrollableOrRubberbandableAncestor() final;
     bool useDarkAppearance() const final;

Modified: trunk/Source/WebKit/ChangeLog (270277 => 270278)


--- trunk/Source/WebKit/ChangeLog	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebKit/ChangeLog	2020-12-01 01:29:36 UTC (rev 270278)
@@ -1,3 +1,13 @@
+2020-11-30  Simon Fraser  <[email protected]>
+
+        Pass OptionSet<EventHandling> to various wheel event handler functions
+        https://bugs.webkit.org/show_bug.cgi?id=219373
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::handleWheelEvent):
+
 2020-11-30  Tim Horton  <[email protected]>
 
         GPU Process: IOSurfaces should not be mapped into the Web Content Process

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (270277 => 270278)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2020-12-01 00:46:54 UTC (rev 270277)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2020-12-01 01:29:36 UTC (rev 270278)
@@ -2938,7 +2938,7 @@
     PDFDisplayMode displayMode = [m_pdfLayerController displayMode];
 
     if (displayMode == kPDFDisplaySinglePageContinuous || displayMode == kPDFDisplayTwoUpContinuous)
-        return ScrollableArea::handleWheelEventForScrolling(platform(event));
+        return ScrollableArea::handleWheelEventForScrolling(platform(event), { });
 
     NSUInteger currentPageIndex = [m_pdfLayerController currentPageIndex];
     bool inFirstPage = !currentPageIndex;
@@ -2971,7 +2971,7 @@
         return true;
     }
 
-    return ScrollableArea::handleWheelEventForScrolling(platform(event));
+    return ScrollableArea::handleWheelEventForScrolling(platform(event), { });
 }
 
 NSData *PDFPlugin::liveData() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to