Title: [214574] branches/safari-604.1.14-branch/Source/WebKit2
Revision
214574
Author
jmarc...@apple.com
Date
2017-03-29 16:41:44 -0700 (Wed, 29 Mar 2017)

Log Message

Cherry-pick r214391. rdar://problem/30682584

Modified Paths

Diff

Modified: branches/safari-604.1.14-branch/Source/WebKit2/ChangeLog (214573 => 214574)


--- branches/safari-604.1.14-branch/Source/WebKit2/ChangeLog	2017-03-29 23:41:41 UTC (rev 214573)
+++ branches/safari-604.1.14-branch/Source/WebKit2/ChangeLog	2017-03-29 23:41:44 UTC (rev 214574)
@@ -1,3 +1,24 @@
+2017-03-29  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r214391. rdar://problem/30682584
+
+    2017-03-24  Simon Fraser  <simon.fra...@apple.com>
+
+            [iOS WK2] Move from a pre-commit handler to dispatch_async for visible content rect updates
+            https://bugs.webkit.org/show_bug.cgi?id=170091
+            rdar://problem/30682584
+
+            Reviewed by Tim Horton.
+
+            [CATransaction addCommitHandler:forPhase:] is sometimes not called when running inside another
+            commit callback (rdar://problem/31253952), and we don't yet have a reliable way to detect this.
+
+            So dispatch_async() to postpone the call to [CATransaction addCommitHandler:forPhase:] to a known-
+            good time.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
+
 2017-03-24  John Wilander  <wilan...@apple.com>
 
         Re-enable the network process' keychain access to fix client certificate authentication

Modified: branches/safari-604.1.14-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (214573 => 214574)


--- branches/safari-604.1.14-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-03-29 23:41:41 UTC (rev 214573)
+++ branches/safari-604.1.14-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-03-29 23:41:44 UTC (rev 214574)
@@ -288,7 +288,7 @@
 
     RetainPtr<WKPasswordView> _passwordView;
 
-    BOOL _hasInstalledPreCommitHandlerForVisibleRectUpdate;
+    BOOL _hasScheduledVisibleRectUpdate;
     BOOL _visibleContentRectUpdateScheduledFromScrollViewInStableState;
     Vector<BlockPtr<void ()>> _visibleContentRectUpdateCallbacks;
 #endif
@@ -2301,16 +2301,19 @@
 {
     _visibleContentRectUpdateScheduledFromScrollViewInStableState = [self _scrollViewIsInStableState:scrollView];
 
-    if (_hasInstalledPreCommitHandlerForVisibleRectUpdate)
+    if (_hasScheduledVisibleRectUpdate)
         return;
 
-    _hasInstalledPreCommitHandlerForVisibleRectUpdate = YES;
-
-    [CATransaction addCommitHandler:[retainedSelf = retainPtr(self)] {
-        WKWebView *webView = retainedSelf.get();
-        [webView _updateVisibleContentRects];
-        webView->_hasInstalledPreCommitHandlerForVisibleRectUpdate = NO;
-    } forPhase:kCATransactionPhasePreCommit];
+    _hasScheduledVisibleRectUpdate = YES;
+    
+    // FIXME: remove the dispatch_async() when we have a fix for rdar://problem/31253952.
+    dispatch_async(dispatch_get_main_queue(), [retainedSelf = retainPtr(self)] {
+        [CATransaction addCommitHandler:[retainedSelf] {
+            WKWebView *webView = retainedSelf.get();
+            [webView _updateVisibleContentRects];
+            webView->_hasScheduledVisibleRectUpdate = NO;
+        } forPhase:kCATransactionPhasePreCommit];
+    });
 }
 
 static bool scrollViewCanScroll(UIScrollView *scrollView)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to