Title: [210041] trunk/Source/WebKit2
Revision
210041
Author
[email protected]
Date
2016-12-20 15:32:28 -0800 (Tue, 20 Dec 2016)

Log Message

[iOS WK2] Switching or closing a tab leads to all-white tab content if the status bar is double height
https://bugs.webkit.org/show_bug.cgi?id=166286
rdar://problem/29593525

Reviewed by Tim Horton.

A double-height status bar triggers view resize while snapshotting in the background,
which also triggers calls to _endAnimatedResize on tab resume. However, it was possible
for _endAnimatedResize to re-enter via synchronizeDynamicViewportUpdate()/didCommitLayerTree(),
causing us to use a nil _resizeAnimationView for scale computations, thus setting a zero
scale on the WKContentView.

Fix by checking _dynamicViewportUpdateMode again after the call to synchronizeDynamicViewportUpdate(),
and do a belt-and-braces check for a nil _resizeAnimationView.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (210040 => 210041)


--- trunk/Source/WebKit2/ChangeLog	2016-12-20 23:31:10 UTC (rev 210040)
+++ trunk/Source/WebKit2/ChangeLog	2016-12-20 23:32:28 UTC (rev 210041)
@@ -1,3 +1,23 @@
+2016-12-20  Simon Fraser  <[email protected]>
+
+        [iOS WK2] Switching or closing a tab leads to all-white tab content if the status bar is double height
+        https://bugs.webkit.org/show_bug.cgi?id=166286
+        rdar://problem/29593525
+
+        Reviewed by Tim Horton.
+
+        A double-height status bar triggers view resize while snapshotting in the background,
+        which also triggers calls to _endAnimatedResize on tab resume. However, it was possible
+        for _endAnimatedResize to re-enter via synchronizeDynamicViewportUpdate()/didCommitLayerTree(),
+        causing us to use a nil _resizeAnimationView for scale computations, thus setting a zero
+        scale on the WKContentView.
+
+        Fix by checking _dynamicViewportUpdateMode again after the call to synchronizeDynamicViewportUpdate(),
+        and do a belt-and-braces check for a nil _resizeAnimationView.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _endAnimatedResize]):
+
 2016-12-20  Andy Estes  <[email protected]>
 
         [Cocoa] REGRESSION (r209558): Calling decisionHandler multiple times in webView:decidePolicyForNavigationAction:decisionHandler: leads to a crash

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


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-12-20 23:31:10 UTC (rev 210040)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-12-20 23:32:28 UTC (rev 210041)
@@ -4304,6 +4304,18 @@
 
     _page->synchronizeDynamicViewportUpdate();
 
+    // synchronizeDynamicViewportUpdate() may cause this function to re-enter via _didCommitLayerTree, so check _dynamicViewportUpdateMode again.
+    if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::NotResizing)
+        return;
+
+    if (!_resizeAnimationView) {
+        // Paranoia. If _resizeAnimationView is null we'll end up setting a zero scale on the content view.
+        ASSERT_NOT_REACHED();
+        _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing;
+        [_contentView setHidden:NO];
+        return;
+    }
+    
     NSUInteger indexOfResizeAnimationView = [[_scrollView subviews] indexOfObject:_resizeAnimationView.get()];
     [_scrollView insertSubview:_contentView.get() atIndex:indexOfResizeAnimationView];
     [_scrollView insertSubview:[_contentView unscaledView] atIndex:indexOfResizeAnimationView + 1];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to