Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2699f14fcf782b29a5906b9ba8e4059d5503718a
      
https://github.com/WebKit/WebKit/commit/2699f14fcf782b29a5906b9ba8e4059d5503718a
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2023-12-04 (Mon, 04 Dec 2023)

  Changed paths:
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.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/ScrollingTreeFrameScrollingNodeRemoteIOS.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreePluginScrollingNodeIOS.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreePluginScrollingNodeIOS.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
    R Source/WebKit/UIProcess/ios/WKAxisLockingScrollView.h
    R Source/WebKit/UIProcess/ios/WKAxisLockingScrollView.mm
    A Source/WebKit/UIProcess/ios/WKBaseScrollView.h
    A Source/WebKit/UIProcess/ios/WKBaseScrollView.mm
    M Source/WebKit/UIProcess/ios/WKScrollView.mm
    M Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestRunnerShared/spi/UIKitSPIForTesting.h
    M Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm

  Log Message:
  -----------
  Adopt alternatives for scroll view SPI: 
-_scrollView:asynchronouslyHandleScrollEvent:completion:
https://bugs.webkit.org/show_bug.cgi?id=265732
rdar://114330492

Reviewed by Richard Robinson.

Refactor support for handling async wheel events in WebKit, when scrolling via 
trackpad on iPadOS.
In place of these private scroll view delegate methods, we now have subclassing 
hooks on
`UIScrollView` that provide equivalent functionality.

To achieve this, we add async scroll event support to a common base class 
between `WKScrollView` and
`WKChildScrollView`. We rename this base class (currently, 
`WKAxisLockingScrollView`) into
`WKBaseScrollView` to reflect its new responsibility, and implement the new 
async scroll event
methods on `WKScrollingNodeScrollViewDelegate` and `WKWebView`.

For the legacy private delegate methods, we conditionalize their 
implementations on a new compile-
time flag (if `UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_SUBCLASS_HOOKS` is off), 
and call through to
the new `WKBaseScrollViewDelegate` method.

* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setupScrollAndContentViews]):

Move the `-_setAllowsAsyncScrollEvent:` call into `WKBaseScrollView`, only when 
the
`UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_SUBCLASS_HOOKS` flag isn't set.

(-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
(-[WKWebView _scrollView:asynchronouslyHandleScrollEvent:completion:]):

Implement these legacy methods only when 
`UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_SUBCLASS_HOOKS` is
not set.

(-[WKWebView scrollView:handleScrollEvent:completion:]):

Implement the new `WKBaseScrollView` delegate method for handling async scroll 
events.

(-[WKWebView axesToPreventScrollingForPanGestureInScrollView:]):
* Source/WebKit/UIProcess/PageClient.h:
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(-[WKChildScrollView initWithFrame:]):
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollView const):
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollView const):
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreePluginScrollingNodeIOS.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreePluginScrollingNodeIOS.mm:
(WebKit::ScrollingTreePluginScrollingNodeIOS::scrollView const):
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate 
scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
(-[WKScrollingNodeScrollViewDelegate 
axesToPreventScrollingForPanGestureInScrollView:]):
(-[WKScrollingNodeScrollViewDelegate 
_scrollView:asynchronouslyHandleScrollEvent:completion:]):
(-[WKScrollingNodeScrollViewDelegate scrollView:handleScrollEvent:completion:]):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::handleAsynchronousCancelableScrollEvent):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const):
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::handleAsynchronousCancelableScrollEvent):
* Source/WebKit/UIProcess/ios/WKBaseScrollView.h: Renamed from 
Source/WebKit/UIProcess/ios/WKAxisLockingScrollView.h.
* Source/WebKit/UIProcess/ios/WKBaseScrollView.mm: Renamed from 
Source/WebKit/UIProcess/ios/WKAxisLockingScrollView.mm.
(-[WKBaseScrollView initWithFrame:]):
(-[WKBaseScrollView addGestureRecognizer:]):
(-[WKBaseScrollView removeGestureRecognizer:]):
(-[WKBaseScrollView _updatePanGestureToPreventScrolling]):
(-[WKBaseScrollView _axesToPreventScrollingFromDelegate]):

Drive-by fix: fall back to `UIAxisNeither` instead of `UIAxisBoth` if the 
delegate is unset. Note
that this shouldn't actually change behavior in practice, since the delegate is 
always set for the
subclasses.

(-[WKBaseScrollView _subclassHandlesAsyncScrollEvent]):
(-[WKBaseScrollView _asynchronouslyHandleScrollEvent:completion:]):
(-[WKBaseScrollView 
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[WKBaseScrollView gestureRecognizerShouldBegin:]):
* Source/WebKit/UIProcess/ios/WKScrollView.mm:
(-[WKScrollView initWithFrame:]):
* Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestRunnerShared/spi/UIKitSPIForTesting.h:
* Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm:

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to