Title: [270125] trunk/Source
Revision
270125
Author
[email protected]
Date
2020-11-20 11:37:33 -0800 (Fri, 20 Nov 2020)

Log Message

Rename some wheel-event handling functions for clarity
https://bugs.webkit.org/show_bug.cgi?id=219211

Reviewed by Tim Horton.
Source/WebCore:

There are too many functions called wheelEvent() or handleWheelEvent(), making it hard
to know which phase of handling they apply to. So rename some to handleWheelEventForScrolling(),
which applies to the "default handling" phase after DOM event dispatch.

In addition, make ScrollableArea's handleWheelEventForScrolling() virtual and have FrameView
override it (a future patch will also add an override in RenderLayer).

Rename ScrollingCoordinator::performDefaultWheelEventHandling() to use handleWheelEventForScrolling()
for clarity.

* page/EventHandler.cpp:
(WebCore::handleWheelEventInAppropriateEnclosingBox):
(WebCore::EventHandler::processWheelEventForScrolling):
(WebCore::EventHandler::defaultWheelEventHandler):
* page/FrameView.cpp:
(WebCore::FrameView::handleWheelEventForScrolling):
(WebCore::FrameView::wheelEvent): Deleted.
* page/FrameView.h:
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::determineWheelEventTarget):
(WebCore::EventHandler::processWheelEventForScrolling):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::handleWheelEventForScrolling):
(WebCore::ScrollingCoordinator::performDefaultWheelEventHandling): Deleted.
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::scrollTo):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::handleWheelEventForScrolling):
(WebCore::ScrollingCoordinatorMac::performDefaultWheelEventHandling): Deleted.
* page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
(WebCore::ScrollingCoordinatorNicosia::handleWheelEventForScrolling):
(WebCore::ScrollingCoordinatorNicosia::performDefaultWheelEventHandling): Deleted.
* page/scrolling/nicosia/ScrollingCoordinatorNicosia.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::handleWheelEventForScrolling):
(WebCore::ScrollableArea::handleWheelEvent): Deleted.
* platform/ScrollableArea.h:

Source/WebKit:

There are too many functions called wheelEvent() or handleWheelEvent(), making it hard
to know which phase of handling they apply to. So rename some to handleWheelEventForScrolling(),
which applies to the "default handling" phase after DOM event dispatch.

In addition, make ScrollableArea's handleWheelEventForScrolling() virtual and have FrameView
override it (a future patch will also add an override in RenderLayer).

Rename ScrollingCoordinator::performDefaultWheelEventHandling() to use handleWheelEventForScrolling()
for clarity.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270124 => 270125)


--- trunk/Source/WebCore/ChangeLog	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/ChangeLog	2020-11-20 19:37:33 UTC (rev 270125)
@@ -1,3 +1,49 @@
+2020-11-20  Simon Fraser  <[email protected]>
+
+        Rename some wheel-event handling functions for clarity
+        https://bugs.webkit.org/show_bug.cgi?id=219211
+
+        Reviewed by Tim Horton.
+
+        There are too many functions called wheelEvent() or handleWheelEvent(), making it hard
+        to know which phase of handling they apply to. So rename some to handleWheelEventForScrolling(),
+        which applies to the "default handling" phase after DOM event dispatch.
+        
+        In addition, make ScrollableArea's handleWheelEventForScrolling() virtual and have FrameView
+        override it (a future patch will also add an override in RenderLayer).
+        
+        Rename ScrollingCoordinator::performDefaultWheelEventHandling() to use handleWheelEventForScrolling()
+        for clarity.
+
+        * page/EventHandler.cpp:
+        (WebCore::handleWheelEventInAppropriateEnclosingBox):
+        (WebCore::EventHandler::processWheelEventForScrolling):
+        (WebCore::EventHandler::defaultWheelEventHandler):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::handleWheelEventForScrolling):
+        (WebCore::FrameView::wheelEvent): Deleted.
+        * page/FrameView.h:
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::determineWheelEventTarget):
+        (WebCore::EventHandler::processWheelEventForScrolling):
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::handleWheelEventForScrolling):
+        (WebCore::ScrollingCoordinator::performDefaultWheelEventHandling): Deleted.
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::scrollTo):
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::handleWheelEventForScrolling):
+        (WebCore::ScrollingCoordinatorMac::performDefaultWheelEventHandling): Deleted.
+        * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
+        (WebCore::ScrollingCoordinatorNicosia::handleWheelEventForScrolling):
+        (WebCore::ScrollingCoordinatorNicosia::performDefaultWheelEventHandling): Deleted.
+        * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::handleWheelEventForScrolling):
+        (WebCore::ScrollableArea::handleWheelEvent): Deleted.
+        * platform/ScrollableArea.h:
+
 2020-11-20  Zalan Bujtas  <[email protected]>
 
         [LFC][Integration] Enable inline-block

