[iOS][WK2] Remove the _extendedBackgroundExclusionInsets SPI
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2014 22:34:21 +0000 (22:34 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2014 22:34:21 +0000 (22:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132848
<rdar://problem/16875093>

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-05-13
Reviewed by Darin Adler.

The SPI is no longer needed by Safari.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView _updateScrollViewBackground]):
(-[WKWebView _frameOrBoundsChanged]):
(-[WKWebView _setObscuredInsets:]):
(-[WKWebView _endAnimatedResize]):
(updateTopAndBottomExtendedBackgroundExclusionIfNecessary): Deleted.
(-[WKWebView _setExtendedBackgroundExclusionInsets:]): Deleted.
(-[WKWebView _extendedBackgroundExclusionInsets]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h

index cee4493..6dc90c7 100644 (file)
@@ -1,3 +1,24 @@
+2014-05-13  Benjamin Poulain  <bpoulain@apple.com>
+
+        [iOS][WK2] Remove the _extendedBackgroundExclusionInsets SPI
+        https://bugs.webkit.org/show_bug.cgi?id=132848
+        <rdar://problem/16875093>
+
+        Reviewed by Darin Adler.
+
+        The SPI is no longer needed by Safari.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        (-[WKWebView _updateScrollViewBackground]):
+        (-[WKWebView _frameOrBoundsChanged]):
+        (-[WKWebView _setObscuredInsets:]):
+        (-[WKWebView _endAnimatedResize]):
+        (updateTopAndBottomExtendedBackgroundExclusionIfNecessary): Deleted.
+        (-[WKWebView _setExtendedBackgroundExclusionInsets:]): Deleted.
+        (-[WKWebView _extendedBackgroundExclusionInsets]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
 2014-05-13  Samuel White  <samuel_white@apple.com>
 
         AX: Hit testing not accounting for top content inset.
index 22b9438..62e4420 100644 (file)
     UIEdgeInsets _obscuredInsets;
     bool _isChangingObscuredInsetsInteractively;
 
-    UIEdgeInsets _extendedBackgroundExclusionInsets;
-    UIView *_mainExtendedBackgroundView;
-    UIView *_extendedBackgroundLayerTopInset;
-    UIView *_extendedBackgroundLayerBottomInset;
-
     BOOL _needsResetViewStateAfterCommitLoadForMainFrame;
     BOOL _isAnimatingResize;
     CATransform3D _resizeAnimationTransformAdjustments;
     [_scrollView setBouncesZoom:YES];
 
     [self addSubview:_scrollView.get()];
-    _mainExtendedBackgroundView = _scrollView.get();
-    _mainExtendedBackgroundView.backgroundColor = [UIColor whiteColor];
+    [_scrollView setBackgroundColor:[UIColor whiteColor]];
 
     _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:context configuration:std::move(webPageConfiguration) webView:self]);
     _page = [_contentView page];
@@ -455,9 +449,7 @@ static CGFloat contentZoomScale(WKWebView* webView)
     _scrollViewBackgroundColor = color;
 
     RetainPtr<UIColor*> uiBackgroundColor = adoptNS([[UIColor alloc] initWithCGColor:cachedCGColor(color, WebCore::ColorSpaceDeviceRGB)]);
-    _mainExtendedBackgroundView.backgroundColor = uiBackgroundColor.get();
-    _extendedBackgroundLayerTopInset.backgroundColor = uiBackgroundColor.get();
-    _extendedBackgroundLayerBottomInset.backgroundColor = uiBackgroundColor.get();
+    [_scrollView setBackgroundColor:uiBackgroundColor.get()];
 }
 
 - (void)_didCommitLoadForMainFrame
@@ -868,13 +860,6 @@ static inline void setViewportConfigurationMinimumLayoutSize(WebKit::WebPageProx
 {
     CGRect bounds = self.bounds;
 
-    CGRect backgroundLayerRect = UIEdgeInsetsInsetRect(bounds, _extendedBackgroundExclusionInsets);
-    _mainExtendedBackgroundView.frame = backgroundLayerRect;
-    if (!_extendedBackgroundExclusionInsets.top && _obscuredInsets.top)
-        _extendedBackgroundLayerTopInset.frame = CGRectMake(0, 0, bounds.size.width, _obscuredInsets.top);
-    if (!_extendedBackgroundExclusionInsets.bottom && _obscuredInsets.bottom)
-        _extendedBackgroundLayerBottomInset.frame = CGRectMake(0, bounds.size.height - _obscuredInsets.bottom, bounds.size.width, _obscuredInsets.bottom);
-
     if (!_hasStaticMinimumLayoutSize && !_isAnimatingResize)
         setViewportConfigurationMinimumLayoutSize(*_page, bounds.size);
     [_scrollView setFrame:bounds];
@@ -1461,35 +1446,6 @@ static inline WebKit::FindOptions toFindOptions(_WKFindOptions wkFindOptions)
     return _obscuredInsets;
 }
 
-static void updateTopAndBottomExtendedBackgroundExclusionIfNecessary(WKWebView* webView)
-{
-    if (webView->_obscuredInsets.top && !webView->_extendedBackgroundExclusionInsets.top) {
-        if (!webView->_extendedBackgroundLayerTopInset) {
-            RetainPtr<UIView> backgroundView = adoptNS([[UIView alloc] init]);
-            [backgroundView setBackgroundColor:webView->_mainExtendedBackgroundView.backgroundColor];
-            [webView insertSubview:backgroundView.get() belowSubview:webView->_scrollView.get()];
-            webView->_extendedBackgroundLayerTopInset = backgroundView.get();
-            [UIView performWithoutAnimation: ^{
-                [webView->_extendedBackgroundLayerTopInset setFrame:CGRectMake(0, 0, 0, webView->_obscuredInsets.top)];
-            }];
-        }
-
-        [webView->_extendedBackgroundLayerTopInset setFrame:CGRectMake(0, 0, webView->_extendedBackgroundExclusionInsets.left, webView->_obscuredInsets.top)];
-    }
-    if (webView->_obscuredInsets.bottom && !webView->_extendedBackgroundExclusionInsets.bottom) {
-        if (!webView->_extendedBackgroundLayerBottomInset) {
-            RetainPtr<UIView> backgroundView = adoptNS([[UIView alloc] init]);
-            [backgroundView setBackgroundColor:webView->_mainExtendedBackgroundView.backgroundColor];
-            [webView insertSubview:backgroundView.get() belowSubview:webView->_scrollView.get()];
-            webView->_extendedBackgroundLayerBottomInset = backgroundView.get();
-            [UIView performWithoutAnimation: ^{
-                [webView->_extendedBackgroundLayerBottomInset setFrame:CGRectMake(0, webView.bounds.size.height - webView->_obscuredInsets.bottom, 0, webView->_obscuredInsets.bottom)];
-            }];
-        }
-        [webView->_extendedBackgroundLayerBottomInset setFrame:CGRectMake(0, webView.bounds.size.height - webView->_obscuredInsets.bottom, webView->_extendedBackgroundExclusionInsets.left, webView->_obscuredInsets.bottom)];
-    }
-}
-
 - (void)_setObscuredInsets:(UIEdgeInsets)obscuredInsets
 {
     ASSERT(obscuredInsets.top >= 0);
@@ -1502,8 +1458,6 @@ static void updateTopAndBottomExtendedBackgroundExclusionIfNecessary(WKWebView*
 
     _obscuredInsets = obscuredInsets;
 
-    updateTopAndBottomExtendedBackgroundExclusionIfNecessary(self);
-
     [self _updateVisibleContentRects];
 }
 
@@ -1517,33 +1471,6 @@ static void updateTopAndBottomExtendedBackgroundExclusionIfNecessary(WKWebView*
     return _page->backgroundExtendsBeyondPage();
 }
 
-- (void)_setExtendedBackgroundExclusionInsets:(UIEdgeInsets)extendedBackgroundExclusionInsets
-{
-    if (UIEdgeInsetsEqualToEdgeInsets(extendedBackgroundExclusionInsets, _extendedBackgroundExclusionInsets))
-        return;
-
-    CGRect bounds = self.bounds;
-    if (_mainExtendedBackgroundView == _scrollView) {
-        [UIView performWithoutAnimation: ^{
-            RetainPtr<UIView> backgroundView = adoptNS([[UIView alloc] initWithFrame:bounds]);
-            _mainExtendedBackgroundView = backgroundView.get();
-            _mainExtendedBackgroundView.backgroundColor = [_scrollView backgroundColor];
-            [self insertSubview:_mainExtendedBackgroundView belowSubview:_scrollView.get()];
-            [_scrollView setBackgroundColor:nil];
-        }];
-    }
-
-    _extendedBackgroundExclusionInsets = extendedBackgroundExclusionInsets;
-    _mainExtendedBackgroundView.frame = UIEdgeInsetsInsetRect(bounds, _extendedBackgroundExclusionInsets);
-
-    updateTopAndBottomExtendedBackgroundExclusionIfNecessary(self);
-}
-
-- (UIEdgeInsets)_extendedBackgroundExclusionInsets
-{
-    return _extendedBackgroundExclusionInsets;
-}
-
 - (void)_beginInteractiveObscuredInsetsChange
 {
     ASSERT(!_isChangingObscuredInsetsInteractively);
@@ -1664,13 +1591,6 @@ static void updateTopAndBottomExtendedBackgroundExclusionIfNecessary(WKWebView*
     _isAnimatingResize = NO;
     _resizeAnimationTransformAdjustments = CATransform3DIdentity;
 
-    if (!_extendedBackgroundExclusionInsets.left) {
-        [_extendedBackgroundLayerTopInset removeFromSuperview];
-        _extendedBackgroundLayerTopInset = nil;
-        [_extendedBackgroundLayerBottomInset removeFromSuperview];
-        _extendedBackgroundLayerBottomInset = nil;
-    }
-
     [self _updateVisibleContentRects];
 }
 
index e55be28..ee7422b 100644 (file)
@@ -103,10 +103,6 @@ typedef NS_OPTIONS(NSUInteger, _WKFindOptions) {
 
 @property (nonatomic, setter=_setBackgroundExtendsBeyondPage:) BOOL _backgroundExtendsBeyondPage;
 
-// If BackgroundExtendsBeyondPage is set, the background of a page extend to the edges of the webview.
-// The extendedBackgroundExclusionInsets defines insets where the background is not extended. The view is transparent in those areas.
-@property (nonatomic, setter=_setExtendedBackgroundExclusionInsets:) UIEdgeInsets _extendedBackgroundExclusionInsets;
-
 // FIXME: Remove these three properties once we expose WKWebViewContentProvider as API.
 @property (nonatomic, readonly, getter=_isDisplayingPDF) BOOL _displayingPDF;
 @property (nonatomic, readonly) NSData *_dataForDisplayedPDF;