Changeset 259416 in webkit
- Timestamp:
- Apr 2, 2020, 2:35:39 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r259408 r259416 1 2020-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 1 38 2020-04-02 Daniel Bates <dabates@apple.com> 2 39 -
trunk/Source/WebCore/page/EventHandler.cpp
r259278 r259416 378 378 , m_cursorUpdateTimer(*this, &EventHandler::cursorUpdateTimerFired) 379 379 #if PLATFORM(MAC) 380 , m_ pendingMomentumWheelEventsTimer(*this, &EventHandler::clearLatchedState)380 , m_clearLatchingStateTimer(*this, &EventHandler::clearLatchedStateTimerFired) 381 381 #endif 382 382 , m_autoscrollController(makeUnique<AutoscrollController>()) … … 2712 2712 #endif 2713 2713 2714 void EventHandler::clearLatchedStateTimerFired() 2715 { 2716 LOG(ScrollLatching, "EventHandler %p clearLatchedStateTimerFired()", this); 2717 clearLatchedState(); 2718 } 2719 2714 2720 #if !PLATFORM(MAC) 2715 2721 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)2722 void EventHandler::determineWheelEventTarget(const PlatformWheelEvent&, const HitTestResult&, RefPtr<Element>&, RefPtr<ContainerNode>&, WeakPtr<ScrollableArea>&, bool&) 2723 { 2724 } 2725 2726 void EventHandler::recordWheelEventForDeltaFilter(const PlatformWheelEvent& event) 2721 2727 { 2722 2728 if (auto* page = m_frame.page()) … … 2724 2730 } 2725 2731 2726 bool EventHandler::p latformCompleteWheelEvent(const PlatformWheelEvent& event, ContainerNode*, const WeakPtr<ScrollableArea>&)2732 bool EventHandler::processWheelEventForScrolling(const PlatformWheelEvent& event, ContainerNode*, const WeakPtr<ScrollableArea>&) 2727 2733 { 2728 2734 Ref<Frame> protectedFrame(m_frame); … … 2741 2747 } 2742 2748 2743 void EventHandler::p latformNotifyIfEndGesture(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&)2749 void EventHandler::processWheelEventForScrollSnap(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&) 2744 2750 { 2745 2751 } … … 2802 2808 scrollableArea->setScrollShouldClearLatchedState(false); 2803 2809 2804 p latformNotifyIfEndGesture(event, scrollableArea);2810 processWheelEventForScrollSnap(event, scrollableArea); 2805 2811 2806 2812 if (!widget->platformWidget()) … … 2849 2855 WeakPtr<ScrollableArea> scrollableArea; 2850 2856 bool isOverWidget = result.isOverWidget(); 2851 platformPrepareForWheelEvents(event, result, element, scrollableContainer, scrollableArea, isOverWidget);2857 determineWheelEventTarget(event, result, element, scrollableContainer, scrollableArea, isOverWidget); 2852 2858 2853 2859 #if ENABLE(WHEEL_EVENT_LATCHING) … … 2859 2865 // Instead, the handlers should know convert vertical scrolls appropriately. 2860 2866 PlatformWheelEvent adjustedEvent = shouldSwapScrollDirection(result, event) ? event.copySwappingDirection() : event; 2861 platformRecordWheelEvent(adjustedEvent);2867 recordWheelEventForDeltaFilter(adjustedEvent); 2862 2868 2863 2869 if (element) { … … 2877 2883 } 2878 2884 2879 p latformNotifyIfEndGesture(adjustedEvent, scrollableArea);2885 processWheelEventForScrollSnap(adjustedEvent, scrollableArea); 2880 2886 return true; 2881 2887 } … … 2885 2891 scrollableArea->setScrollShouldClearLatchedState(false); 2886 2892 2887 bool handledEvent = p latformCompleteWheelEvent(adjustedEvent, scrollableContainer.get(), scrollableArea);2888 p latformNotifyIfEndGesture(adjustedEvent, scrollableArea);2893 bool handledEvent = processWheelEventForScrolling(adjustedEvent, scrollableContainer.get(), scrollableArea); 2894 processWheelEventForScrollSnap(adjustedEvent, scrollableArea); 2889 2895 return handledEvent; 2890 2896 } -
trunk/Source/WebCore/page/EventHandler.h
r259085 r259416 210 210 bool handlePasteGlobalSelection(const PlatformMouseEvent&); 211 211 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 215 217 bool platformCompletePlatformWidgetWheelEvent(const PlatformWheelEvent&, const Widget&, ContainerNode* scrollableContainer); 216 void platformNotifyIfEndGesture(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&);217 218 218 219 #if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS) … … 496 497 497 498 void clearOrScheduleClearingLatchedStateIfNeeded(const PlatformWheelEvent&); 499 void clearLatchedStateTimerFired(); 498 500 void clearLatchedState(); 499 501 … … 527 529 528 530 #if PLATFORM(MAC) 529 Timer m_ pendingMomentumWheelEventsTimer;531 Timer m_clearLatchingStateTimer; 530 532 #endif 531 533 -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r259347 r259416 928 928 // Logic below installs a timer when non-momentum scrolling ends. If momentum scroll does not start within that interval, 929 929 // 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()) { 931 931 if (event.isEndOfNonMomentumScroll()) { 932 932 LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::clearOrScheduleClearingLatchedStateIfNeeded() - event" << event << ", scheduling clear timer"); 933 m_ pendingMomentumWheelEventsTimer.startOneShot(resetLatchedStateTimeout);933 m_clearLatchingStateTimer.startOneShot(resetLatchedStateTimeout); 934 934 } 935 935 } else { … … 939 939 if (auto* page = m_frame.page()) 940 940 page->resetLatchingState(); 941 m_ pendingMomentumWheelEventsTimer.stop();941 m_clearLatchingStateTimer.stop(); 942 942 } else if (event.isTransitioningToMomentumScroll()) { 943 943 // 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(); 945 945 } 946 946 } 947 947 } 948 948 949 void EventHandler:: platformPrepareForWheelEvents(const PlatformWheelEvent& wheelEvent, const HitTestResult& result, RefPtr<Element>& wheelEventTarget, RefPtr<ContainerNode>& scrollableContainer, WeakPtr<ScrollableArea>& scrollableArea, bool& isOverWidget)949 void EventHandler::determineWheelEventTarget(const PlatformWheelEvent& wheelEvent, const HitTestResult& result, RefPtr<Element>& wheelEventTarget, RefPtr<ContainerNode>& scrollableContainer, WeakPtr<ScrollableArea>& scrollableArea, bool& isOverWidget) 950 950 { 951 951 clearOrScheduleClearingLatchedStateIfNeeded(wheelEvent); … … 972 972 } 973 973 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)); 975 975 } 976 976 } … … 996 996 } 997 997 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()); 999 999 } 1000 1000 } else if (wheelEvent.shouldResetLatching()) { 1001 1001 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()); 1003 1003 } 1004 1004 … … 1021 1021 } 1022 1022 1023 void EventHandler:: platformRecordWheelEvent(const PlatformWheelEvent& wheelEvent)1023 void EventHandler::recordWheelEventForDeltaFilter(const PlatformWheelEvent& wheelEvent) 1024 1024 { 1025 1025 auto* page = m_frame.page(); … … 1048 1048 } 1049 1049 1050 bool EventHandler::p latformCompleteWheelEvent(const PlatformWheelEvent& wheelEvent, ContainerNode* scrollableContainer, const WeakPtr<ScrollableArea>& scrollableArea)1051 { 1052 LOG_WITH_STREAM(ScrollLatching, stream << "EventHandler::p latformCompleteWheelEvent" << wheelEvent << " - scrollableContainer " << scrollableContainer << " scrollableArea " << scrollableArea.get() << " use latched element " << wheelEvent.useLatchedEventElement());1050 bool 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()); 1053 1053 1054 1054 Ref<Frame> protectedFrame(m_frame); … … 1069 1069 if (!frameHasPlatformWidget(m_frame) && !latchingState->startedGestureAtScrollLimit() && scrollableContainer == latchingState->scrollableContainer() && scrollableArea && view != scrollableArea) { 1070 1070 // 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 << " p latformCompleteWheelEvent- latched to " << scrollableArea.get() << " and not propagating");1071 LOG_WITH_STREAM(Scrolling, stream << "EventHandler " << this << " processWheelEventForScrolling - latched to " << scrollableArea.get() << " and not propagating"); 1072 1072 return true; 1073 1073 } … … 1113 1113 } 1114 1114 1115 void EventHandler::p latformNotifyIfEndGesture(const PlatformWheelEvent& wheelEvent, const WeakPtr<ScrollableArea>& scrollableArea)1115 void EventHandler::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent, const WeakPtr<ScrollableArea>& scrollableArea) 1116 1116 { 1117 1117 if (!scrollableArea)
Note:
See TracChangeset
for help on using the changeset viewer.