Modified: trunk/Source/WebCore/page/EventHandler.cpp (270124 => 270125)


--- trunk/Source/WebCore/page/EventHandler.cpp	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2020-11-20 19:37:33 UTC (rev 270125)
@@ -346,7 +346,7 @@
             bool scrollingWasHandled;
             if (platformEvent) {
                 auto copiedEvent = platformEvent->copyWithDeltasAndVelocity(filteredPlatformDelta.width(), filteredPlatformDelta.height(), filteredVelocity);
-                scrollingWasHandled = boxLayer->handleWheelEvent(copiedEvent);
+                scrollingWasHandled = boxLayer->handleWheelEventForScrolling(copiedEvent);
             } else
                 scrollingWasHandled = didScrollInScrollableArea(*boxLayer, wheelEvent);
 
@@ -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->wheelEvent(event) : false;
+    bool didHandleEvent = view ? view->handleWheelEventForScrolling(event) : false;
     m_isHandlingWheelEvent = false;
     return didHandleEvent;
 }
@@ -3025,7 +3025,7 @@
         auto platformEvent = wheelEvent.underlyingPlatformEvent();
         if (platformEvent) {
             auto copiedEvent = platformEvent->copyWithDeltasAndVelocity(filteredPlatformDelta.width(), filteredPlatformDelta.height(), filteredVelocity);
-            if (latchedScroller->handleWheelEvent(copiedEvent))
+            if (latchedScroller->handleWheelEventForScrolling(copiedEvent))
                 wheelEvent.setDefaultHandled();
             return;
         }

Modified: trunk/Source/WebCore/page/FrameView.cpp (270124 => 270125)


--- trunk/Source/WebCore/page/FrameView.cpp	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/FrameView.cpp	2020-11-20 19:37:33 UTC (rev 270125)
@@ -5098,7 +5098,7 @@
     ScrollView::removeChild(widget);
 }
 
-bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
+bool FrameView::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent)
 {
     // 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->performDefaultWheelEventHandling(wheelEvent, scrollingNodeID());
+            return scrollingCoordinator->handleWheelEventForScrolling(wheelEvent, scrollingNodeID());
     }
 #endif
 
-    return ScrollableArea::handleWheelEvent(wheelEvent);
+    return ScrollableArea::handleWheelEventForScrolling(wheelEvent);
 }
 
 bool FrameView::isVerticalDocument() const

Modified: trunk/Source/WebCore/page/FrameView.h (270124 => 270125)


--- trunk/Source/WebCore/page/FrameView.h	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/FrameView.h	2020-11-20 19:37:33 UTC (rev 270125)
@@ -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 wheelEvent(const PlatformWheelEvent&);
+    bool handleWheelEventForScrolling(const PlatformWheelEvent&) final;
 
     WEBCORE_EXPORT void setScrollingPerformanceLoggingEnabled(bool);
 

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (270124 => 270125)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2020-11-20 19:37:33 UTC (rev 270125)
@@ -871,7 +871,7 @@
             scrollableArea = makeWeakPtr(static_cast<ScrollableArea&>(*view));
     }
 
