Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 5d0fdb0896b24f0f31078bac5b067fc6ae0d9ac1 https://github.com/WebKit/WebKit/commit/5d0fdb0896b24f0f31078bac5b067fc6ae0d9ac1 Author: Wenson Hsieh <wenson_hs...@apple.com> Date: 2023-10-10 (Tue, 10 Oct 2023)
Changed paths: M Source/WebKit/Platform/spi/ios/UIKitSPI.h M Source/WebKit/SourcesCocoa.txt M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm M Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h M Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm M Source/WebKit/UIProcess/ios/WKPDFView.mm M Source/WebKit/UIProcess/ios/WKScrollView.h A Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.h A Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.mm M Source/WebKit/WebKit.xcodeproj/project.pbxproj Log Message: ----------- Stop using -[UIScrollView _horizontalVelocity] and -[UIScrollView _verticalVelocity] https://bugs.webkit.org/show_bug.cgi?id=262964 Reviewed by Tim Horton. Stop using these two SPI properties on `UIScrollView`. Instead, track horizontal and vertical velocities on `WKScrollView` by storing a moving window of the last 3 recent scrolling deltas, and using the average of this to estimate horizontal and vertical scrolling velocities. This velocity tracking functionality is contained within a new `WKVelocityTrackingScrollView` class, which `WKScrollView` now subclasses; this will make it easier to eventually bring smooth keyboard scrolling to overflow/iframe `WKChildScrollView`s, which can be refactored to extend from `WKVelocityTrackingScrollView` and integrate with their own keyboard scrolling animators. See below for more details. * Source/WebKit/Platform/spi/ios/UIKitSPI.h: Remove now-unused SPI declarations on `UIScrollView`. * Source/WebKit/SourcesCocoa.txt: * Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h: Add an internal iOS property on `WKWebView` to return a `WKVelocityTrackingScrollView` (as opposed to a `UIScrollView`, which is what the API `-scrollView` property returns to clients). Drive-by fix: also remove a couple of unused ivars. * Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h: * Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView scrollViewDidScroll:]): Call into `WKScrollView` to update the velocity tracking window if needed. (-[WKWebView _scrollViewInternal]): * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): * Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h: * Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollViewAnimator initWithScrollView:]): (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]): (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]): (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]): (-[WKKeyboardScrollViewAnimator contentOffset]): (-[WKKeyboardScrollViewAnimator boundedContentOffset:]): (-[WKKeyboardScrollViewAnimator interactiveScrollVelocity]): Use the new `-interactiveScrollVelocityInPointsPerSecond` property instead of scroll view SPI. (-[WKKeyboardScrollViewAnimator scrollableDirectionsFromOffset:]): (-[WKKeyboardScrollViewAnimator rubberbandableDirections]): Drive-by refactoring: change `WKScrollView` to a `__weak` reference, to eliminate the need for `getAutoreleased()`. * Source/WebKit/UIProcess/ios/WKPDFView.mm: (-[WKPDFView web_initWithFrame:webView:mimeType:]): * Source/WebKit/UIProcess/ios/WKScrollView.h: Make this subclass `WKVelocityTrackingScrollView`, for scrolling velocity tracking functionality. * Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.h: Copied from Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h. * Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.mm: Added. (ScrollingDeltaWindow::update): (ScrollingDeltaWindow::reset): (ScrollingDeltaWindow::averageVelocity const): (-[WKVelocityTrackingScrollView updateInteractiveScrollVelocity]): (-[WKVelocityTrackingScrollView interactiveScrollVelocityInPointsPerSecond]): * Source/WebKit/WebKit.xcodeproj/project.pbxproj: Canonical link: https://commits.webkit.org/269177@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes