Changeset 259416 in webkit


Ignore:
Timestamp:
Apr 2, 2020, 2:35:39 PM (5 years ago)
Author:
Simon Fraser
Message:

Rename some wheel-event related functions
https://bugs.webkit.org/show_bug.cgi?id=209918

Reviewed by Zalan Bujtas.

Rename some functions to describe what they do, rather than being generic "platform" things, to make
the code easier to read.

Similarly, rename m_clearLatchingStateTimer for what it does.

  • page/EventHandler.cpp:

(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clearLatchedStateTimerFired):
(WebCore::EventHandler::determineWheelEventTarget):
(WebCore::EventHandler::recordWheelEventForDeltaFilter):
(WebCore::EventHandler::processWheelEventForScrolling):
(WebCore::EventHandler::processWheelEventForScrollSnap):
(WebCore::EventHandler::completeWidgetWheelEvent):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::platformPrepareForWheelEvents): Deleted.
(WebCore::EventHandler::platformRecordWheelEvent): Deleted.
(WebCore::EventHandler::platformCompleteWheelEvent): Deleted.
(WebCore::EventHandler::platformNotifyIfEndGesture): Deleted.

  • page/EventHandler.h:
  • page/mac/EventHandlerMac.mm:

(WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
(WebCore::EventHandler::determineWheelEventTarget):
(WebCore::EventHandler::recordWheelEventForDeltaFilter):
(WebCore::EventHandler::processWheelEventForScrolling):
(WebCore::EventHandler::processWheelEventForScrollSnap):
(WebCore::EventHandler::platformPrepareForWheelEvents): Deleted.
(WebCore::EventHandler::platformRecordWheelEvent): Deleted.
(WebCore::EventHandler::platformCompleteWheelEvent): Deleted.
(WebCore::EventHandler::platformNotifyIfEndGesture): Deleted.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r259408 r259416  
     12020-04-02  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Rename some wheel-event related functions
     4        https://bugs.webkit.org/show_bug.cgi?id=209918
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Rename some functions to describe what they do, rather than being generic "platform" things, to make
     9        the code easier to read.
     10
     11        Similarly, rename m_clearLatchingStateTimer for what it does.
     12
     13        * page/EventHandler.cpp:
     14        (WebCore::EventHandler::EventHandler):
     15        (WebCore::EventHandler::clearLatchedStateTimerFired):
     16        (WebCore::EventHandler::determineWheelEventTarget):
     17        (WebCore::EventHandler::recordWheelEventForDeltaFilter):
     18        (WebCore::EventHandler::processWheelEventForScrolling):
     19        (WebCore::EventHandler::processWheelEventForScrollSnap):
     20        (WebCore::EventHandler::completeWidgetWheelEvent):
     21        (WebCore::EventHandler::handleWheelEvent):
     22        (WebCore::EventHandler::platformPrepareForWheelEvents): Deleted.
     23        (WebCore::EventHandler::platformRecordWheelEvent): Deleted.
     24        (WebCore::EventHandler::platformCompleteWheelEvent): Deleted.
     25        (WebCore::EventHandler::platformNotifyIfEndGesture): Deleted.
     26        * page/EventHandler.h:
     27        * page/mac/EventHandlerMac.mm:
     28        (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
     29        (WebCore::EventHandler::determineWheelEventTarget):
     30        (WebCore::EventHandler::recordWheelEventForDeltaFilter):
     31        (WebCore::EventHandler::processWheelEventForScrolling):
     32        (WebCore::EventHandler::processWheelEventForScrollSnap):
     33        (WebCore::EventHandler::platformPrepareForWheelEvents): Deleted.
     34        (WebCore::EventHandler::platformRecordWheelEvent): Deleted.
     35        (WebCore::EventHandler::platformCompleteWheelEvent): Deleted.
     36        (WebCore::EventHandler::platformNotifyIfEndGesture): Deleted.
     37
    1382020-04-02  Daniel Bates  <dabates@apple.com>
    239
  • trunk/Source/WebCore/page/EventHandler.cpp

    r259278 r259416  
    378378    , m_cursorUpdateTimer(*this, &EventHandler::cursorUpdateTimerFired)
    379379#if PLATFORM(MAC)
    380     , m_pendingMomentumWheelEventsTimer(*this, &EventHandler::clearLatchedState)
     380    , m_clearLatchingStateTimer(*this, &EventHandler::clearLatchedStateTimerFired)
    381381#endif
    382382    , m_autoscrollController(makeUnique<AutoscrollController>())
     
    27122712#endif
    27132713
     2714void EventHandler::clearLatchedStateTimerFired()
     2715{
     2716    LOG(ScrollLatching, "EventHandler %p clearLatchedStateTimerFired()", this);
     2717    clearLatchedState();
     2718}
     2719
    27142720#if !PLATFORM(MAC)
    27152721
    2716 void EventHandler::platformPrepareForWheelEvents(const PlatformWheelEvent&, const HitTestResult&, RefPtr<Element>&, RefPtr<ContainerNode>&, WeakPtr<ScrollableArea>&, bool&)
    2717 {
    2718 }
    2719 
    2720 void EventHandler::platformRecordWheelEvent(const PlatformWheelEvent& event)
     2722void EventHandler::determineWheelEventTarget(const PlatformWheelEvent&, const HitTestResult&, RefPtr<Element>&, RefPtr<ContainerNode>&, WeakPtr<ScrollableArea>&, bool&)
     2723{
     2724}
     2725
     2726void EventHandler::recordWheelEventForDeltaFilter(const PlatformWheelEvent& event)
    27212727{
    27222728    if (auto* page = m_frame.page())
     
    27242730}
    27252731
    2726 bool EventHandler::platformCompleteWheelEvent(const PlatformWheelEvent& event, ContainerNode*, const WeakPtr<ScrollableArea>&)
     2732bool EventHandler::processWheelEventForScrolling(const PlatformWheelEvent& event, ContainerNode*, const WeakPtr<ScrollableArea>&)
    27272733{
    27282734    Ref<Frame> protectedFrame(m_frame);
     
    27412747}
    27422748
    2743 void EventHandler::platformNotifyIfEndGesture(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&)
     2749void EventHandler::processWheelEventForScrollSnap(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&)
    27442750{
    27452751}
     
    28022808        scrollableArea->setScrollShouldClearLatchedState(false);
    28032809
    2804     platformNotifyIfEndGesture(event, scrollableArea);
     2810    processWheelEventForScrollSnap(event, scrollableArea);
    28052811
    28062812    if (!widget->platformWidget())
     
    28492855    WeakPtr<ScrollableArea> scrollableArea;
    28502856    bool isOverWidget = result.isOverWidget();
    2851     platformPrepareForWheelEvents(event, result, element, scrollableContainer, scrollableArea, isOverWidget);
     2857    determineWheelEventTarget(event, result, element, scrollableContainer, scrollableArea, isOverWidget);
    28522858
    28532859#if ENABLE(WHEEL_EVENT_LATCHING)
     
    28592865    // Instead, the handlers should know convert vertical scrolls appropriately.
    28602866    PlatformWheelEvent adjustedEvent = shouldSwapScrollDirection(result, event) ? event.copySwappingDirection() : event;
    2861     platformRecordWheelEvent(adjustedEvent);
     2867    recordWheelEventForDeltaFilter(adjustedEvent);
    28622868
    28632869    if (element) {
     
    28772883            }
    28782884
    2879             platformNotifyIfEndGesture(adjustedEvent, scrollableArea);
     2885            processWheelEventForScrollSnap(adjustedEvent, scrollableArea);
    28802886            return true;
    28812887        }
     
    28852891        scrollableArea->setScrollShouldClearLatchedState(false);
    28862892
    2887     bool handledEvent = platformCompleteWheelEvent(adjustedEvent, scrollableContainer.get(), scrollableArea);
    2888     platformNotifyIfEndGesture(adjustedEvent, scrollableArea);
     2893    bool handledEvent = processWheelEventForScrolling(adjustedEvent, scrollableContainer.get(), scrollableArea);
     2894    processWheelEventForScrollSnap(adjustedEvent, scrollableArea);
    28892895    return handledEvent;
    28902896}
  • trunk/Source/WebCore/page/EventHandler.h

    r259085 r259416  
    210210    bool handlePasteGlobalSelection(const PlatformMouseEvent&);
    211211
    212     void platformPrepareForWheelEvents(const PlatformWheelEvent&, const HitTestResult&, RefPtr<Element>& eventTarget, RefPtr<ContainerNode>& scrollableContainer, WeakPtr<ScrollableArea>&, bool& isOverWidget);
    213     void platformRecordWheelEvent(const PlatformWheelEvent&);
    214     bool platformCompleteWheelEvent(const PlatformWheelEvent&, ContainerNode* scrollableContainer, const WeakPtr<ScrollableArea>&);
     212    void determineWheelEventTarget(const PlatformWheelEvent&, const HitTestResult&, RefPtr<Element>& eventTarget, RefPtr<ContainerNode>& scrollableContainer, WeakPtr<ScrollableArea>&, bool& isOverWidget);
     213    void recordWheelEventForDeltaFilter(const PlatformWheelEvent&);
     214    bool processWheelEventForScrolling(const PlatformWheelEvent&, ContainerNode* scrollableContainer, const WeakPtr<ScrollableArea>&);
     215    void processWheelEventForScrollSnap(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&);
     216
    215217    bool platformCompletePlatformWidgetWheelEvent(const PlatformWheelEvent&, const Widget&, ContainerNode* scrollableContainer);
    216     void platformNotifyIfEndGesture(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&);
    217218
    218219#if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS)
     
    496497
    497498    void clearOrScheduleClearingLatchedStateIfNeeded(const PlatformWheelEvent&);
     499    void clearLatchedStateTimerFired();
    498500    void clearLatchedState();
    499501
     
    527529
    528530#if PLATFORM(MAC)
    529     Timer m_pendingMomentumWheelEventsTimer;
     531    Timer m_clearLatchingStateTimer;
    530532#endif
    531533
  • trunk/Source/WebCore/page/mac/EventHandlerMac.mm

    r259347 r259416  
    928928    // Logic below installs a timer when non-momentum scrolling ends. If momentum scroll does not start within that interval,
    929929    // reset the latched state. If it does, stop the timer, leaving the latched state untouched.
    930     if (!m_pendingMomentumWheelEventsTimer.isActive()) {
     930    if (!m_clearLatchingStateTimer.isActive()) {
    931931        if (event.isEndOfNonMomentumScroll()) {
    932932            LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::clearOrScheduleClearingLatchedStateIfNeeded() - event" << event << ", scheduling clear timer");
    933             m_pendingMomentumWheelEventsTimer.startOneShot(resetLatchedStateTimeout);
     933            m_clearLatchingStateTimer.startOneShot(resetLatchedStateTimeout);
    934934        }
    935935    } else {
     
    939939            if (auto* page = m_frame.page())
    940940                page->resetLatchingState();
    941             m_pendingMomentumWheelEventsTimer.stop();
     941            m_clearLatchingStateTimer.stop();
    942942        } else if (event.isTransitioningToMomentumScroll()) {
    943943            // Wheel events machinary is transitioning to momentum scrolling, so no need to reset latched state. Stop the timer.
    944             m_pendingMomentumWheelEventsTimer.stop();
     944            m_clearLatchingStateTimer.stop();
    945945        }
    946946    }
    947947}
    948948
    949 void EventHandler::platformPrepareForWheelEvents(const PlatformWheelEvent& wheelEvent, const HitTestResult& result, RefPtr<Element>& wheelEventTarget, RefPtr<ContainerNode>& scrollableContainer, WeakPtr<ScrollableArea>& scrollableArea, bool& isOverWidget)
     949void EventHandler::determineWheelEventTarget(const PlatformWheelEvent& wheelEvent, const HitTestResult& result, RefPtr<Element>& wheelEventTarget, RefPtr<ContainerNode>& scrollableContainer, WeakPtr<ScrollableArea>& scrollableArea, bool& isOverWidget)
    950950{
    951951    clearOrScheduleClearingLatchedStateIfNeeded(wheelEvent);
     
    972972            }
    973973
    974             LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::platformPrepareForWheelEvents() - event" << wheelEvent << " found scrollableContainer" << ValueOrNull(scrollableContainer.get()) << " scrollableArea " << (scrollableArea ? scrollableArea.get() : nullptr));
     974            LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::determineWheelEventTarget() - event" << wheelEvent << " found scrollableContainer" << ValueOrNull(scrollableContainer.get()) << " scrollableArea " << (scrollableArea ? scrollableArea.get() : nullptr));
    975975        }
    976976    }
     
    996996            }
    997997
    998             LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::platformPrepareForWheelEvents() - considering latching for " << wheelEvent << ", at scroll limit " << startingAtScrollLimit << ", latching state " << page->latchingStateStack());
     998            LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::determineWheelEventTarget() - considering latching for " << wheelEvent << ", at scroll limit " << startingAtScrollLimit << ", latching state " << page->latchingStateStack());
    999999        }
    10001000    } else if (wheelEvent.shouldResetLatching()) {
    10011001        clearLatchedState();
    1002         LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::platformPrepareForWheelEvents() - reset latching for event " << wheelEvent << " latching state " << page->latchingStateStack());
     1002        LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::determineWheelEventTarget() - reset latching for event " << wheelEvent << " latching state " << page->latchingStateStack());
    10031003    }
    10041004
     
    10211021}
    10221022
    1023 void EventHandler::platformRecordWheelEvent(const PlatformWheelEvent& wheelEvent)
     1023void EventHandler::recordWheelEventForDeltaFilter(const PlatformWheelEvent& wheelEvent)
    10241024{
    10251025    auto* page = m_frame.page();
     
    10481048}
    10491049
    1050 bool EventHandler::platformCompleteWheelEvent(const PlatformWheelEvent& wheelEvent, ContainerNode* scrollableContainer, const WeakPtr<ScrollableArea>& scrollableArea)
    1051 {
    1052     LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::platformCompleteWheelEvent " << wheelEvent << " - scrollableContainer " << scrollableContainer << " scrollableArea " << scrollableArea.get() << " use latched element " << wheelEvent.useLatchedEventElement());
     1050bool EventHandler::processWheelEventForScrolling(const PlatformWheelEvent& wheelEvent, ContainerNode* scrollableContainer, const WeakPtr<ScrollableArea>& scrollableArea)
     1051{
     1052    LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::processWheelEventForScrolling " << wheelEvent << " - scrollableContainer " << scrollableContainer << " scrollableArea " << scrollableArea.get() << " use latched element " << wheelEvent.useLatchedEventElement());
    10531053
    10541054    Ref<Frame> protectedFrame(m_frame);
     
    10691069        if (!frameHasPlatformWidget(m_frame) && !latchingState->startedGestureAtScrollLimit() && scrollableContainer == latchingState->scrollableContainer() && scrollableArea && view != scrollableArea) {
    10701070            // If we did not start at the scroll limit, do not pass the event on to be handled by enclosing scrollable regions.
    1071             LOG_WITH_STREAM(Scrolling, stream << "EventHandler " << this << " platformCompleteWheelEvent - latched to " << scrollableArea.get() << " and not propagating");
     1071            LOG_WITH_STREAM(Scrolling, stream << "EventHandler " << this << " processWheelEventForScrolling - latched to " << scrollableArea.get() << " and not propagating");
    10721072            return true;
    10731073        }
     
    11131113}
    11141114
    1115 void EventHandler::platformNotifyIfEndGesture(const PlatformWheelEvent& wheelEvent, const WeakPtr<ScrollableArea>& scrollableArea)
     1115void EventHandler::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent, const WeakPtr<ScrollableArea>& scrollableArea)
    11161116{
    11171117    if (!scrollableArea)
Note: See TracChangeset for help on using the changeset viewer.