[webkit-changes] [WebKit/WebKit] 75f376: Adopt new ServiceExtensions scroll view delegate API
Wenson Hsieh
noreply at github.com
Sun Jan 14 12:17:00 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 75f37688a521db96bf5943381c323eb9acb1f0c6
https://github.com/WebKit/WebKit/commit/75f37688a521db96bf5943381c323eb9acb1f0c6
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-01-14 (Sun, 14 Jan 2024)
Changed paths:
M Source/WebKit/Shared/ios/WebIOSEventFactory.h
M Source/WebKit/Shared/ios/WebIOSEventFactory.mm
M Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
M Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h
M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm
M Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h
M Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm
M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
M Source/WebKit/UIProcess/ios/WKBaseScrollView.h
M Source/WebKit/UIProcess/ios/WKBaseScrollView.mm
M Source/WebKit/UIProcess/ios/WKMouseInteraction.mm
M Source/WebKit/UIProcess/ios/WKSEDefinitions.h
M Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm
Log Message:
-----------
Adopt new ServiceExtensions scroll view delegate API
https://bugs.webkit.org/show_bug.cgi?id=267214
rdar://120597428
Reviewed by Tim Horton.
Adopt a couple of scroll view delegate APIs in `WKScrollingNodeScrollViewDelegate` and `WKWebView`:
```
-scrollView:handleScrollUpdate:completion:
-parentScrollViewForScrollView:
```
...instead of equivalent SPI subclassing hooks. To do this, we replace various UIKit SPI symbols
with equivalent declarations:
```
UIScrollEvent → WKSEScrollViewScrollUpdate
UIScrollPhase → WKSEScrollViewScrollUpdatePhase
UIScrollPhaseBegan → WKSEScrollViewScrollUpdatePhaseBegan
UIScrollPhaseChanged → WKSEScrollViewScrollUpdatePhaseChanged
UIScrollPhaseEnded → WKSEScrollViewScrollUpdatePhaseEnded
UIScrollPhaseCancelled → WKSEScrollViewScrollUpdatePhaseCancelled
```
See below for more details.
* Source/WebKit/Shared/ios/WebIOSEventFactory.h:
* Source/WebKit/Shared/ios/WebIOSEventFactory.mm:
Add a missing `WebKit` namespace around `WebIOSEventFactory`, and deploy the new WKSE-prefixed
scroll view symbols (see above).
(WebKit::WebIOSEventFactory::webEventModifiersForUIKeyModifierFlags):
(WebKit::WebIOSEventFactory::toUIKeyModifierFlags):
(WebKit::modifiersForEvent):
(WebKit::WebIOSEventFactory::createWebKeyboardEvent):
(WebKit::WebIOSEventFactory::createWebMouseEvent):
(WebKit::toWebPhase):
Note: since `UIScrollPhaseNone` and `UIScrollPhaseMayBegin` don't have WKSE-prefixed equivalents,
this codepath is limited to the non-ServiceExtensions case.
(WebKit::WebIOSEventFactory::translationInView):
(WebKit::WebIOSEventFactory::createWebWheelEvent):
(WebIOSEventFactory::webEventModifiersForUIKeyModifierFlags): Deleted.
(WebIOSEventFactory::toUIKeyModifierFlags): Deleted.
(modifiersForEvent): Deleted.
(WebIOSEventFactory::createWebKeyboardEvent): Deleted.
(WebIOSEventFactory::createWebMouseEvent): Deleted.
(toWebPhase): Deleted.
(WebIOSEventFactory::createWebWheelEvent): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm:
(-[WKNavigationAction modifierFlags]):
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _scrollView:asynchronouslyHandleScrollEvent:completion:]):
(-[WKWebView scrollView:handleScrollUpdate:completion:]):
(-[WKWebView scrollView:handleScrollEvent:completion:]): Deleted.
Add an implementation of `-scrollView:handleScrollUpdate:completion:`, and have the legacy SPI
delegate method call into this new method. Similarly, have `-_actingParentScrollViewForScrollView:`
call into the new `-parentScrollViewForScrollView:` method.
* Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
* Source/WebKit/UIProcess/PageClient.h:
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(WebKit::findActingScrollParent):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate _actingParentScrollViewForScrollView:]):
(-[WKScrollingNodeScrollViewDelegate parentScrollViewForScrollView:]):
(-[WKScrollingNodeScrollViewDelegate _scrollView:asynchronouslyHandleScrollEvent:completion:]):
(-[WKScrollingNodeScrollViewDelegate scrollView:handleScrollUpdate:completion:]):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::handleAsynchronousCancelableScrollEvent):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::findActingScrollParent):
(-[WKScrollingNodeScrollViewDelegate actingParentScrollViewForScrollView:]): Deleted.
(-[WKScrollingNodeScrollViewDelegate scrollView:handleScrollEvent:completion:]): Deleted.
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::handleAsynchronousCancelableScrollEvent):
* Source/WebKit/UIProcess/ios/WKBaseScrollView.h:
* Source/WebKit/UIProcess/ios/WKBaseScrollView.mm:
(-[WKBaseScrollView initWithFrame:]):
(-[WKBaseScrollView _subclassHandlesAsyncScrollEvent]): Deleted.
(-[WKBaseScrollView _asynchronouslyHandleScrollEvent:completion:]): Deleted.
Remove these subclass method implementations, which are no longer necessary after adopting the new
delegate methods.
(-[WKBaseScrollView _actingParentScrollView]): Deleted.
* Source/WebKit/UIProcess/ios/WKMouseInteraction.mm:
(-[WKMouseInteraction createMouseEventWithType:wasCancelled:]):
* Source/WebKit/UIProcess/ios/WKSEDefinitions.h:
Add fallback declarations for the new scroll-view-related `WKSE*` symbols.
* Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm:
(legacyScrollPhase):
(createScrollUpdate):
Update these API tests to call into the new delegate methods and create `WKSEScrollViewScrollUpdate`
instead of `UIScrollEvent` if needed.
Canonical link: https://commits.webkit.org/273026@main
More information about the webkit-changes
mailing list