Dispatch top content inset changes immediately if synchronously waiting for view...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jul 2014 21:26:27 +0000 (21:26 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jul 2014 21:26:27 +0000 (21:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134942
<rdar://problem/17666800>

Reviewed by Simon Fraser.

* UIProcess/API/mac/WKView.mm:
(-[WKView endDeferringViewInWindowChanges]):
(-[WKView endDeferringViewInWindowChangesSync]):
(-[WKView _dispatchSetTopContentInset]):
(-[WKView _setTopContentInset:]):
Send top content inset changes immediately before sync-waiting for new tiles from the Web Process.
This will ensure that the incoming contents have the right top content inset, and we don't
flash between the wrong inset and the right one.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm

index f58a1a151485ca1c13989209be7ed61fe8296e8b..4b1192e8221111dcb7a77e129493aa5953d6b41c 100644 (file)
@@ -1,3 +1,20 @@
+2014-07-15  Timothy Horton  <timothy_horton@apple.com>
+
+        Dispatch top content inset changes immediately if synchronously waiting for view state changes
+        https://bugs.webkit.org/show_bug.cgi?id=134942
+        <rdar://problem/17666800>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView endDeferringViewInWindowChanges]):
+        (-[WKView endDeferringViewInWindowChangesSync]):
+        (-[WKView _dispatchSetTopContentInset]):
+        (-[WKView _setTopContentInset:]):
+        Send top content inset changes immediately before sync-waiting for new tiles from the Web Process.
+        This will ensure that the incoming contents have the right top content inset, and we don't
+        flash between the wrong inset and the right one.
+
 2014-07-15  Enrica Casucci  <enrica@apple.com>
 
         REGRESSION(WK2 iOS): Safari hangs when switching focus from a field using the Tab key.
index d895427dd29c00fdde060ded330e3e37f519ca97..50c90674d2f635f6bd7b7c3c27356b81272e55db 100644 (file)
@@ -3834,6 +3834,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     _data->_shouldDeferViewInWindowChanges = NO;
 
     if (_data->_viewInWindowChangeWasDeferred) {
+        [self _dispatchSetTopContentInset];
         _data->_page->viewStateDidChange(ViewState::IsInWindow);
         _data->_viewInWindowChangeWasDeferred = NO;
     }
@@ -3849,6 +3850,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     _data->_shouldDeferViewInWindowChanges = NO;
 
     if (_data->_viewInWindowChangeWasDeferred) {
+        [self _dispatchSetTopContentInset];
         _data->_page->viewStateDidChange(ViewState::IsInWindow);
         _data->_viewInWindowChangeWasDeferred = NO;
     }
@@ -3881,6 +3883,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     return _data->_allowsBackForwardNavigationGestures;
 }
 
+- (void)_dispatchSetTopContentInset
+{
+    _data->_didScheduleSetTopContentInset = NO;
+    _data->_page->setTopContentInset(_data->_topContentInset);
+}
+
 - (void)_setTopContentInset:(CGFloat)contentInset
 {
     _data->_topContentInset = contentInset;
@@ -3891,9 +3899,8 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     _data->_didScheduleSetTopContentInset = YES;
 
     dispatch_async(dispatch_get_main_queue(), ^{
-        _data->_didScheduleSetTopContentInset = NO;
-
-        _data->_page->setTopContentInset(_data->_topContentInset);
+        if (_data->_didScheduleSetTopContentInset)
+            [self _dispatchSetTopContentInset];
     });
 }