Changeset 270312 in webkit
- Timestamp:
- Dec 1, 2020, 10:01:31 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/events/wheel/first-wheel-event-cancelable-expected.txt (added)
-
LayoutTests/fast/events/wheel/first-wheel-event-cancelable.html (added)
-
LayoutTests/fast/events/wheel/wheel-events-become-non-cancelable-expected.txt (added)
-
LayoutTests/fast/events/wheel/wheel-events-become-non-cancelable.html (added)
-
LayoutTests/platform/mac-wk2/fast/events/wheel (added)
-
LayoutTests/platform/mac-wk2/fast/events/wheel/wheel-events-become-non-cancelable-expected.txt (added)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/EventHandler.h (modified) (2 diffs)
-
Source/WebCore/page/ios/EventHandlerIOS.mm (modified) (1 diff)
-
Source/WebCore/page/mac/EventHandlerMac.mm (modified) (2 diffs)
-
Source/WebCore/platform/PlatformWheelEvent.cpp (modified) (1 diff)
-
Source/WebCore/platform/PlatformWheelEvent.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r270304 r270312 1 2020-11-30 Simon Fraser <simon.fraser@apple.com> 2 3 [WK1] Only the first wheel event in a gesture should be cancelable 4 https://bugs.webkit.org/show_bug.cgi?id=219384 5 6 Reviewed by Chris Dumez. 7 8 Add a temporary failing result for WK2 until the async scrolling implementation lands. 9 10 * fast/events/wheel/first-wheel-event-cancelable-expected.txt: Added. 11 * fast/events/wheel/first-wheel-event-cancelable.html: Added. 12 * fast/events/wheel/wheel-events-become-non-cancelable-expected.txt: Added. 13 * fast/events/wheel/wheel-events-become-non-cancelable.html: Added. 14 * platform/mac-wk2/fast/events/wheel/wheel-events-become-non-cancelable-expected.txt: Added. 15 * platform/win/TestExpectations: 16 1 17 2020-12-01 Youenn Fablet <youenn@apple.com> 2 18 -
trunk/LayoutTests/platform/win/TestExpectations
r270016 r270312 283 283 fast/events/wheel/wheel-event-listeners-on-window-made-passive.html [ Skip ] 284 284 fast/events/wheel/wheel-event-in-passive-region-non-cancelable.html [ Skip ] 285 fast/events/wheel/wheel-events-become-non-cancelable.html [ Skip ] 286 fast/events/wheel/first-wheel-event-cancelable.html [ Skip ] 285 287 286 288 scrollbars/scroll-rtl-or-bt-layer.html [ Timeout ] -
trunk/Source/WebCore/ChangeLog
r270304 r270312 1 2020-11-30 Simon Fraser <simon.fraser@apple.com> 2 3 [WK1] Only the first wheel event in a gesture should be cancelable 4 https://bugs.webkit.org/show_bug.cgi?id=219384 5 6 Reviewed by Chris Dumez. 7 8 Implement the logic described at <https://w3c.github.io/uievents/#cancelability-of-wheel-events>, 9 where only the first wheel event in a sequence is cancelable, and, if not canceled, then the 10 rest of the events in the sequence become non-cancelable. 11 12 This is done for the non-async scrolling code path (i.e. WebKitLegacy) by storing 13 a Optional<WheelScrollGestureState> on EventHandler, which is cleared when we receive 14 the "begin" event, set when we finish processing that event, then consulted for subsequent 15 move events. 16 17 Tests: fast/events/wheel/first-wheel-event-cancelable.html 18 fast/events/wheel/wheel-events-become-non-cancelable.html 19 20 * page/EventHandler.h: 21 * page/ios/EventHandlerIOS.mm: 22 (WebCore::EventHandler::wheelEvent): 23 * page/mac/EventHandlerMac.mm: 24 (WebCore::EventHandler::wheelEvent): 25 (WebCore::EventHandler::wheelEventWasProcessedByMainThread): 26 * platform/PlatformWheelEvent.cpp: 27 (WebCore::operator<<): 28 * platform/PlatformWheelEvent.h: 29 1 30 2020-12-01 Youenn Fablet <youenn@apple.com> 2 31 -
trunk/Source/WebCore/page/EventHandler.h
r270278 r270312 98 98 99 99 enum class WheelEventProcessingSteps : uint8_t; 100 enum class WheelScrollGestureState : uint8_t; 100 101 101 102 #if ENABLE(DRAG_SUPPORT) … … 607 608 NSView *m_mouseDownView { nullptr }; 608 609 bool m_sendingEventToSubview { false }; 610 Optional<WheelScrollGestureState> m_wheelScrollGestureState; 609 611 #endif 610 612 -
trunk/Source/WebCore/page/ios/EventHandlerIOS.mm
r269973 r270312 108 108 CurrentEventScope scope(event); 109 109 110 bool eventWasHandled = handleWheelEvent(PlatformEventFactory::createPlatformWheelEvent(event), { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch }); 110 auto wheelEvent = PlatformEventFactory::createPlatformWheelEvent(event); 111 OptionSet<WheelEventProcessingSteps> processingSteps = { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch }; 112 113 if (wheelEvent.isGestureStart()) 114 m_wheelScrollGestureState = WTF::nullopt; 115 else if (wheelEvent.phase() == PlatformWheelEventPhase::Changed || wheelEvent.momentumPhase() == PlatformWheelEventPhase::Changed) { 116 if (m_wheelScrollGestureState && *m_wheelScrollGestureState == WheelScrollGestureState::NonBlocking) 117 processingSteps = { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForNonBlockingDOMEventDispatch }; 118 } 119 120 bool eventWasHandled = handleWheelEvent(wheelEvent, processingSteps); 111 121 event.wasHandled = eventWasHandled; 112 122 return eventWasHandled; -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r270278 r270312 150 150 auto wheelEvent = PlatformEventFactory::createPlatformWheelEvent(event, page->chrome().platformPageClient()); 151 151 OptionSet<WheelEventProcessingSteps> processingSteps = { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch }; 152 153 if (wheelEvent.isGestureStart()) 154 m_wheelScrollGestureState = WTF::nullopt; 155 else if (wheelEvent.phase() == PlatformWheelEventPhase::Changed || wheelEvent.momentumPhase() == PlatformWheelEventPhase::Changed) { 156 if (m_frame.settings().wheelEventGesturesBecomeNonBlocking() && m_wheelScrollGestureState && *m_wheelScrollGestureState == WheelScrollGestureState::NonBlocking) 157 processingSteps = { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForNonBlockingDOMEventDispatch }; 158 } 152 159 return handleWheelEvent(wheelEvent, processingSteps); 153 160 } … … 970 977 scrollingCoordinator->wheelEventWasProcessedByMainThread(wheelEvent, eventHandling); 971 978 } 979 980 if (wheelEvent.isGestureStart() && eventHandling.contains(EventHandling::DispatchedToDOM)) 981 m_wheelScrollGestureState = eventHandling.contains(EventHandling::DefaultPrevented) ? WheelScrollGestureState::Blocking : WheelScrollGestureState::NonBlocking; 972 982 #else 973 983 UNUSED_PARAM(wheelEvent); -
trunk/Source/WebCore/platform/PlatformWheelEvent.cpp
r269973 r270312 81 81 } 82 82 83 TextStream& operator<<(TextStream& ts, WheelScrollGestureState state) 84 { 85 switch (state) { 86 case WheelScrollGestureState::Blocking: ts << "blocking"; break; 87 case WheelScrollGestureState::NonBlocking: ts << "non-blocking"; break; 88 } 89 return ts; 90 } 91 83 92 } // namespace WebCore -
trunk/Source/WebCore/platform/PlatformWheelEvent.h
r269973 r270312 44 44 }; 45 45 46 enum class WheelScrollGestureState : uint8_t { 47 Blocking, 48 NonBlocking 49 }; 50 46 51 // The ScrollByPixelWheelEvent is a fine-grained event that specifies the precise number of pixels to scroll. 47 52 // It is sent directly by touch pads on macOS, or synthesized when platforms generate line-by-line scrolling events. … … 268 273 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, WheelEventProcessingSteps); 269 274 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, EventHandling); 275 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, WheelScrollGestureState); 270 276 271 277 } // namespace WebCore
Note:
See TracChangeset
for help on using the changeset viewer.