[webkit-changes] [WebKit/WebKit] 04eccf: [iOS] Adopt UIScrollView APIs to check for and sto...

Wenson Hsieh noreply at github.com
Thu Oct 19 11:13:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 04eccfc4a2c7392fd27b9d44880e776cd784f68e
      https://github.com/WebKit/WebKit/commit/04eccfc4a2c7392fd27b9d44880e776cd784f68e
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-10-19 (Thu, 19 Oct 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm
    M Source/WebKit/UIProcess/ios/UIKitUtilities.h
    M Source/WebKit/UIProcess/ios/UIKitUtilities.mm

  Log Message:
  -----------
  [iOS] Adopt UIScrollView APIs to check for and stop active scrolling/zooming animations
https://bugs.webkit.org/show_bug.cgi?id=263345
rdar://114329712

Reviewed by Richard Robinson.

Stop suppressing several deprecation warnings added in 269381 at main; instead, adopt new UIScrollView
API from UIKit, which implements the equivalent functionality:

1. `-_isAnimatingScroll` -> `-_isScrollAnimating`.
2. `-_isAnimatingZoom` -> `-_isZoomAnimating`.
3. `-_stopScrollingAndZoomingAnimations` -> `-stopScrollingAndZooming`.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _didCommitLoadForMainFrame]):
(-[WKWebView _updateScrollViewForTransaction:]):
(-[WKWebView _scrollToContentScrollPosition:scrollOrigin:animated:]):
(-[WKWebView _viewStabilityState:]):

Replace the `-_isScrollingToTop` check with a more encompassing `-isScrollAnimating` check when
determining view stability.

* Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::stopAnimatedScroll):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
* Source/WebKit/UIProcess/ios/UIKitUtilities.h:
* Source/WebKit/UIProcess/ios/UIKitUtilities.mm:

Add new category helpers on `UIScrollView`, which abstract away the complexity of deciding which
APIs to use, depending on the SDK version and whether the new method and properties are available at
runtime.

Also, add temporary staging declarations so that we can fail gracefully when the new compile-time
flag `HAVE(UI_SCROLL_VIEW_APIS_ADDED_IN_RADAR_112474145)` is enabled, but the requisite APIs are
missing at runtime.

(-[UIScrollView _wk_isScrollAnimating]):
(-[UIScrollView _wk_isZoomAnimating]):
(-[UIScrollView _wk_stopScrollingAndZooming]):

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




More information about the webkit-changes mailing list