Title: [171329] trunk/Source/WebKit2
Revision
171329
Author
[email protected]
Date
2014-07-21 17:58:40 -0700 (Mon, 21 Jul 2014)

Log Message

REGRESSION (r170361): In landscape with UI hidden, fixed position elements at top of screen are too low
https://bugs.webkit.org/show_bug.cgi?id=135141
<rdar://problem/17627525>

Reviewed by Benjamin Poulain.

We can't use the WKWebView's UIScrollView contentInsets to determine the unobscured rect
in MobileSafari, because contentInsets can't be changed dynamically while scrolling.
To get around this, MobileSafari sets obscured insets instead (but also sets a fixed
contentInset).

So if the client calls _setObscuredInsets:, always use _obscuredInsets to compute the
content insets.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _computedContentInset]):
(-[WKWebView _setObscuredInsets:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (171328 => 171329)


--- trunk/Source/WebKit2/ChangeLog	2014-07-22 00:58:11 UTC (rev 171328)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-22 00:58:40 UTC (rev 171329)
@@ -1,3 +1,23 @@
+2014-07-21  Simon Fraser  <[email protected]>
+
+        REGRESSION (r170361): In landscape with UI hidden, fixed position elements at top of screen are too low
+        https://bugs.webkit.org/show_bug.cgi?id=135141
+        <rdar://problem/17627525>
+
+        Reviewed by Benjamin Poulain.
+        
+        We can't use the WKWebView's UIScrollView contentInsets to determine the unobscured rect
+        in MobileSafari, because contentInsets can't be changed dynamically while scrolling.
+        To get around this, MobileSafari sets obscured insets instead (but also sets a fixed
+        contentInset).
+        
+        So if the client calls _setObscuredInsets:, always use _obscuredInsets to compute the 
+        content insets.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _computedContentInset]):
+        (-[WKWebView _setObscuredInsets:]):
+
 2014-07-21  Oliver Hunt  <[email protected]>
 
         Remove global cookie workaround from sandbox profiles

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (171328 => 171329)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-07-22 00:58:11 UTC (rev 171328)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-07-22 00:58:40 UTC (rev 171329)
@@ -168,7 +168,8 @@
     CGFloat _viewportMetaTagWidth;
 
     UIEdgeInsets _obscuredInsets;
-    bool _isChangingObscuredInsetsInteractively;
+    BOOL _haveSetObscuredInsets;
+    BOOL _isChangingObscuredInsetsInteractively;
 
     UIInterfaceOrientation _interfaceOrientationOverride;
     BOOL _overridesInterfaceOrientation;
@@ -740,7 +741,7 @@
 
 - (UIEdgeInsets)_computedContentInset
 {
-    if (!UIEdgeInsetsEqualToEdgeInsets(_obscuredInsets, UIEdgeInsetsZero))
+    if (_haveSetObscuredInsets)
         return _obscuredInsets;
 
     return [_scrollView contentInset];
@@ -2076,6 +2077,8 @@
     ASSERT(obscuredInsets.left >= 0);
     ASSERT(obscuredInsets.bottom >= 0);
     ASSERT(obscuredInsets.right >= 0);
+    
+    _haveSetObscuredInsets = YES;
 
     if (UIEdgeInsetsEqualToEdgeInsets(_obscuredInsets, obscuredInsets))
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to