[iOS WK2] Allow scrolling interaction on frames and oveflow scroll even when the...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jul 2019 22:49:32 +0000 (22:49 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jul 2019 22:49:32 +0000 (22:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199963
rdar://problem/52897797

Reviewed by Tim Horton.

Adopt UIKit SPI to allow for scrolling of inner UIScrollViews when the outer one is still rubber-banding.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247656 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Platform/spi/ios/UIKitSPI.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm

index 866064b..8f829cc 100644 (file)
         (WebKit::StorageAreaMap::prewarm):
         * WebProcess/WebStorage/StorageAreaMap.h:
 
+2019-07-19  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS WK2] Allow scrolling interaction on frames and oveflow scroll even when the main frame is rubber-banding
+        https://bugs.webkit.org/show_bug.cgi?id=199963
+        rdar://problem/52897797
+
+        Reviewed by Tim Horton.
+
+        Adopt UIKit SPI to allow for scrolling of inner UIScrollViews when the outer one is still rubber-banding.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
+
 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
 
         Set WordIsNearTap flag, was not being set at all before
index 0b12e43..dc1f68c 100644 (file)
@@ -1117,6 +1117,9 @@ typedef NS_OPTIONS(NSInteger, UIWKDocumentRequestFlags) {
 - (void)_setContentOffsetWithDecelerationAnimation:(CGPoint)contentOffset;
 - (CGPoint)_adjustedContentOffsetForContentOffset:(CGPoint)contentOffset;
 - (void)_flashScrollIndicatorsPersistingPreviousFlashes:(BOOL)persisting;
+
+@property (nonatomic) BOOL tracksImmediatelyWhileDecelerating;
+@property (nonatomic, getter=_avoidsJumpOnInterruptedBounce, setter=_setAvoidsJumpOnInterruptedBounce:) BOOL _avoidsJumpOnInterruptedBounce;
 @end
 
 @interface UIPeripheralHost (IPI)
index 1a75fa3..df278ae 100644 (file)
@@ -690,6 +690,11 @@ static void validate(WKWebViewConfiguration *configuration)
     [_scrollView setInternalDelegate:self];
     [_scrollView setBouncesZoom:YES];
 
+    if ([_scrollView respondsToSelector:@selector(_setAvoidsJumpOnInterruptedBounce:)]) {
+        [_scrollView setTracksImmediatelyWhileDecelerating:NO];
+        [_scrollView _setAvoidsJumpOnInterruptedBounce:YES];
+    }
+
     if ([_configuration _editableImagesEnabled])
         [_scrollView panGestureRecognizer].allowedTouchTypes = @[ @(UITouchTypeDirect) ];
 
index 1e55e4e..7b3f11b 100644 (file)
@@ -248,6 +248,11 @@ void ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren(const Scrol
 
             scrollView.scrollsToTop = NO;
             scrollView.delegate = m_scrollViewDelegate.get();
+
+            if ([scrollView respondsToSelector:@selector(_setAvoidsJumpOnInterruptedBounce:)]) {
+                scrollView.tracksImmediatelyWhileDecelerating = NO;
+                scrollView._avoidsJumpOnInterruptedBounce = YES;
+            }
         }
 
         bool recomputeInsets = scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize);