[webkit-changes] [WebKit/WebKit] 43c540: [UI-side compositing] Send events to the WebWheelE...

Simon Fraser noreply at github.com
Thu Mar 23 08:19:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 43c540f60166ca42ad00b9d538c232a02b3ec3ce
      https://github.com/WebKit/WebKit/commit/43c540f60166ca42ad00b9d538c232a02b3ec3ce
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-03-23 (Thu, 23 Mar 2023)

  Changed paths:
    M LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler.html
    M Source/WebKit/Shared/WebWheelEventCoalescer.cpp
    M Source/WebKit/Shared/WebWheelEventCoalescer.h
    M Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
    M Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp
    M Source/WebKit/UIProcess/API/wpe/WPEView.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Source/WebKit/UIProcess/win/WebView.cpp

  Log Message:
  -----------
  [UI-side compositing] Send events to the WebWheelEventCoalescer before sending them to the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=254247
rdar://107032016

Reviewed by Tim Horton.

With UI-side compositing, we first try to handle a wheel event in the scrolling thread in the UI
process, and may then send it to the web process. A future patch will add some post-web-process
handling, so we have to avoid starting to handle the next wheel event in the meantime.

WebWheelEventCoalescer already takes case of this, so call `wheelEventCoalescer().shouldDispatchEvent()`
before we dispatch any wheel event to the scrolling coordinator in the UI process.

This has a few ramifications. If WebWheelEventCoalescer coalesces events, it can only spit out
WebWheelEvents (no corresponding NSEvent), rather than NativeWebWheelEvents. So we have to call
cacheWheelEventScrollingAccelerationCurve() for the UI-side MomentumEventDispatcher before doing
anything else, but the rest of the event handling chain can deal in WebWheelEvents.

This also means that WebWheelEventCoalescer coalesces before we know about processing steps, so
it no longer have to deal with {event, processing steps} pairs, and we can revert to the simpler
implementation that only tracks events.

Finally, when the UI-side scrolling thread finishes its event handling (and no further processing
is needed), we need to take an event from WebWheelEventCoalescer's queue via takeOldestEventBeingProcessed(),
and see if there is another event in the queue to start processing; this code is now shared
with the code that runs when the web processes finishes its wheel event handling, via WebPageProxy::wheelEventHandlingCompleted().

Make one test slightly more robust by defeating coalescing.

* LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler.html:
* Source/WebKit/Shared/WebWheelEventCoalescer.cpp:
(WebKit::operator<<):
(WebKit::WebWheelEventCoalescer::canCoalesce):
(WebKit::WebWheelEventCoalescer::coalesce):
(WebKit::WebWheelEventCoalescer::nextEventToDispatch):
(WebKit::WebWheelEventCoalescer::shouldDispatchEvent):
(WebKit::WebWheelEventCoalescer::takeOldestEventBeingProcessed):
* Source/WebKit/Shared/WebWheelEventCoalescer.h:
(WebKit::WebWheelEventAndSteps::WebWheelEventAndSteps): Deleted.
* Source/WebKit/UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp:
(WKPageHandleWheelEvent):
* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseScrollEvent):
(handleScroll):
(webkitWebViewBaseSynthesizeWheelEvent):
* Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::doneWithTouchEvent):
* Source/WebKit/UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent):
(WebKit::RemoteScrollingCoordinatorProxy::continueWheelEventHandling):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
(WebKit::RemoteScrollingCoordinatorProxy::cacheWheelEventScrollingAccelerationCurve):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp:
(WebKit::RemoteLayerTreeEventDispatcher::cacheWheelEventScrollingAccelerationCurve):
(WebKit::RemoteLayerTreeEventDispatcher::willHandleWheelEvent):
(WebKit::RemoteLayerTreeEventDispatcher::handleWheelEvent):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm:
(WebKit::RemoteScrollingCoordinatorProxyMac::cacheWheelEventScrollingAccelerationCurve):
(WebKit::RemoteScrollingCoordinatorProxyMac::handleWheelEvent):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleNativeWheelEvent): New function which is the entry point to wheel event handling,
taking a NativeWebWheelEvent.
(WebKit::WebPageProxy::handleWheelEvent): Takes a WebWheelEvent; called by both handleNativeWheelEvent, and via wheelEventHandlingCompleted().
(WebKit::WebPageProxy::continueWheelEventHandling):
(WebKit::WebPageProxy::sendWheelEvent):
(WebKit::WebPageProxy::wheelEventHandlingCompleted):
(WebKit::WebPageProxy::cacheWheelEventScrollingAccelerationCurve):
(WebKit::WebPageProxy::sendWheelEventScrollingAccelerationCurveIfNecessary):
(WebKit::WebPageProxy::didReceiveEvent):
(WebKit::WebPageProxy::wheelEventWasNotHandled): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::scrollWheel):
* Source/WebKit/UIProcess/win/WebView.cpp:
(WebKit::WebView::onWheelEvent):

Canonical link: https://commits.webkit.org/262015@main




More information about the webkit-changes mailing list