Changeset 269659 in webkit
- Timestamp:
- Nov 10, 2020, 4:28:59 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 20 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/WheelEvent.h (modified) (1 diff)
-
WebCore/page/EventHandler.cpp (modified) (2 diffs)
-
WebCore/page/WheelEventTestMonitor.cpp (modified) (1 diff)
-
WebCore/page/mac/EventHandlerMac.mm (modified) (3 diffs)
-
WebCore/page/scrolling/ScrollingTree.cpp (modified) (1 diff)
-
WebCore/page/scrolling/ScrollingTreeGestureState.cpp (modified) (2 diffs)
-
WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (modified) (1 diff)
-
WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (modified) (2 diffs)
-
WebCore/platform/PlatformWheelEvent.cpp (modified) (1 diff)
-
WebCore/platform/PlatformWheelEvent.h (modified) (4 diffs)
-
WebCore/platform/ScrollAnimator.cpp (modified) (1 diff)
-
WebCore/platform/cocoa/ScrollController.mm (modified) (7 diffs)
-
WebCore/platform/mac/PlatformEventFactoryMac.mm (modified) (1 diff)
-
WebCore/platform/mac/ScrollAnimatorMac.mm (modified) (3 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm (modified) (1 diff)
-
WebKit/WebProcess/WebPage/EventDispatcher.cpp (modified) (1 diff)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/DOM/WebDOMOperations.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269658 r269659 1 2020-11-10 Simon Fraser <simon.fraser@apple.com> 2 3 Make PlatformWheelEventPhase an enum class 4 https://bugs.webkit.org/show_bug.cgi?id=218772 5 6 Reviewed by Tim Horton. 7 8 Change PlatformWheelEventPhase to be an enum class. 9 10 Changed code that maps between NSEventPhase and PlatformWheelEventPhase to not 11 treat NSEventPhase as a set of bits, since it only ever contains one of the bits. 12 13 * dom/WheelEvent.h: 14 * page/EventHandler.cpp: 15 (WebCore::handleWheelEventPhaseInScrollableArea): 16 (WebCore::handleWheelEventInAppropriateEnclosingBox): 17 * page/WheelEventTestMonitor.cpp: 18 (WebCore::WheelEventTestMonitor::receivedWheelEvent): 19 * page/mac/EventHandlerMac.mm: 20 (WebCore::findEnclosingScrollableContainer): 21 (WebCore::EventHandler::recordWheelEventForDeltaFilter): 22 (WebCore::EventHandler::processWheelEventForScrollSnap): 23 * page/scrolling/ScrollingTree.cpp: 24 (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): 25 * page/scrolling/ScrollingTreeGestureState.cpp: 26 (WebCore::ScrollingTreeGestureState::handleGestureCancel): 27 (WebCore::ScrollingTreeGestureState::nodeDidHandleEvent): 28 * page/scrolling/ScrollingTreeScrollingNode.cpp: 29 (WebCore::ScrollingTreeScrollingNode::canHandleWheelEvent const): 30 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 31 (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): 32 * platform/PlatformWheelEvent.cpp: 33 (WebCore::operator<<): 34 * platform/PlatformWheelEvent.h: 35 (WebCore::PlatformWheelEvent::useLatchedEventElement const): 36 (WebCore::PlatformWheelEvent::isGestureStart const): 37 (WebCore::PlatformWheelEvent::isGestureContinuation const): 38 (WebCore::PlatformWheelEvent::shouldResetLatching const): 39 (WebCore::PlatformWheelEvent::isNonGestureEvent const): 40 (WebCore::PlatformWheelEvent::isEndOfMomentumScroll const): 41 (WebCore::PlatformWheelEvent::isGestureBegin const): 42 (WebCore::PlatformWheelEvent::isGestureCancel const): 43 (WebCore::PlatformWheelEvent::isEndOfNonMomentumScroll const): 44 (WebCore::PlatformWheelEvent::isTransitioningToMomentumScroll const): 45 * platform/ScrollAnimator.cpp: 46 (WebCore::ScrollAnimator::handleWheelEvent): 47 * platform/cocoa/ScrollController.mm: 48 (WebCore::ScrollController::handleWheelEvent): 49 (WebCore::toWheelEventStatus): 50 * platform/mac/PlatformEventFactoryMac.mm: 51 (WebCore::phaseFromNSEventPhase): 52 (WebCore::momentumPhaseForEvent): 53 (WebCore::phaseForEvent): 54 * platform/mac/ScrollAnimatorMac.mm: 55 (WebCore::ScrollAnimatorMac::handleWheelEventPhase): 56 (WebCore::newGestureIsStarting): 57 (WebCore::gestureShouldBeginSnap): 58 1 59 2020-11-10 Geoffrey Garen <ggaren@apple.com> 2 60 -
trunk/Source/WebCore/dom/WheelEvent.h
r250060 r269659 70 70 71 71 #if PLATFORM(MAC) 72 PlatformWheelEventPhase phase() const { return m_underlyingPlatformEvent ? m_underlyingPlatformEvent.value().phase() : PlatformWheelEventPhase None; }73 PlatformWheelEventPhase momentumPhase() const { return m_underlyingPlatformEvent ? m_underlyingPlatformEvent.value().momentumPhase() : PlatformWheelEventPhase None; }72 PlatformWheelEventPhase phase() const { return m_underlyingPlatformEvent ? m_underlyingPlatformEvent.value().phase() : PlatformWheelEventPhase::None; } 73 PlatformWheelEventPhase momentumPhase() const { return m_underlyingPlatformEvent ? m_underlyingPlatformEvent.value().momentumPhase() : PlatformWheelEventPhase::None; } 74 74 #endif 75 75 -
trunk/Source/WebCore/page/EventHandler.cpp
r269587 r269659 295 295 { 296 296 #if PLATFORM(MAC) 297 if (wheelEvent.phase() == PlatformWheelEventPhase MayBegin || wheelEvent.phase() == PlatformWheelEventPhaseCancelled)297 if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin || wheelEvent.phase() == PlatformWheelEventPhase::Cancelled) 298 298 scrollableArea.scrollAnimator().handleWheelEventPhase(wheelEvent.phase()); 299 299 #else … … 320 320 bool shouldHandleEvent = wheelEvent.deltaX() || wheelEvent.deltaY(); 321 321 #if ENABLE(WHEEL_EVENT_LATCHING) 322 shouldHandleEvent |= wheelEvent.phase() == PlatformWheelEventPhase Ended;322 shouldHandleEvent |= wheelEvent.phase() == PlatformWheelEventPhase::Ended; 323 323 #if ENABLE(CSS_SCROLL_SNAP) 324 shouldHandleEvent |= wheelEvent.momentumPhase() == PlatformWheelEventPhase Ended;324 shouldHandleEvent |= wheelEvent.momentumPhase() == PlatformWheelEventPhase::Ended; 325 325 #endif 326 326 #endif -
trunk/Source/WebCore/page/WheelEventTestMonitor.cpp
r268075 r269659 111 111 { 112 112 #if ENABLE(KINETIC_SCROLLING) 113 if (event.phase() == PlatformWheelEventPhase Ended || event.phase() == PlatformWheelEventPhaseCancelled)113 if (event.phase() == PlatformWheelEventPhase::Ended || event.phase() == PlatformWheelEventPhase::Cancelled) 114 114 m_receivedWheelEndOrCancel = true; 115 115 116 if (event.momentumPhase() == PlatformWheelEventPhase Ended)116 if (event.momentumPhase() == PlatformWheelEventPhase::Ended) 117 117 m_receivedMomentumEnd = true; 118 118 #endif -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r268417 r269659 809 809 continue; 810 810 811 if (wheelEvent.phase() == PlatformWheelEventPhase MayBegin || wheelEvent.phase() == PlatformWheelEventPhaseCancelled)811 if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin || wheelEvent.phase() == PlatformWheelEventPhase::Cancelled) 812 812 return candidate; 813 813 … … 892 892 893 893 switch (wheelEvent.phase()) { 894 case PlatformWheelEventPhaseBegan:895 page->wheelEventDeltaFilter()->beginFilteringDeltas();896 break;897 case PlatformWheelEventPhaseEnded:898 page->wheelEventDeltaFilter()->endFilteringDeltas();899 break;900 default:901 break;894 case PlatformWheelEventPhase::Began: 895 page->wheelEventDeltaFilter()->beginFilteringDeltas(); 896 break; 897 case PlatformWheelEventPhase::Ended: 898 page->wheelEventDeltaFilter()->endFilteringDeltas(); 899 break; 900 default: 901 break; 902 902 } 903 903 page->wheelEventDeltaFilter()->updateFromDelta(FloatSize(wheelEvent.deltaX(), wheelEvent.deltaY())); … … 975 975 976 976 // Special case handling for ending wheel gesture to activate snap animation: 977 if (wheelEvent.phase() != PlatformWheelEventPhase Ended && wheelEvent.momentumPhase() != PlatformWheelEventPhaseEnded)977 if (wheelEvent.phase() != PlatformWheelEventPhase::Ended && wheelEvent.momentumPhase() != PlatformWheelEventPhase::Ended) 978 978 return; 979 979 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r269561 r269659 618 618 bool ScrollingTree::willWheelEventStartSwipeGesture(const PlatformWheelEvent& wheelEvent) 619 619 { 620 if (wheelEvent.phase() != PlatformWheelEventPhase Began)620 if (wheelEvent.phase() != PlatformWheelEventPhase::Began) 621 621 return false; 622 622 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeGestureState.cpp
r261431 r269659 52 52 if (event.isGestureCancel()) { 53 53 if (m_mayBeginNodeID) 54 m_scrollingTree.handleWheelEventPhase(*m_mayBeginNodeID, PlatformWheelEventPhase Cancelled);54 m_scrollingTree.handleWheelEventPhase(*m_mayBeginNodeID, PlatformWheelEventPhase::Cancelled); 55 55 return true; 56 56 } … … 62 62 { 63 63 switch (event.phase()) { 64 case PlatformWheelEventPhase MayBegin:64 case PlatformWheelEventPhase::MayBegin: 65 65 m_mayBeginNodeID = nodeID; 66 66 m_scrollingTree.handleWheelEventPhase(nodeID, event.phase()); 67 67 break; 68 case PlatformWheelEventPhase Cancelled:68 case PlatformWheelEventPhase::Cancelled: 69 69 // handleGestureCancel() should have been called first. 70 70 ASSERT_NOT_REACHED(); 71 71 break; 72 case PlatformWheelEventPhase Began:72 case PlatformWheelEventPhase::Began: 73 73 m_activeNodeID = nodeID; 74 74 m_scrollingTree.handleWheelEventPhase(nodeID, event.phase()); 75 75 break; 76 case PlatformWheelEventPhase Ended:76 case PlatformWheelEventPhase::Ended: 77 77 if (m_activeNodeID) 78 78 m_scrollingTree.handleWheelEventPhase(*m_activeNodeID, event.phase()); 79 79 break; 80 case PlatformWheelEventPhase Changed:81 case PlatformWheelEventPhase Stationary:82 case PlatformWheelEventPhase None:80 case PlatformWheelEventPhase::Changed: 81 case PlatformWheelEventPhase::Stationary: 82 case PlatformWheelEventPhase::None: 83 83 break; 84 84 } 85 85 86 86 switch (event.momentumPhase()) { 87 case PlatformWheelEventPhase MayBegin:88 case PlatformWheelEventPhase Cancelled:87 case PlatformWheelEventPhase::MayBegin: 88 case PlatformWheelEventPhase::Cancelled: 89 89 ASSERT_NOT_REACHED(); 90 90 break; 91 case PlatformWheelEventPhase Began:91 case PlatformWheelEventPhase::Began: 92 92 m_activeNodeID = nodeID; 93 93 m_scrollingTree.handleWheelEventPhase(nodeID, event.momentumPhase()); 94 94 break; 95 case PlatformWheelEventPhase Ended:95 case PlatformWheelEventPhase::Ended: 96 96 if (m_activeNodeID) 97 97 m_scrollingTree.handleWheelEventPhase(*m_activeNodeID, event.momentumPhase()); 98 98 break; 99 case PlatformWheelEventPhase Changed:100 case PlatformWheelEventPhase Stationary:101 case PlatformWheelEventPhase None:99 case PlatformWheelEventPhase::Changed: 100 case PlatformWheelEventPhase::Stationary: 101 case PlatformWheelEventPhase::None: 102 102 break; 103 103 } -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r269559 r269659 141 141 142 142 // MayBegin is used to flash scrollbars; if this node is scrollable, it can handle it. 143 if (wheelEvent.phase() == PlatformWheelEventPhase MayBegin)143 if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin) 144 144 return true; 145 145 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
r269559 r269659 125 125 bool wasInMomentumPhase = m_inMomentumPhase; 126 126 127 if (wheelEvent.momentumPhase() == PlatformWheelEventPhase Began)127 if (wheelEvent.momentumPhase() == PlatformWheelEventPhase::Began) 128 128 m_inMomentumPhase = true; 129 else if (wheelEvent.momentumPhase() == PlatformWheelEventPhase Ended || wheelEvent.momentumPhase() == PlatformWheelEventPhaseCancelled)129 else if (wheelEvent.momentumPhase() == PlatformWheelEventPhase::Ended || wheelEvent.momentumPhase() == PlatformWheelEventPhase::Cancelled) 130 130 m_inMomentumPhase = false; 131 131 … … 146 146 scrollingNode().setUserScrollInProgress(isInUserScroll); 147 147 148 // PlatformWheelEventPhase MayBegin fires when two fingers touch the trackpad, and is used to flash overlay scrollbars.148 // PlatformWheelEventPhase::MayBegin fires when two fingers touch the trackpad, and is used to flash overlay scrollbars. 149 149 // We know we're scrollable at this point, so handle the event. 150 if (wheelEvent.phase() == PlatformWheelEventPhase MayBegin)150 if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin) 151 151 return true; 152 152 -
trunk/Source/WebCore/platform/PlatformWheelEvent.cpp
r268417 r269659 36 36 { 37 37 switch (phase) { 38 case PlatformWheelEventPhase None: ts << "none"; break;39 case PlatformWheelEventPhase Began: ts << "began"; break;40 case PlatformWheelEventPhase Stationary: ts << "stationary"; break;41 case PlatformWheelEventPhase Changed: ts << "changed"; break;42 case PlatformWheelEventPhase Ended: ts << "ended"; break;43 case PlatformWheelEventPhase Cancelled: ts << "cancelled"; break;44 case PlatformWheelEventPhase MayBegin: ts << "mayBegin"; break;38 case PlatformWheelEventPhase::None: ts << "none"; break; 39 case PlatformWheelEventPhase::Began: ts << "began"; break; 40 case PlatformWheelEventPhase::Stationary: ts << "stationary"; break; 41 case PlatformWheelEventPhase::Changed: ts << "changed"; break; 42 case PlatformWheelEventPhase::Ended: ts << "ended"; break; 43 case PlatformWheelEventPhase::Cancelled: ts << "cancelled"; break; 44 case PlatformWheelEventPhase::MayBegin: ts << "mayBegin"; break; 45 45 } 46 46 return ts; -
trunk/Source/WebCore/platform/PlatformWheelEvent.h
r269143 r269659 57 57 #if ENABLE(KINETIC_SCROLLING) 58 58 59 enum PlatformWheelEventPhase : uint8_t {60 PlatformWheelEventPhaseNone= 0,61 PlatformWheelEventPhaseBegan= 1 << 0,62 PlatformWheelEventPhaseStationary= 1 << 1,63 PlatformWheelEventPhaseChanged= 1 << 2,64 PlatformWheelEventPhaseEnded= 1 << 3,65 PlatformWheelEventPhaseCancelled= 1 << 4,66 PlatformWheelEventPhaseMayBegin= 1 << 5,59 enum class PlatformWheelEventPhase : uint8_t { 60 None = 0, 61 Began = 1 << 0, 62 Stationary = 1 << 1, 63 Changed = 1 << 2, 64 Ended = 1 << 3, 65 Cancelled = 1 << 4, 66 MayBegin = 1 << 5, 67 67 }; 68 68 … … 184 184 185 185 #if ENABLE(KINETIC_SCROLLING) 186 PlatformWheelEventPhase m_phase { PlatformWheelEventPhase None };187 PlatformWheelEventPhase m_momentumPhase { PlatformWheelEventPhase None };186 PlatformWheelEventPhase m_phase { PlatformWheelEventPhase::None }; 187 PlatformWheelEventPhase m_momentumPhase { PlatformWheelEventPhase::None }; 188 188 #endif 189 189 bool m_hasPreciseScrollingDeltas { false }; … … 199 199 inline bool PlatformWheelEvent::useLatchedEventElement() const 200 200 { 201 return m_phase == PlatformWheelEventPhase Began202 || m_phase == PlatformWheelEventPhase Changed203 || m_momentumPhase == PlatformWheelEventPhase Began204 || m_momentumPhase == PlatformWheelEventPhase Changed205 || (m_phase == PlatformWheelEventPhase Ended && m_momentumPhase == PlatformWheelEventPhaseNone);201 return m_phase == PlatformWheelEventPhase::Began 202 || m_phase == PlatformWheelEventPhase::Changed 203 || m_momentumPhase == PlatformWheelEventPhase::Began 204 || m_momentumPhase == PlatformWheelEventPhase::Changed 205 || (m_phase == PlatformWheelEventPhase::Ended && m_momentumPhase == PlatformWheelEventPhase::None); 206 206 } 207 207 208 208 inline bool PlatformWheelEvent::isGestureStart() const 209 209 { 210 return m_phase == PlatformWheelEventPhase Began || m_phase == PlatformWheelEventPhaseMayBegin;210 return m_phase == PlatformWheelEventPhase::Began || m_phase == PlatformWheelEventPhase::MayBegin; 211 211 } 212 212 213 213 inline bool PlatformWheelEvent::isGestureContinuation() const 214 214 { 215 return m_phase == PlatformWheelEventPhase Changed;215 return m_phase == PlatformWheelEventPhase::Changed; 216 216 } 217 217 218 218 inline bool PlatformWheelEvent::shouldResetLatching() const 219 219 { 220 return m_phase == PlatformWheelEventPhase Cancelled || m_phase == PlatformWheelEventPhaseMayBegin || (m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseNone) || isEndOfMomentumScroll();220 return m_phase == PlatformWheelEventPhase::Cancelled || m_phase == PlatformWheelEventPhase::MayBegin || (m_phase == PlatformWheelEventPhase::None && m_momentumPhase == PlatformWheelEventPhase::None) || isEndOfMomentumScroll(); 221 221 } 222 222 223 223 inline bool PlatformWheelEvent::isNonGestureEvent() const 224 224 { 225 return m_phase == PlatformWheelEventPhase None && m_momentumPhase == PlatformWheelEventPhaseNone;225 return m_phase == PlatformWheelEventPhase::None && m_momentumPhase == PlatformWheelEventPhase::None; 226 226 } 227 227 228 228 inline bool PlatformWheelEvent::isEndOfMomentumScroll() const 229 229 { 230 return m_phase == PlatformWheelEventPhase None && m_momentumPhase == PlatformWheelEventPhaseEnded;230 return m_phase == PlatformWheelEventPhase::None && m_momentumPhase == PlatformWheelEventPhase::Ended; 231 231 } 232 232 … … 237 237 inline bool PlatformWheelEvent::isGestureBegin() const 238 238 { 239 return m_phase == PlatformWheelEventPhase MayBegin240 || m_phase == PlatformWheelEventPhase Began;239 return m_phase == PlatformWheelEventPhase::MayBegin 240 || m_phase == PlatformWheelEventPhase::Began; 241 241 } 242 242 243 243 inline bool PlatformWheelEvent::isGestureCancel() const 244 244 { 245 return m_phase == PlatformWheelEventPhase Cancelled;245 return m_phase == PlatformWheelEventPhase::Cancelled; 246 246 } 247 247 248 248 inline bool PlatformWheelEvent::isEndOfNonMomentumScroll() const 249 249 { 250 return m_phase == PlatformWheelEventPhase Ended && m_momentumPhase == PlatformWheelEventPhaseNone;250 return m_phase == PlatformWheelEventPhase::Ended && m_momentumPhase == PlatformWheelEventPhase::None; 251 251 } 252 252 253 253 inline bool PlatformWheelEvent::isTransitioningToMomentumScroll() const 254 254 { 255 return m_phase == PlatformWheelEventPhase None && m_momentumPhase == PlatformWheelEventPhaseBegan;255 return m_phase == PlatformWheelEventPhase::None && m_momentumPhase == PlatformWheelEventPhase::Began; 256 256 } 257 257 -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r269559 r269659 147 147 #endif 148 148 #if PLATFORM(COCOA) 149 // Events in the PlatformWheelEventPhase MayBegin phase have no deltas, and therefore never passes through the scroll handling logic below.149 // Events in the PlatformWheelEventPhase::MayBegin phase have no deltas, and therefore never passes through the scroll handling logic below. 150 150 // This causes us to return with an 'unhandled' return state, even though this event was successfully processed. 151 151 // 152 // We receive at least one PlatformWheelEventPhase MayBegin when starting main-thread scrolling (see FrameView::wheelEvent), which can152 // We receive at least one PlatformWheelEventPhase::MayBegin when starting main-thread scrolling (see FrameView::wheelEvent), which can 153 153 // fool the scrolling thread into attempting to handle the scroll, unless we treat the event as handled here. 154 if (e.phase() == PlatformWheelEventPhase MayBegin)154 if (e.phase() == PlatformWheelEventPhase::MayBegin) 155 155 return true; 156 156 #endif -
trunk/Source/WebCore/platform/cocoa/ScrollController.mm
r269559 r269659 124 124 return false; // FIXME: Why don't we report that we handled it? 125 125 #endif 126 if (wheelEvent.phase() == PlatformWheelEventPhase MayBegin || wheelEvent.phase() == PlatformWheelEventPhaseCancelled)126 if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin || wheelEvent.phase() == PlatformWheelEventPhase::Cancelled) 127 127 return false; 128 128 129 if (wheelEvent.phase() == PlatformWheelEventPhase Began) {129 if (wheelEvent.phase() == PlatformWheelEventPhase::Began) { 130 130 // FIXME: Trying to decide if a gesture is horizontal or vertical at the "began" phase is very error-prone. 131 131 auto direction = directionFromEvent(wheelEvent, ScrollEventAxis::Horizontal); … … 153 153 } 154 154 155 if (wheelEvent.phase() == PlatformWheelEventPhase Ended) {155 if (wheelEvent.phase() == PlatformWheelEventPhase::Ended) { 156 156 snapRubberBand(); 157 157 updateRubberBandingState(); … … 159 159 } 160 160 161 bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhase None);161 bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhase::None); 162 162 if (m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_snapRubberbandTimer)) { 163 if (wheelEvent.momentumPhase() == PlatformWheelEventPhase Ended) {163 if (wheelEvent.momentumPhase() == PlatformWheelEventPhase::Ended) { 164 164 m_ignoreMomentumScrolls = false; 165 165 return true; … … 208 208 209 209 // If we are starting momentum scrolling then do some setup. 210 if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhase Began || momentumPhase == PlatformWheelEventPhaseChanged))210 if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhase::Began || momentumPhase == PlatformWheelEventPhase::Changed)) 211 211 m_momentumScrollInProgress = true; 212 212 … … 317 317 } 318 318 319 if (m_momentumScrollInProgress && momentumPhase == PlatformWheelEventPhase Ended) {319 if (m_momentumScrollInProgress && momentumPhase == PlatformWheelEventPhase::Ended) { 320 320 m_momentumScrollInProgress = false; 321 321 m_ignoreMomentumScrolls = false; … … 613 613 static inline WheelEventStatus toWheelEventStatus(PlatformWheelEventPhase phase, PlatformWheelEventPhase momentumPhase) 614 614 { 615 if (phase == PlatformWheelEventPhase None) {615 if (phase == PlatformWheelEventPhase::None) { 616 616 switch (momentumPhase) { 617 case PlatformWheelEventPhase Began:617 case PlatformWheelEventPhase::Began: 618 618 return WheelEventStatus::MomentumScrollBegin; 619 619 620 case PlatformWheelEventPhase Changed:620 case PlatformWheelEventPhase::Changed: 621 621 return WheelEventStatus::MomentumScrolling; 622 622 623 case PlatformWheelEventPhase Ended:623 case PlatformWheelEventPhase::Ended: 624 624 return WheelEventStatus::MomentumScrollEnd; 625 625 626 case PlatformWheelEventPhase None:626 case PlatformWheelEventPhase::None: 627 627 return WheelEventStatus::StatelessScrollEvent; 628 628 … … 631 631 } 632 632 } 633 if (momentumPhase == PlatformWheelEventPhase None) {633 if (momentumPhase == PlatformWheelEventPhase::None) { 634 634 switch (phase) { 635 case PlatformWheelEventPhase Began:636 case PlatformWheelEventPhase MayBegin:635 case PlatformWheelEventPhase::Began: 636 case PlatformWheelEventPhase::MayBegin: 637 637 return WheelEventStatus::UserScrollBegin; 638 638 639 case PlatformWheelEventPhase Changed:639 case PlatformWheelEventPhase::Changed: 640 640 return WheelEventStatus::UserScrolling; 641 641 642 case PlatformWheelEventPhase Ended:643 case PlatformWheelEventPhase Cancelled:642 case PlatformWheelEventPhase::Ended: 643 case PlatformWheelEventPhase::Cancelled: 644 644 return WheelEventStatus::UserScrollEnd; 645 645 -
trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
r260366 r269659 170 170 } 171 171 172 static PlatformWheelEventPhase phaseFromNSEventPhase(NSEventPhase eventPhase) 173 { 174 switch (eventPhase) { 175 case NSEventPhaseNone: 176 return PlatformWheelEventPhase::None; 177 case NSEventPhaseBegan: 178 return PlatformWheelEventPhase::Began; 179 case NSEventPhaseStationary: 180 return PlatformWheelEventPhase::Stationary; 181 case NSEventPhaseChanged: 182 return PlatformWheelEventPhase::Changed; 183 case NSEventPhaseEnded: 184 return PlatformWheelEventPhase::Ended; 185 case NSEventPhaseCancelled: 186 return PlatformWheelEventPhase::Cancelled; 187 case NSEventPhaseMayBegin: 188 return PlatformWheelEventPhase::MayBegin; 189 } 190 191 return PlatformWheelEventPhase::None; 192 } 193 172 194 static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event) 173 195 { 174 uint32_t phase = PlatformWheelEventPhaseNone; 175 176 if ([event momentumPhase] & NSEventPhaseBegan) 177 phase |= PlatformWheelEventPhaseBegan; 178 if ([event momentumPhase] & NSEventPhaseStationary) 179 phase |= PlatformWheelEventPhaseStationary; 180 if ([event momentumPhase] & NSEventPhaseChanged) 181 phase |= PlatformWheelEventPhaseChanged; 182 if ([event momentumPhase] & NSEventPhaseEnded) 183 phase |= PlatformWheelEventPhaseEnded; 184 if ([event momentumPhase] & NSEventPhaseCancelled) 185 phase |= PlatformWheelEventPhaseCancelled; 186 187 return static_cast<PlatformWheelEventPhase>(phase); 196 return phaseFromNSEventPhase([event momentumPhase]); 188 197 } 189 198 190 199 static PlatformWheelEventPhase phaseForEvent(NSEvent *event) 191 200 { 192 uint32_t phase = PlatformWheelEventPhaseNone; 193 if ([event phase] & NSEventPhaseBegan) 194 phase |= PlatformWheelEventPhaseBegan; 195 if ([event phase] & NSEventPhaseStationary) 196 phase |= PlatformWheelEventPhaseStationary; 197 if ([event phase] & NSEventPhaseChanged) 198 phase |= PlatformWheelEventPhaseChanged; 199 if ([event phase] & NSEventPhaseEnded) 200 phase |= PlatformWheelEventPhaseEnded; 201 if ([event phase] & NSEventPhaseCancelled) 202 phase |= PlatformWheelEventPhaseCancelled; 203 if ([event momentumPhase] & NSEventPhaseMayBegin) 204 phase |= PlatformWheelEventPhaseMayBegin; 205 206 return static_cast<PlatformWheelEventPhase>(phase); 201 return phaseFromNSEventPhase([event phase]); 207 202 } 208 203 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r269373 r269659 1247 1247 m_haveScrolledSincePageLoad = true; 1248 1248 1249 // FIXME: Need to ensure we get PlatformWheelEventPhaseEnded.1250 if (phase == PlatformWheelEventPhase Began)1249 // FIXME: Need to ensure we get PlatformWheelEventPhase::Ended. 1250 if (phase == PlatformWheelEventPhase::Began) 1251 1251 didBeginScrollGesture(); 1252 else if (phase == PlatformWheelEventPhase Ended || phase == PlatformWheelEventPhaseCancelled)1252 else if (phase == PlatformWheelEventPhase::Ended || phase == PlatformWheelEventPhase::Cancelled) 1253 1253 didEndScrollGesture(); 1254 else if (phase == PlatformWheelEventPhase MayBegin)1254 else if (phase == PlatformWheelEventPhase::MayBegin) 1255 1255 mayBeginScrollGesture(); 1256 1256 } … … 1329 1329 static bool newGestureIsStarting(const PlatformWheelEvent& wheelEvent) 1330 1330 { 1331 return wheelEvent.phase() == PlatformWheelEventPhase MayBegin || wheelEvent.phase() == PlatformWheelEventPhaseBegan;1331 return wheelEvent.phase() == PlatformWheelEventPhase::MayBegin || wheelEvent.phase() == PlatformWheelEventPhase::Began; 1332 1332 } 1333 1333 … … 1351 1351 return false; 1352 1352 1353 if (wheelEvent.phase() != PlatformWheelEventPhase Ended && !wheelEvent.isEndOfMomentumScroll())1353 if (wheelEvent.phase() != PlatformWheelEventPhase::Ended && !wheelEvent.isEndOfMomentumScroll()) 1354 1354 return false; 1355 1355 -
trunk/Source/WebKit/ChangeLog
r269657 r269659 1 2020-11-10 Simon Fraser <simon.fraser@apple.com> 2 3 Make PlatformWheelEventPhase an enum class 4 https://bugs.webkit.org/show_bug.cgi?id=218772 5 6 Reviewed by Tim Horton. 7 8 Change PlatformWheelEventPhase to be an enum class. 9 10 Changed code that maps between NSEventPhase and PlatformWheelEventPhase to not 11 treat NSEventPhase as a set of bits, since it only ever contains one of the bits. 12 13 * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: 14 (WebKit::ScrollerPairMac::handleWheelEvent): 15 * WebProcess/WebPage/EventDispatcher.cpp: 16 (WebKit::EventDispatcher::wheelEvent): 17 1 18 2020-11-10 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm
r260366 r269659 145 145 { 146 146 switch (event.phase()) { 147 case WebCore::PlatformWheelEventPhase Began:147 case WebCore::PlatformWheelEventPhase::Began: 148 148 [m_scrollerImpPair beginScrollGesture]; 149 149 break; 150 case WebCore::PlatformWheelEventPhase Ended:151 case WebCore::PlatformWheelEventPhase Cancelled:150 case WebCore::PlatformWheelEventPhase::Ended: 151 case WebCore::PlatformWheelEventPhase::Cancelled: 152 152 [m_scrollerImpPair endScrollGesture]; 153 153 break; 154 case WebCore::PlatformWheelEventPhase MayBegin:154 case WebCore::PlatformWheelEventPhase::MayBegin: 155 155 [m_scrollerImpPair beginScrollGesture]; 156 156 [m_scrollerImpPair contentAreaScrolled]; -
trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp
r268664 r269659 135 135 // scrolling tree can be notified. 136 136 // We only need to do this at the beginning of the gesture. 137 if (platformWheelEvent.phase() == PlatformWheelEventPhase Began)137 if (platformWheelEvent.phase() == PlatformWheelEventPhase::Began) 138 138 scrollingTree->setMainFrameCanRubberBand({ canRubberBandAtTop, canRubberBandAtRight, canRubberBandAtBottom, canRubberBandAtLeft }); 139 139 -
trunk/Source/WebKitLegacy/mac/ChangeLog
r269648 r269659 1 2020-11-10 Simon Fraser <simon.fraser@apple.com> 2 3 Make PlatformWheelEventPhase an enum class 4 https://bugs.webkit.org/show_bug.cgi?id=218772 5 6 Reviewed by Tim Horton. 7 8 Change PlatformWheelEventPhase to be an enum class. 9 10 Changed code that maps between NSEventPhase and PlatformWheelEventPhase to not 11 treat NSEventPhase as a set of bits, since it only ever contains one of the bits. 12 13 * DOM/WebDOMOperations.mm: 14 (toNSEventPhase): 15 1 16 2020-11-10 Said Abou-Hallawa <said@apple.com> 2 17 -
trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm
r266295 r269659 252 252 static NSEventPhase toNSEventPhase(PlatformWheelEventPhase platformPhase) 253 253 { 254 uint32_t phase = PlatformWheelEventPhaseNone; 255 if (platformPhase & PlatformWheelEventPhaseBegan) 256 phase |= NSEventPhaseBegan; 257 if (platformPhase & PlatformWheelEventPhaseStationary) 258 phase |= NSEventPhaseStationary; 259 if (platformPhase & PlatformWheelEventPhaseChanged) 260 phase |= NSEventPhaseChanged; 261 if (platformPhase & PlatformWheelEventPhaseEnded) 262 phase |= NSEventPhaseEnded; 263 if (platformPhase & PlatformWheelEventPhaseCancelled) 264 phase |= NSEventPhaseCancelled; 265 if (platformPhase & PlatformWheelEventPhaseMayBegin) 266 phase |= NSEventPhaseMayBegin; 267 268 return static_cast<NSEventPhase>(phase); 254 switch (platformPhase) { 255 case PlatformWheelEventPhase::None: 256 return NSEventPhaseNone; 257 case PlatformWheelEventPhase::Began: 258 return NSEventPhaseBegan; 259 case PlatformWheelEventPhase::Stationary: 260 return NSEventPhaseStationary; 261 case PlatformWheelEventPhase::Changed: 262 return NSEventPhaseChanged; 263 case PlatformWheelEventPhase::Ended: 264 return NSEventPhaseEnded; 265 case PlatformWheelEventPhase::Cancelled: 266 return NSEventPhaseCancelled; 267 case PlatformWheelEventPhase::MayBegin: 268 return NSEventPhaseMayBegin; 269 } 270 271 return NSEventPhaseNone; 269 272 } 270 273
Note:
See TracChangeset
for help on using the changeset viewer.