Changeset 286346 in webkit
- Timestamp:
- Nov 30, 2021, 6:56:24 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 added
- 16 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/PlatformEnable.h (modified) (1 diff)
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/pal/spi/mac/IOKitSPIMac.h (modified) (3 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Platform/Logging.h (modified) (1 diff)
-
WebKit/Shared/ScrollingAccelerationCurve.cpp (added)
-
WebKit/Shared/ScrollingAccelerationCurve.h (added)
-
WebKit/Shared/mac/ScrollingAccelerationCurveMac.mm (added)
-
WebKit/Sources.txt (modified) (2 diffs)
-
WebKit/SourcesCocoa.txt (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (4 diffs)
-
WebKit/UIProcess/WebPageProxy.h (modified) (2 diffs)
-
WebKit/WebKit.xcodeproj/project.pbxproj (modified) (8 diffs)
-
WebKit/WebProcess/WebPage/EventDispatcher.cpp (modified) (12 diffs)
-
WebKit/WebProcess/WebPage/EventDispatcher.h (modified) (6 diffs)
-
WebKit/WebProcess/WebPage/EventDispatcher.messages.in (modified) (1 diff)
-
WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp (added)
-
WebKit/WebProcess/WebPage/MomentumEventDispatcher.h (added)
-
WebKit/WebProcess/WebPage/WebPage.cpp (modified) (3 diffs)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r286345 r286346 1 2021-11-30 Tim Horton <timothy_horton@apple.com> 2 3 Add a momentum event synthesizer 4 https://bugs.webkit.org/show_bug.cgi?id=233653 5 <rdar://problem/85571258> 6 7 Reviewed by Simon Fraser. 8 9 * wtf/PlatformEnable.h: 10 Add an ENABLE(). 11 1 12 2021-11-30 Keith Miller <keith_miller@apple.com> 2 13 -
trunk/Source/WTF/wtf/PlatformEnable.h
r286204 r286346 877 877 #endif 878 878 879 #if PLATFORM(MAC) 880 #define ENABLE_MOMENTUM_EVENT_DISPATCHER 1 881 #endif 882 879 883 #if !defined(ENABLE_SCROLLING_THREAD) 880 884 #if USE(NICOSIA) -
trunk/Source/WebCore/PAL/ChangeLog
r286317 r286346 1 2021-11-30 Tim Horton <timothy_horton@apple.com> 2 3 Add a momentum event synthesizer 4 https://bugs.webkit.org/show_bug.cgi?id=233653 5 <rdar://problem/85571258> 6 7 Reviewed by Simon Fraser. 8 9 * pal/spi/mac/IOKitSPIMac.h: 10 Add some SPI. 11 1 12 2021-11-30 Commit Queue <commit-queue@webkit.org> 2 13 -
trunk/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h
r286270 r286346 67 67 void IOHIDEventSystemClientUnregisterDeviceMatchingBlock(IOHIDEventSystemClientRef); 68 68 void IOHIDEventSystemClientScheduleWithDispatchQueue(IOHIDEventSystemClientRef, dispatch_queue_t); 69 void IOHIDEventSystemClientSetDispatchQueue(IOHIDEventSystemClientRef, dispatch_queue_t); 70 void IOHIDEventSystemClientActivate(IOHIDEventSystemClientRef); 69 71 70 72 CFTypeRef IOHIDServiceClientCopyProperty(IOHIDServiceClientRef service, CFStringRef key); … … 85 87 86 88 typedef uint32_t IOHIDEventField; 89 typedef uint64_t IOHIDEventSenderID; 87 90 88 91 #ifdef __LP64__ … … 100 103 uint64_t IOHIDEventGetTimeStamp(IOHIDEventRef); 101 104 IOHIDFloat IOHIDEventGetFloatValue(IOHIDEventRef, IOHIDEventField); 105 IOHIDEventSenderID IOHIDEventGetSenderID(IOHIDEventRef); 102 106 103 107 WTF_EXTERN_C_END -
trunk/Source/WebKit/ChangeLog
r286329 r286346 1 2021-11-30 Tim Horton <timothy_horton@apple.com> 2 3 Add a momentum event synthesizer 4 https://bugs.webkit.org/show_bug.cgi?id=233653 5 <rdar://problem/85571258> 6 7 Reviewed by Simon Fraser. 8 9 * Platform/Logging.h: 10 Add ScrollAnimations log channel to WebKit (it already exists in WebCore). 11 12 * Shared/ScrollingAccelerationCurve.cpp: Added. 13 (WebKit::ScrollingAccelerationCurve::ScrollingAccelerationCurve): 14 (WebKit::ScrollingAccelerationCurve::interpolate): 15 (WebKit::ScrollingAccelerationCurve::computeIntermediateValuesIfNeeded): 16 (WebKit::ScrollingAccelerationCurve::evaluateQuartic): 17 (WebKit::ScrollingAccelerationCurve::accelerationFactor): 18 (WebKit::ScrollingAccelerationCurve::encode const): 19 (WebKit::ScrollingAccelerationCurve::decode): 20 (WebKit::operator<<): 21 (WebKit::ScrollingAccelerationCurve::fromNativeWheelEvent): 22 * Shared/ScrollingAccelerationCurve.h: Added. 23 (WebKit::ScrollingAccelerationCurve::operator== const): 24 (WebKit::ScrollingAccelerationCurve::operator!= const): 25 Add a class that represents a quartic scrolling acceleration curve with 26 a trailing linear tangent region, and allows interpolation between curves 27 and evaluation of the curve at a point. 28 29 * Shared/mac/ScrollingAccelerationCurveMac.mm: Added. 30 (WebKit::fromFixedPoint): 31 (WebKit::readFixedPointParameter): 32 (WebKit::fromIOHIDCurve): 33 (WebKit::fromIOHIDCurveArrayWithAcceleration): 34 (WebKit::ScrollingAccelerationCurve::fromNativeWheelEvent): 35 Given a NativeWebWheelEvent, extract its underlying platform event 36 and fetch the ScrollingAccelerationCurve for the originating device. 37 38 * Sources.txt: 39 * SourcesCocoa.txt: 40 * UIProcess/WebPageProxy.cpp: 41 (WebKit::WebPageProxy::handleWheelEvent): 42 Fetch the current ScrollingAccelerationCurve on each momentum begin event, 43 if the feature is enabled. 44 45 (WebKit::WebPageProxy::sendWheelEvent): 46 Send the ScrollingAccelerationCurve to EventDispatcher just before 47 we send the momentum begin event along, if it has changed. 48 49 (WebKit::WebPageProxy::windowScreenDidChange): 50 Keep EventDispatcher apprised of changes to the current screen of the page. 51 52 (WebKit::WebPageProxy::resetState): 53 * UIProcess/WebPageProxy.h: 54 * WebKit.xcodeproj/project.pbxproj: 55 * WebProcess/WebPage/EventDispatcher.cpp: 56 (WebKit::EventDispatcher::EventDispatcher): 57 (WebKit::EventDispatcher::internalWheelEvent): 58 Factor most of wheelEvent out into internalWheelEvent, so that 59 MomentumEventDispatcher can call internalWheelEvent(), skipping the code 60 in wheelEvent() that forwards the event... to MomentumEventDispatcher. 61 62 Also, keep track of where the event came from (UI process or MomentumEventDispatcher) 63 and avoid sending didReceiveEvent replies to the UI process for synthetic 64 events that it doesn't know about. 65 66 (WebKit::EventDispatcher::wheelEvent): 67 Forward wheel events to MomentumEventDispatcher. 68 69 (WebKit::EventDispatcher::setScrollingAccelerationCurve): 70 Forward scrolling curve changes to MomentumEventDispatcher. 71 72 (WebKit::EventDispatcher::displayWasRefreshed): 73 Forward display refresh callbacks to MomentumEventDispatcher. 74 75 (WebKit::EventDispatcher::windowScreenDidChange): 76 Forward page screen changes to MomentumEventDispatcher. 77 78 * WebProcess/WebPage/EventDispatcher.h: 79 * WebProcess/WebPage/EventDispatcher.messages.in: 80 81 * WebProcess/WebPage/WebPage.cpp: 82 (WebKit::WebPage::wheelEvent): 83 (WebKit::WebPage::dispatchWheelEventWithoutScrolling): 84 * WebProcess/WebPage/WebPage.h: 85 Don't send didReceiveEvent for synthetic events from the main thread either. 86 87 * WebProcess/WebPage/MomentumEventDispatcher.cpp: Added. 88 (WebKit::MomentumEventDispatcher::MomentumEventDispatcher): 89 (WebKit::MomentumEventDispatcher::~MomentumEventDispatcher): 90 (WebKit::MomentumEventDispatcher::eventShouldStartSyntheticMomentumPhase const): 91 If we have everything we need (a scrolling curve - which also implies 92 that the setting is enabled - and raw platform deltas), and the event 93 is a momentum begin event, we can use it to start a synthetic momentum phase. 94 95 (WebKit::MomentumEventDispatcher::handleWheelEvent): 96 Start or stop the momentum phase as appropriate. 97 Record any incoming fingers-down phase events in a rolling event history structure. 98 Block platform-event-driven events from being further handled by WebKit 99 if we are inside a synthetic momentum phase, since we'll be replacing them. 100 101 (WebKit::appKitScrollMultiplierForEvent): 102 Determine the AppKit scroll muliplier ("accelerated" vs "unaccelerated" 103 deltas in NSEvent parlance) from the event via division. 104 105 (WebKit::MomentumEventDispatcher::dispatchSyntheticMomentumEvent): 106 Dispatch a synthetic event with the given momentum phase and delta. 107 We borrow some properties from the event that initiated the momentum 108 phase (e.g. the position), and some from whatever event we've most 109 recently seen (even if we told the rest of WebKit to ignore it), so 110 that we get the most up-to-date state for e.g. the keyboard modifiers. 111 112 (WebKit::MomentumEventDispatcher::didStartMomentumPhase): 113 Record relevant information about the start event, generate the 114 momentum curve, and start a full-rate display link. Also, send a momentum 115 begin event, since we blocked the real one. 116 117 (WebKit::MomentumEventDispatcher::didEndMomentumPhase): 118 Send a momentum ended event, shut down the display link, and reset all 119 per-gesture state. 120 121 (WebKit::MomentumEventDispatcher::setScrollingAccelerationCurve): 122 Store ScrollingAccelerationCurves on a per-page basis. 123 124 (WebKit::MomentumEventDispatcher::displayID const): 125 Look up the displayID for the current gesture's page. 126 127 (WebKit::MomentumEventDispatcher::startDisplayLink): 128 (WebKit::MomentumEventDispatcher::stopDisplayLink): 129 Start and stop a display link, which will - in a roundabout manner - 130 eventually call back into displayWasRefreshed. 131 132 (WebKit::MomentumEventDispatcher::windowScreenDidChange): 133 Store DisplayIDs on a per-page basis. 134 135 (WebKit::MomentumEventDispatcher::displayWasRefreshed): 136 When the display link calls us back, emit a single momentum changed 137 event of sufficient delta to move us to the desired offset along the curve. 138 139 (WebKit::MomentumEventDispatcher::didScrollWithInterval): 140 (WebKit::MomentumEventDispatcher::didScroll): 141 Record incoming scrolling events into a rolling history deque. 142 143 (WebKit::MomentumEventDispatcher::buildOffsetTableWithInitialDelta): 144 Compute the offsets for the entire "ideal curve" table (at 60Hz) by 145 running the animation and accumulating the deltas. 146 147 (WebKit::interpolate): 148 (WebKit::MomentumEventDispatcher::offsetAtTime): 149 Interpolate along the "ideal curve" to determine the intended offset 150 at a given time. 151 152 (WebKit::momentumDecayRate): 153 (WebKit::MomentumEventDispatcher::computeNextDelta): 154 Compute the next delta given a delta (and the event history) by applying 155 a bit of exponential decay and then passing it through the 156 ScrollingAccelerationCurve. We return both the unaccelerated 157 and accelerated deltas, because the input to the next iteration of 158 computeNextDelta is the unaccelerated delta, but the delta applied 159 to the actual scroll position is the accelerated delta. 160 161 * WebProcess/WebPage/MomentumEventDispatcher.h: Added. 162 1 163 2021-11-30 BJ Burg <bburg@apple.com> 2 164 -
trunk/Source/WebKit/Platform/Logging.h
r285966 r286346 92 92 M(Resize) \ 93 93 M(ResourceLoadStatistics) \ 94 M(ScrollAnimations) \ 94 95 M(Scrolling) \ 95 96 M(Selection) \ -
trunk/Source/WebKit/Sources.txt
r286288 r286346 226 226 Shared/RTCNetwork.cpp 227 227 Shared/RTCPacketOptions.cpp 228 Shared/ScrollingAccelerationCurve.cpp 228 229 Shared/ServiceWorkerInitializationData.cpp 229 230 Shared/SessionState.cpp … … 814 815 WebProcess/WebPage/FindController.cpp 815 816 WebProcess/WebPage/IPCTestingAPI.cpp 817 WebProcess/WebPage/MomentumEventDispatcher.cpp 816 818 WebProcess/WebPage/PageBanner.cpp 817 819 WebProcess/WebPage/VisitedLinkTableController.cpp -
trunk/Source/WebKit/SourcesCocoa.txt
r285922 r286346 221 221 Shared/mac/PasteboardTypes.mm 222 222 Shared/mac/PrintInfoMac.mm 223 Shared/mac/ScrollingAccelerationCurveMac.mm 223 224 Shared/mac/SecItemRequestData.cpp 224 225 Shared/mac/SecItemResponseData.cpp -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286317 r286346 2895 2895 closeOverlayedViews(); 2896 2896 2897 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 2898 // FIXME: We should not have to look this up repeatedly, but it can also change occasionally. 2899 if (event.momentumPhase() == WebWheelEvent::PhaseBegan && preferences().momentumScrollingAnimatorEnabled()) 2900 m_scrollingAccelerationCurve = ScrollingAccelerationCurve::fromNativeWheelEvent(event); 2901 #endif 2902 2897 2903 if (wheelEventCoalescer().shouldDispatchEvent(event)) { 2898 2904 auto event = wheelEventCoalescer().nextEventToDispatch(); … … 2942 2948 rubberBandableEdges.setRight(!m_backForwardList->forwardItem()); 2943 2949 } 2950 2951 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 2952 if (event.momentumPhase() == WebWheelEvent::PhaseBegan && m_scrollingAccelerationCurve != m_lastSentScrollingAccelerationCurve) { 2953 connection->send(Messages::EventDispatcher::SetScrollingAccelerationCurve(m_webPageID, *m_scrollingAccelerationCurve), 0, { }, Thread::QOS::UserInteractive); 2954 m_lastSentScrollingAccelerationCurve = m_scrollingAccelerationCurve; 2955 } 2956 #endif 2957 2944 2958 connection->send(Messages::EventDispatcher::WheelEvent(m_webPageID, event, rubberBandableEdges), 0, { }, Thread::QOS::UserInteractive); 2945 2959 … … 3942 3956 return; 3943 3957 3958 send(Messages::EventDispatcher::PageScreenDidChange(m_webPageID, displayID)); 3944 3959 send(Messages::WebPage::WindowScreenDidChange(displayID, nominalFramesPerSecond)); 3945 3960 } … … 7899 7914 m_xrSystem = nullptr; 7900 7915 } 7916 #endif 7917 7918 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 7919 m_lastSentScrollingAccelerationCurve = std::nullopt; 7901 7920 #endif 7902 7921 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r286317 r286346 52 52 #include "ProcessThrottler.h" 53 53 #include "SandboxExtension.h" 54 #include "ScrollingAccelerationCurve.h" 54 55 #include "ShareableBitmap.h" 55 56 #include "ShareableResource.h" … … 3154 3155 3155 3156 WebNotificationManagerMessageHandler m_notificationManagerMessageHandler; 3157 3158 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 3159 std::optional<ScrollingAccelerationCurve> m_scrollingAccelerationCurve; 3160 std::optional<ScrollingAccelerationCurve> m_lastSentScrollingAccelerationCurve; 3161 #endif 3156 3162 }; 3157 3163 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r286320 r286346 3501 3501 2D6482492644B1AB00030335 /* RemoteLayerTreeLayers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeLayers.h; sourceTree = "<group>"; }; 3502 3502 2D64824A2644B1AB00030335 /* RemoteLayerTreeLayers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeLayers.mm; sourceTree = "<group>"; }; 3503 2D65D194274B8E73009C4101 /* ScrollingAccelerationCurveMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingAccelerationCurveMac.mm; sourceTree = "<group>"; }; 3504 2D65D195274B8E84009C4101 /* ScrollingAccelerationCurve.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingAccelerationCurve.h; sourceTree = "<group>"; }; 3505 2D65D196274B8E84009C4101 /* ScrollingAccelerationCurve.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingAccelerationCurve.cpp; sourceTree = "<group>"; }; 3503 3506 2D6AB53F192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKPDFPageNumberIndicator.h; path = ios/WKPDFPageNumberIndicator.h; sourceTree = "<group>"; }; 3504 3507 2D6AB540192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKPDFPageNumberIndicator.mm; path = ios/WKPDFPageNumberIndicator.mm; sourceTree = "<group>"; }; … … 3784 3787 2DE9B13B2231F77C005287B7 /* _WKTextInputContextInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKTextInputContextInternal.h; sourceTree = "<group>"; }; 3785 3788 2DEAC5CE1AC368BB00A195D8 /* _WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKFindOptions.h; sourceTree = "<group>"; }; 3789 2DEE709D2755A46800FBF864 /* MomentumEventDispatcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MomentumEventDispatcher.h; sourceTree = "<group>"; }; 3790 2DEE709E2755A46800FBF864 /* MomentumEventDispatcher.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MomentumEventDispatcher.cpp; sourceTree = "<group>"; }; 3786 3791 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ViewGestureControllerIOS.mm; path = ios/ViewGestureControllerIOS.mm; sourceTree = "<group>"; }; 3787 3792 2DF9EEE31A781FB400B6CFBE /* APIFrameInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIFrameInfo.cpp; sourceTree = "<group>"; }; … … 7090 7095 1AAB4A8C1296F0A20023952F /* SandboxExtension.h */, 7091 7096 E1E552C316AE065E004ED653 /* SandboxInitializationParameters.h */, 7097 2D65D196274B8E84009C4101 /* ScrollingAccelerationCurve.cpp */, 7098 2D65D195274B8E84009C4101 /* ScrollingAccelerationCurve.h */, 7092 7099 5C80B3DD23690F100086E6DE /* ServiceWorkerInitializationData.cpp */, 7093 7100 5C80B3DB23690D8D0086E6DE /* ServiceWorkerInitializationData.h */, … … 9881 9888 isa = PBXGroup; 9882 9889 children = ( 9883 5CBB6D4D271F67CC00FD1A5D /* com.apple.webkit.webpushd.plist */,9884 9890 5160E954274B887100567388 /* AppBundleRequest.h */, 9885 9891 5160E953274B887100567388 /* AppBundleRequest.mm */, 9892 5CBB6D4D271F67CC00FD1A5D /* com.apple.webkit.webpushd.plist */, 9886 9893 51F7BB75274498BB00C45A72 /* MockAppBundleForTesting.h */, 9887 9894 51F7BB74274498BA00C45A72 /* MockAppBundleForTesting.mm */, … … 10622 10629 9B033E72252580F300501071 /* IPCTestingAPI.cpp */, 10623 10630 9B033E71252580F300501071 /* IPCTestingAPI.h */, 10631 2DEE709E2755A46800FBF864 /* MomentumEventDispatcher.cpp */, 10632 2DEE709D2755A46800FBF864 /* MomentumEventDispatcher.h */, 10624 10633 7C387433172F5615001BD88A /* PageBanner.cpp */, 10625 10634 7CF47FF917275C57008ACB91 /* PageBanner.h */, … … 11188 11197 C1E123B920A11572002646F4 /* PDFContextMenu.h */, 11189 11198 E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */, 11199 2D65D194274B8E73009C4101 /* ScrollingAccelerationCurveMac.mm */, 11190 11200 51D1304F1382EAC000351EDD /* SecItemRequestData.cpp */, 11191 11201 51D130501382EAC000351EDD /* SecItemRequestData.h */, … … 12436 12446 buildActionMask = 2147483647; 12437 12447 files = ( 12448 5160E956274B887200567388 /* AppBundleRequest.h in Headers */, 12449 5C1579FC2717AF5000ED5280 /* DaemonUtilities.h in Headers */, 12450 51F7BB77274498BB00C45A72 /* MockAppBundleForTesting.h in Headers */, 12451 5160E95E274C2A0300567388 /* MockAppBundleRegistry.h in Headers */, 12438 12452 5160E959274C0D8900567388 /* PushAppBundle.h in Headers */, 12439 12453 51F7BB7B2744C50700C45A72 /* PushClientConnection.h in Headers */, 12440 5160E95E274C2A0300567388 /* MockAppBundleRegistry.h in Headers */,12441 5C1579FC2717AF5000ED5280 /* DaemonUtilities.h in Headers */,12442 5160E956274B887200567388 /* AppBundleRequest.h in Headers */,12443 12454 512CD69F2723393A00F7F8EC /* WebPushDaemon.h in Headers */, 12444 51F7BB77274498BB00C45A72 /* MockAppBundleForTesting.h in Headers */,12445 12455 ); 12446 12456 runOnlyForDeploymentPostprocessing = 0; … … 14976 14986 buildActionMask = 2147483647; 14977 14987 files = ( 14988 5160E955274B887200567388 /* AppBundleRequest.mm in Sources */, 14978 14989 5C157A012717B7FB00ED5280 /* ArgumentCoders.cpp in Sources */, 14979 14990 51F7BB7D2745640400C45A72 /* CodeSigning.mm in Sources */, 14980 14991 5C1579FF2717B6D200ED5280 /* DaemonDecoder.cpp in Sources */, 14981 51F7BB76274498BB00C45A72 /* MockAppBundleForTesting.mm in Sources */,14982 5160E955274B887200567388 /* AppBundleRequest.mm in Sources */,14983 5160E95A274C0D8900567388 /* PushAppBundle.mm in Sources */,14984 5160E960274C2A4000567388 /* MockAppBundleRegistry.mm in Sources */,14985 51F7BB7C2744C50700C45A72 /* PushClientConnection.mm in Sources */,14986 14992 5C1579FE2717B6C100ED5280 /* DaemonEncoder.cpp in Sources */, 14987 14993 5C1579FB2717AF5000ED5280 /* DaemonUtilities.mm in Sources */, 14994 51F7BB76274498BB00C45A72 /* MockAppBundleForTesting.mm in Sources */, 14995 5160E960274C2A4000567388 /* MockAppBundleRegistry.mm in Sources */, 14996 5160E95A274C0D8900567388 /* PushAppBundle.mm in Sources */, 14997 51F7BB7C2744C50700C45A72 /* PushClientConnection.mm in Sources */, 14988 14998 512CD6A02723393A00F7F8EC /* WebPushDaemon.mm in Sources */, 14989 14999 5C157A0C2717CA1D00ED5280 /* WebPushDaemonMain.mm in Sources */, -
trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp
r285992 r286346 28 28 29 29 #include "EventDispatcherMessages.h" 30 #include "MomentumEventDispatcher.h" 30 31 #include "WebEventConversion.h" 31 32 #include "WebPage.h" … … 64 65 : m_queue(WorkQueue::create("com.apple.WebKit.EventDispatcher", WorkQueue::QOS::UserInteractive)) 65 66 , m_recentWheelEventDeltaFilter(WheelEventDeltaFilter::create()) 67 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 68 , m_momentumEventDispatcher(WTF::makeUnique<MomentumEventDispatcher>(*this)) 69 #endif 66 70 { 67 71 } … … 98 102 } 99 103 100 void EventDispatcher:: wheelEvent(PageIdentifier pageID, const WebWheelEvent& wheelEvent, RectEdges<bool> rubberBandableEdges)104 void EventDispatcher::internalWheelEvent(PageIdentifier pageID, const WebWheelEvent& wheelEvent, RectEdges<bool> rubberBandableEdges, WheelEventOrigin wheelEventOrigin) 101 105 { 102 106 auto processingSteps = OptionSet<WebCore::WheelEventProcessingSteps> { WheelEventProcessingSteps::MainThreadForScrolling, WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch }; … … 115 119 auto scrollingTree = m_scrollingTrees.get(pageID); 116 120 if (!scrollingTree) { 117 dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps );121 dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps, wheelEventOrigin); 118 122 break; 119 123 } … … 137 141 scrollingTree->willProcessWheelEvent(); 138 142 139 ScrollingThread::dispatch([scrollingTree, wheelEvent, platformWheelEvent, processingSteps, useMainThreadForScrolling, pageID, protectedThis = Ref { *this }] {143 ScrollingThread::dispatch([scrollingTree, wheelEvent, platformWheelEvent, processingSteps, useMainThreadForScrolling, pageID, wheelEventOrigin, protectedThis = Ref { *this }] { 140 144 if (useMainThreadForScrolling) { 141 145 scrollingTree->willSendEventToMainThread(platformWheelEvent); 142 protectedThis->dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps );146 protectedThis->dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps, wheelEventOrigin); 143 147 scrollingTree->waitForEventToBeProcessedByMainThread(platformWheelEvent); 144 148 return; … … 148 152 149 153 if (result.needsMainThreadProcessing()) { 150 protectedThis->dispatchWheelEventViaMainThread(pageID, wheelEvent, result.steps );154 protectedThis->dispatchWheelEventViaMainThread(pageID, wheelEvent, result.steps, wheelEventOrigin); 151 155 if (result.steps.contains(WheelEventProcessingSteps::MainThreadForScrolling)) 152 156 return; … … 155 159 // If we scrolled on the scrolling thread (even if we send the event to the main thread for passive event handlers) 156 160 // respond to the UI process that the event was handled. 157 protectedThis->sendDidReceiveEvent(pageID, wheelEvent.type(), result.wasHandled); 161 if (wheelEventOrigin == WheelEventOrigin::UIProcess) 162 protectedThis->sendDidReceiveEvent(pageID, wheelEvent.type(), result.wasHandled); 158 163 }); 159 164 } while (false); … … 161 166 UNUSED_PARAM(rubberBandableEdges); 162 167 163 dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps); 164 #endif 165 } 168 dispatchWheelEventViaMainThread(pageID, wheelEvent, processingSteps, wheelEventOrigin); 169 #endif 170 } 171 172 void EventDispatcher::wheelEvent(PageIdentifier pageID, const WebWheelEvent& wheelEvent, RectEdges<bool> rubberBandableEdges) 173 { 174 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 175 if (m_momentumEventDispatcher->handleWheelEvent(pageID, wheelEvent, rubberBandableEdges)) { 176 sendDidReceiveEvent(pageID, wheelEvent.type(), true); 177 return; 178 } 179 #endif 180 internalWheelEvent(pageID, wheelEvent, rubberBandableEdges, WheelEventOrigin::UIProcess); 181 } 182 183 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 184 void EventDispatcher::setScrollingAccelerationCurve(PageIdentifier pageID, std::optional<ScrollingAccelerationCurve> curve) 185 { 186 m_momentumEventDispatcher->setScrollingAccelerationCurve(pageID, curve); 187 } 188 #endif 166 189 167 190 #if ENABLE(MAC_GESTURE_EVENTS) … … 231 254 #endif 232 255 233 void EventDispatcher::dispatchWheelEventViaMainThread(WebCore::PageIdentifier pageID, const WebWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps )256 void EventDispatcher::dispatchWheelEventViaMainThread(WebCore::PageIdentifier pageID, const WebWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps, WheelEventOrigin wheelEventOrigin) 234 257 { 235 258 ASSERT(!RunLoop::isMain()); 236 RunLoop::main().dispatch([protectedThis = Ref { *this }, pageID, wheelEvent, steps = processingSteps - WheelEventProcessingSteps::ScrollingThread]() mutable {237 protectedThis->dispatchWheelEvent(pageID, wheelEvent, steps );259 RunLoop::main().dispatch([protectedThis = Ref { *this }, pageID, wheelEvent, wheelEventOrigin, steps = processingSteps - WheelEventProcessingSteps::ScrollingThread]() mutable { 260 protectedThis->dispatchWheelEvent(pageID, wheelEvent, steps, wheelEventOrigin); 238 261 }); 239 262 } 240 263 241 void EventDispatcher::dispatchWheelEvent(PageIdentifier pageID, const WebWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps )264 void EventDispatcher::dispatchWheelEvent(PageIdentifier pageID, const WebWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps, WheelEventOrigin wheelEventOrigin) 242 265 { 243 266 ASSERT(RunLoop::isMain()); … … 247 270 return; 248 271 249 webPage->wheelEvent(wheelEvent, processingSteps );272 webPage->wheelEvent(wheelEvent, processingSteps, wheelEventOrigin); 250 273 } 251 274 … … 285 308 286 309 ASSERT(!RunLoop::isMain()); 310 311 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 312 m_momentumEventDispatcher->displayWasRefreshed(displayID, displayUpdate); 313 #endif 314 287 315 notifyScrollingTreesDisplayWasRefreshed(displayID); 288 316 … … 296 324 #endif 297 325 326 void EventDispatcher::pageScreenDidChange(PageIdentifier pageID, PlatformDisplayID displayID) 327 { 328 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 329 m_momentumEventDispatcher->pageScreenDidChange(pageID, displayID); 330 #else 331 UNUSED_PARAM(pageID); 332 UNUSED_PARAM(displayID); 333 #endif 334 } 335 298 336 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.h
r283353 r286346 51 51 namespace WebKit { 52 52 53 class MomentumEventDispatcher; 54 class ScrollingAccelerationCurve; 53 55 class WebPage; 54 56 class WebWheelEvent; … … 77 79 void notifyScrollingTreesDisplayWasRefreshed(WebCore::PlatformDisplayID); 78 80 81 enum class WheelEventOrigin : bool { UIProcess, MomentumEventDispatcher }; 82 void internalWheelEvent(WebCore::PageIdentifier, const WebWheelEvent&, WebCore::RectEdges<bool> rubberBandableEdges, WheelEventOrigin); 83 79 84 private: 80 85 EventDispatcher(); … … 85 90 // Message handlers 86 91 void wheelEvent(WebCore::PageIdentifier, const WebWheelEvent&, WebCore::RectEdges<bool> rubberBandableEdges); 92 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 93 void setScrollingAccelerationCurve(WebCore::PageIdentifier, std::optional<ScrollingAccelerationCurve>); 94 #endif 87 95 #if ENABLE(IOS_TOUCH_EVENTS) 88 96 void touchEvent(WebCore::PageIdentifier, const WebTouchEvent&, CompletionHandler<void(bool)>&&); … … 94 102 95 103 // This is called on the main thread. 96 void dispatchWheelEvent(WebCore::PageIdentifier, const WebWheelEvent&, OptionSet<WebCore::WheelEventProcessingSteps> );97 void dispatchWheelEventViaMainThread(WebCore::PageIdentifier, const WebWheelEvent&, OptionSet<WebCore::WheelEventProcessingSteps> );104 void dispatchWheelEvent(WebCore::PageIdentifier, const WebWheelEvent&, OptionSet<WebCore::WheelEventProcessingSteps>, WheelEventOrigin); 105 void dispatchWheelEventViaMainThread(WebCore::PageIdentifier, const WebWheelEvent&, OptionSet<WebCore::WheelEventProcessingSteps>, WheelEventOrigin); 98 106 99 107 #if ENABLE(IOS_TOUCH_EVENTS) … … 116 124 #endif 117 125 126 void pageScreenDidChange(WebCore::PageIdentifier, WebCore::PlatformDisplayID); 127 118 128 Ref<WorkQueue> m_queue; 119 129 … … 127 137 HashMap<WebCore::PageIdentifier, TouchEventQueue> m_touchEvents WTF_GUARDED_BY_LOCK(m_touchEventsLock); 128 138 #endif 139 140 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 141 std::unique_ptr<MomentumEventDispatcher> m_momentumEventDispatcher; 142 #endif 129 143 }; 130 144 -
trunk/Source/WebKit/WebProcess/WebPage/EventDispatcher.messages.in
r283353 r286346 33 33 DisplayWasRefreshed(uint32_t displayID, struct WebCore::DisplayUpdate update, bool sendToMainThread) 34 34 #endif 35 36 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 37 SetScrollingAccelerationCurve(WebCore::PageIdentifier pageID, std::optional<WebKit::ScrollingAccelerationCurve> curve) 38 #endif 39 PageScreenDidChange(WebCore::PageIdentifier pageID, uint32_t displayID) 35 40 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r286218 r286346 3032 3032 } 3033 3033 3034 bool WebPage::wheelEvent(const WebWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps )3034 bool WebPage::wheelEvent(const WebWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps, EventDispatcher::WheelEventOrigin wheelEventOrigin) 3035 3035 { 3036 3036 m_userActivity.impulse(); … … 3040 3040 bool handled = handleWheelEvent(wheelEvent, m_page.get(), processingSteps); 3041 3041 3042 if (processingSteps.contains(WheelEventProcessingSteps::MainThreadForScrolling) )3042 if (processingSteps.contains(WheelEventProcessingSteps::MainThreadForScrolling) && wheelEventOrigin == EventDispatcher::WheelEventOrigin::UIProcess) 3043 3043 send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(wheelEvent.type()), handled)); 3044 3044 … … 3054 3054 bool isCancelable = true; 3055 3055 #endif 3056 bool handled = this->wheelEvent(wheelEvent, { isCancelable ? WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch : WheelEventProcessingSteps::MainThreadForNonBlockingDOMEventDispatch } );3056 bool handled = this->wheelEvent(wheelEvent, { isCancelable ? WheelEventProcessingSteps::MainThreadForBlockingDOMEventDispatch : WheelEventProcessingSteps::MainThreadForNonBlockingDOMEventDispatch }, EventDispatcher::WheelEventOrigin::UIProcess); 3057 3057 completionHandler(handled); 3058 3058 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r286218 r286346 39 39 #include "DrawingAreaInfo.h" 40 40 #include "EditingRange.h" 41 #include "EventDispatcher.h" 41 42 #include "FocusedElementInformation.h" 42 43 #include "GeolocationIdentifier.h" … … 1066 1067 #endif 1067 1068 1068 bool wheelEvent(const WebWheelEvent&, OptionSet<WebCore::WheelEventProcessingSteps> );1069 bool wheelEvent(const WebWheelEvent&, OptionSet<WebCore::WheelEventProcessingSteps>, EventDispatcher::WheelEventOrigin); 1069 1070 1070 1071 void wheelEventHandlersChanged(bool);
Note:
See TracChangeset
for help on using the changeset viewer.