Force scroll view insets to be respected regardless of rubber-banding state
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Apr 2017 17:14:58 +0000 (17:14 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Apr 2017 17:14:58 +0000 (17:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170937
<rdar://problem/31412788>

Reviewed by Simon Fraser.

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

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

Source/WebKit2/ChangeLog
Source/WebKit2/Platform/spi/ios/UIKitSPI.h
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

index 0da5291..c3a131c 100644 (file)
@@ -1,3 +1,15 @@
+2017-04-18  Timothy Horton  <timothy_horton@apple.com>
+
+        Force scroll view insets to be respected regardless of rubber-banding state
+        https://bugs.webkit.org/show_bug.cgi?id=170937
+        <rdar://problem/31412788>
+
+        Reviewed by Simon Fraser.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+
 2017-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GLIB] Define priorities also for async network IO tasks
index 6bcb066..7ca5f35 100644 (file)
@@ -305,6 +305,13 @@ typedef enum {
 @end
 #endif
 
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
+typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) {
+    UIScrollViewContentInsetAdjustmentAutomatic = 0,
+    UIScrollViewContentInsetAdjustmentAlways = 3,
+};
+#endif
+
 @interface UIScrollView ()
 - (void)_stopScrollingAndZoomingAnimations;
 - (void)_zoomToCenter:(CGPoint)center scale:(CGFloat)scale duration:(CFTimeInterval)duration force:(BOOL)force;
@@ -317,6 +324,7 @@ typedef enum {
 @property (nonatomic, readonly) BOOL _isInterruptingDeceleration;
 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
 @property (nonatomic, readonly) UIEdgeInsets _systemContentInset;
+@property (nonatomic, setter=_setContentInsetAdjustmentBehavior:, getter=_contentInsetAdjustmentBehavior) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior;
 #endif
 @end
 
index fb7e74a..aeec260 100644 (file)
@@ -504,6 +504,11 @@ static uint32_t convertSystemLayoutDirection(NSUserInterfaceLayoutDirection dire
     _scrollView = adoptNS([[WKScrollView alloc] initWithFrame:bounds]);
     [_scrollView setInternalDelegate:self];
     [_scrollView setBouncesZoom:YES];
+    
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+    if ([_scrollView _contentInsetAdjustmentBehavior] == UIScrollViewContentInsetAdjustmentAutomatic)
+        [_scrollView _setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAlways];
+#endif
 
     [self addSubview:_scrollView.get()];