-    LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::determineWheelEventTarget() - event" << wheelEvent << " found scrollableArea " << ValueOrNull(scrollableArea.get()) << ", latching state is " << page->scrollLatchingController());
+    LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::determineWheelEventTarget() - event " << wheelEvent << " found scrollableArea " << ValueOrNull(scrollableArea.get()) << ", latching state is " << page->scrollLatchingController());
 
     if (scrollableArea && page->isMonitoringWheelEvents())
         scrollableArea->scrollAnimator().setWheelEventTestMonitor(page->wheelEventTestMonitor());
@@ -939,7 +939,7 @@
 
         LOG_WITH_STREAM(ScrollLatching, stream << " sending to view " << *view);
 
-        bool didHandleWheelEvent = view->wheelEvent(wheelEvent);
+        bool didHandleWheelEvent = view->handleWheelEventForScrolling(wheelEvent);
         // If the platform widget is handling the event, we always want to return false.
         if (view->platformWidget())
             didHandleWheelEvent = false;
@@ -948,7 +948,7 @@
         return didHandleWheelEvent;
     }
     
-    bool didHandleEvent = view->wheelEvent(wheelEvent);
+    bool didHandleEvent = view->handleWheelEventForScrolling(wheelEvent);
     m_isHandlingWheelEvent = false;
     return didHandleEvent;
 }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (270124 => 270125)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2020-11-20 19:37:33 UTC (rev 270125)
@@ -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 performDefaultWheelEventHandling(const PlatformWheelEvent&, ScrollingNodeID) { return false; }
+    virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID) { return false; }
     virtual void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, OptionSet<EventHandling>) { }
 
     // Create an unparented node.

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (270124 => 270125)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2020-11-20 19:37:33 UTC (rev 270125)
@@ -253,7 +253,7 @@
     m_currentScrollPosition = adjustedScrollPosition(position, clamp);
     
     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeScrollingNode " << scrollingNodeID() << " scrollTo " << position << " adjusted to "
-        << m_currentScrollPosition << " (" << scrollType << ") (delta from last committed position " << (m_lastCommittedScrollPosition - m_currentScrollPosition) << ")"
+        << m_currentScrollPosition << " (" << scrollType << ", " << clamp << ") (delta from last committed position " << (m_lastCommittedScrollPosition - m_currentScrollPosition) << ")"
         << " rubberbanding " << scrollingTree().isRubberBandInProgressForNode(scrollingNodeID()));
 
     updateViewportForCurrentScrollPosition();

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2020-11-20 19:37:33 UTC (rev 270125)
@@ -41,7 +41,7 @@
     void commitTreeStateIfNeeded() final;
 
     // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
-    bool performDefaultWheelEventHandling(const PlatformWheelEvent&, ScrollingNodeID) final;
+    bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID) final;
     void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, OptionSet<EventHandling>) final;
 
 private:

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2020-11-20 19:37:33 UTC (rev 270125)
@@ -73,7 +73,7 @@
     });
 }
 
-bool ScrollingCoordinatorMac::performDefaultWheelEventHandling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNode)
+bool ScrollingCoordinatorMac::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNodeID)
 {
     ASSERT(isMainThread());
     ASSERT(m_page);
@@ -81,11 +81,11 @@
     if (scrollingTree()->willWheelEventStartSwipeGesture(wheelEvent))
         return false;
 
-    LOG_WITH_STREAM(Scrolling, stream << "ScrollingCoordinatorMac::handleWheelEvent - sending event to scrolling thread");
+    LOG_WITH_STREAM(Scrolling, stream << "ScrollingCoordinatorMac::handleWheelEventForScrolling - sending event to scrolling thread, node " << targetNodeID);
     
     RefPtr<ThreadedScrollingTree> threadedScrollingTree = downcast<ThreadedScrollingTree>(scrollingTree());
-    ScrollingThread::dispatch([threadedScrollingTree, wheelEvent, targetNode] {
-        threadedScrollingTree->handleWheelEventAfterMainThread(wheelEvent, targetNode);
+    ScrollingThread::dispatch([threadedScrollingTree, wheelEvent, targetNodeID] {
+        threadedScrollingTree->handleWheelEventAfterMainThread(wheelEvent, targetNodeID);
     });
     return true;
 }

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


--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp	2020-11-20 19:37:33 UTC (rev 270125)
@@ -69,7 +69,7 @@
     m_scrollingStateTreeCommitterTimer.stop();
 }
 
-bool ScrollingCoordinatorNicosia::performDefaultWheelEventHandling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNode)
+bool ScrollingCoordinatorNicosia::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, ScrollingNodeID targetNode)
 {
     ASSERT(isMainThread());
     ASSERT(m_page);

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


--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.h	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.h	2020-11-20 19:37:33 UTC (rev 270125)
@@ -44,7 +44,7 @@
 
     void commitTreeStateIfNeeded() override;
 
-    bool performDefaultWheelEventHandling(const PlatformWheelEvent&, ScrollingNodeID) override;
+    bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID) override;
     void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, OptionSet<EventHandling>) override;
 
 private:

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (270124 => 270125)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2020-11-20 19:37:33 UTC (rev 270125)
@@ -203,7 +203,7 @@
         scrollAnimator().notifyContentAreaScrolled(scrollPosition() - oldPosition);
 }
 
-bool ScrollableArea::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
+bool ScrollableArea::handleWheelEventForScrolling(const PlatformWheelEvent& wheelEvent)
 {
     if (!isScrollableOrRubberbandable())
         return false;

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (270124 => 270125)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2020-11-20 19:37:33 UTC (rev 270125)
@@ -82,7 +82,7 @@
     // expect it to happen sometime in the future.
     virtual bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) { return false; }
 
-    WEBCORE_EXPORT bool handleWheelEvent(const PlatformWheelEvent&);
+    WEBCORE_EXPORT virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&);
 
     bool usesScrollSnap() const;
 

Modified: trunk/Source/WebKit/ChangeLog (270124 => 270125)


--- trunk/Source/WebKit/ChangeLog	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebKit/ChangeLog	2020-11-20 19:37:33 UTC (rev 270125)
@@ -1,3 +1,23 @@
+2020-11-20  Simon Fraser  <[email protected]>
+
+        Rename some wheel-event handling functions for clarity
+        https://bugs.webkit.org/show_bug.cgi?id=219211
+
+        Reviewed by Tim Horton.
+        
+        There are too many functions called wheelEvent() or handleWheelEvent(), making it hard
+        to know which phase of handling they apply to. So rename some to handleWheelEventForScrolling(),
+        which applies to the "default handling" phase after DOM event dispatch.
+        
+        In addition, make ScrollableArea's handleWheelEventForScrolling() virtual and have FrameView
+        override it (a future patch will also add an override in RenderLayer).
+        
+        Rename ScrollingCoordinator::performDefaultWheelEventHandling() to use handleWheelEventForScrolling()
+        for clarity.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::handleWheelEvent):
+
 2020-11-20  Ryan Haddad  <[email protected]>
 
         Unreviewed fix for my build fix.

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


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2020-11-20 19:12:53 UTC (rev 270124)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2020-11-20 19:37:33 UTC (rev 270125)
@@ -2938,7 +2938,7 @@
     PDFDisplayMode displayMode = [m_pdfLayerController displayMode];
 
     if (displayMode == kPDFDisplaySinglePageContinuous || displayMode == kPDFDisplayTwoUpContinuous)
-        return ScrollableArea::handleWheelEvent(platform(event));
+        return ScrollableArea::handleWheelEventForScrolling(platform(event));
 
     NSUInteger currentPageIndex = [m_pdfLayerController currentPageIndex];
     bool inFirstPage = !currentPageIndex;
@@ -2971,7 +2971,7 @@
         return true;
     }
 
-    return ScrollableArea::handleWheelEvent(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