<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212459] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212459">212459</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2017-02-16 13:09:40 -0800 (Thu, 16 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>WKWebView inside a UICollectionView flashes when items are inserted above it
https://bugs.webkit.org/show_bug.cgi?id=168376
&lt;rdar://problem/29322051&gt;

Reviewed by Simon Fraser.

Previously, we would immediately send visible content rect updates
whenever we scrolled, or our frame or bounds changed, or ... a whole
bunch of other things. This message would be immediately sent to the
Web Content process, and coalesced at the whims of the Web Content process
main thread. However, if we received multiple such updates within the
same runloop cycle in the UI process, the Web Content process could
send back layer tree commits for intermediate states that would
never make it to the screen.

In the UICollectionView case, UIKit would first scroll to the new location
(potentially putting the WKWebView totally off-screen), and then update
our frame (back on screen), and we would get two layer tree commits;
one, with less tile coverage than needed to cover the area, and another
with full coverage.

Instead, wait until just before we commit the UI-side layer tree (and
thus everyone is done moving things around) to push the new visible 
rect info to the Web Content process.

So far, I have not found a way to test that reliably fails before
and reliably passes after without adding a ton of supporting code to WebKit.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didInvokeUIScrollViewDelegateCallback]):
(-[WKWebView _didCommitLayerTree:]):
(-[WKWebView _didFinishScrolling]):
(-[WKWebView scrollViewDidScroll:]):
(-[WKWebView scrollViewDidZoom:]):
(-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
(-[WKWebView _scrollViewDidInterruptDecelerating:]):
(-[WKWebView _didScroll]):
(-[WKWebView _enclosingScrollerScrollingEnded:]):
(-[WKWebView _frameOrBoundsChanged]):
(-[WKWebView _scheduleVisibleContentRectUpdate]):
(-[WKWebView _scrollViewIsInStableState:]):
(-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
(-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
(-[WKWebView _setObscuredInsets:]):
(-[WKWebView _endInteractiveObscuredInsetsChange]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
(-[WKWebView _endAnimatedResize]):
(-[WKWebView _updateVisibleContentRects]): Deleted.
(-[WKWebView _updateVisibleContentRectAfterScrollInView:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _didCommitLayerTree:]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
(-[WKContentView _stopAssistingNode]):
* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView setContentInset:]):
Have existing callers of _updateVisibleContentRect* instead call
_scheduleVisibleContentRectUpdate*.

In _scheduleVisibleContentRectUpdate, schedule a pre-commit callback
in which we will compute the new visible content rect information
and send it to the Web Content process.

Keep track of the stable state of the scroll view which most recently
scheduled an update, and use that to inform _updateVisibleContentRects.
This matches the previous behavior where the updates might get coalesced
in the Web Content process, and the most recent update wins.

Make a few callers of _updateVisibleContentRectAfterScrollInView
that passed in our scroll view just use _scheduleVisibleContentRectUpdate instead.

* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView _setStableStateOverride:]):
Update the one external caller of this internal method...

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::doAfterVisibleContentRectUpdate):
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::doAfterVisibleContentRectUpdate):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::doAfterVisibleContentRectUpdate):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::doAfterVisibleContentRectUpdate):
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::doAfterVisibleContentRectUpdate):
Expose doAfterVisibleContentRectUpdate to DRT and WKTR. It is called
back after we dispatch a visible content rect update from the UI process
to the Web Content process, so any messages sent from the block will arrive
after the visible content rect update.

* scrollingcoordinator/ios/sync-layer-positions-after-scroll.html:
* scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt:
Make use of doAfterVisibleContentRectUpdate; we previously were 
guaranteed by message ordering that our uiScriptComplete message
would arrive after the visible content rect update, but that is 
no longer the case.

Also, adjust to have a initial scale and flexible viewport in order
to work around https://bugs.webkit.org/show_bug.cgi?id=168403.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsscrollingcoordinatoriossynclayerpositionsafterscrollexpectedtxt">trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollingcoordinatoriossynclayerpositionsafterscrollhtml">trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll.html</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKScrollViewmm">trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeiosUIScriptControllerIOSmm">trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacUIScriptControllerMacmm">trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl">trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextUIScriptControllercpp">trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextUIScriptControllerh">trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewmm">trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacUIScriptControllerMacmm">trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/LayoutTests/ChangeLog        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2017-02-16  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        WKWebView inside a UICollectionView flashes when items are inserted above it
+        https://bugs.webkit.org/show_bug.cgi?id=168376
+        &lt;rdar://problem/29322051&gt;
+
+        Reviewed by Simon Fraser.
+
+        * scrollingcoordinator/ios/sync-layer-positions-after-scroll.html:
+        * scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt:
+        Make use of doAfterVisibleContentRectUpdate; we previously were 
+        guaranteed by message ordering that our uiScriptComplete message
+        would arrive after the visible content rect update, but that is 
+        no longer the case.
+
+        Also, adjust to have a initial scale and flexible viewport in order
+        to work around https://bugs.webkit.org/show_bug.cgi?id=168403.
+
</ins><span class="cx"> 2017-02-16  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove EFL test expectations.
</span></span></pre></div>
<a id="trunkLayoutTestsscrollingcoordinatoriossynclayerpositionsafterscrollexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-visibleRectAfterScroll: {&quot;left&quot;:0,&quot;top&quot;:190,&quot;width&quot;:800,&quot;height&quot;:600}
</del><ins>+visibleRectAfterScroll: {&quot;left&quot;:0,&quot;top&quot;:190,&quot;width&quot;:320,&quot;height&quot;:548}
</ins><span class="cx"> (GraphicsLayer
</span><span class="cx">   (anchor 0.00 0.00)
</span><span class="cx">   (bounds 1308.00 2021.00)
</span></span></pre></div>
<a id="trunkLayoutTestsscrollingcoordinatoriossynclayerpositionsafterscrollhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll.html (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll.html        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll.html        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -1,7 +1,8 @@
</span><del>-&lt;!DOCTYPE html&gt;
</del><ins>+&lt;!DOCTYPE html&gt; &lt;!-- webkit-test-runner [ useFlexibleViewport=true ] --&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;html&gt;
</span><span class="cx"> &lt;head&gt;
</span><ins>+    &lt;meta name=&quot;viewport&quot; content=&quot;initial-scale=1.0&quot;&gt;
</ins><span class="cx">     &lt;style&gt;
</span><span class="cx">         body {
</span><span class="cx">             width: 1300px;
</span><span class="lines">@@ -75,7 +76,9 @@
</span><span class="cx">                 };
</span><span class="cx"> 
</span><span class="cx">                 uiController.sendEventStream(JSON.stringify(movedFingerDownStream), function() {
</span><del>-                    uiController.uiScriptComplete(JSON.stringify(uiController.contentVisibleRect));
</del><ins>+                    uiController.doAfterVisibleContentRectUpdate(function () {
+                        uiController.uiScriptComplete(JSON.stringify(uiController.contentVisibleRect));
+                    });
</ins><span class="cx">                 });
</span><span class="cx">             })();`;
</span><span class="cx">         }
</span><span class="lines">@@ -102,7 +105,7 @@
</span><span class="cx">                 testRunner.runUIScript(getDragUIScript(xPos, startY, xPos, endY), function(visibleRectAfterScroll) {
</span><span class="cx">                     var result = 'visibleRectAfterScroll: ' + visibleRectAfterScroll + '\n' + internals.layerTreeAsText(document);
</span><span class="cx">                     document.getElementById('layers').textContent = result;
</span><del>-                    // Now send the finel touch up.
</del><ins>+                    // Now send the final touch up.
</ins><span class="cx">                     testRunner.runUIScript(getFingerUpUIScript(xPos, endY), function() {
</span><span class="cx">                         testRunner.notifyDone();
</span><span class="cx">                     });
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Source/WebKit2/ChangeLog        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2017-02-16  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        WKWebView inside a UICollectionView flashes when items are inserted above it
+        https://bugs.webkit.org/show_bug.cgi?id=168376
+        &lt;rdar://problem/29322051&gt;
+
+        Reviewed by Simon Fraser.
+
+        Previously, we would immediately send visible content rect updates
+        whenever we scrolled, or our frame or bounds changed, or ... a whole
+        bunch of other things. This message would be immediately sent to the
+        Web Content process, and coalesced at the whims of the Web Content process
+        main thread. However, if we received multiple such updates within the
+        same runloop cycle in the UI process, the Web Content process could
+        send back layer tree commits for intermediate states that would
+        never make it to the screen.
+
+        In the UICollectionView case, UIKit would first scroll to the new location
+        (potentially putting the WKWebView totally off-screen), and then update
+        our frame (back on screen), and we would get two layer tree commits;
+        one, with less tile coverage than needed to cover the area, and another
+        with full coverage.
+
+        Instead, wait until just before we commit the UI-side layer tree (and
+        thus everyone is done moving things around) to push the new visible 
+        rect info to the Web Content process.
+
+        So far, I have not found a way to test that reliably fails before
+        and reliably passes after without adding a ton of supporting code to WebKit.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _didInvokeUIScrollViewDelegateCallback]):
+        (-[WKWebView _didCommitLayerTree:]):
+        (-[WKWebView _didFinishScrolling]):
+        (-[WKWebView scrollViewDidScroll:]):
+        (-[WKWebView scrollViewDidZoom:]):
+        (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
+        (-[WKWebView _scrollViewDidInterruptDecelerating:]):
+        (-[WKWebView _didScroll]):
+        (-[WKWebView _enclosingScrollerScrollingEnded:]):
+        (-[WKWebView _frameOrBoundsChanged]):
+        (-[WKWebView _scheduleVisibleContentRectUpdate]):
+        (-[WKWebView _scrollViewIsInStableState:]):
+        (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
+        (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
+        (-[WKWebView _setObscuredInsets:]):
+        (-[WKWebView _endInteractiveObscuredInsetsChange]):
+        (-[WKWebView _beginAnimatedResizeWithUpdates:]):
+        (-[WKWebView _endAnimatedResize]):
+        (-[WKWebView _updateVisibleContentRects]): Deleted.
+        (-[WKWebView _updateVisibleContentRectAfterScrollInView:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _didCommitLayerTree:]):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
+        (-[WKContentView _stopAssistingNode]):
+        * UIProcess/ios/WKScrollView.mm:
+        (-[WKScrollView setContentInset:]):
+        Have existing callers of _updateVisibleContentRect* instead call
+        _scheduleVisibleContentRectUpdate*.
+
+        In _scheduleVisibleContentRectUpdate, schedule a pre-commit callback
+        in which we will compute the new visible content rect information
+        and send it to the Web Content process.
+
+        Keep track of the stable state of the scroll view which most recently
+        scheduled an update, and use that to inform _updateVisibleContentRects.
+        This matches the previous behavior where the updates might get coalesced
+        in the Web Content process, and the most recent update wins.
+
+        Make a few callers of _updateVisibleContentRectAfterScrollInView
+        that passed in our scroll view just use _scheduleVisibleContentRectUpdate instead.
+
</ins><span class="cx"> 2017-02-16  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WebRTC][Mac] Conditionally add sandbox extensions to the Network Process
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -286,6 +286,10 @@
</span><span class="cx">     RetainPtr&lt;NSMutableArray&gt; _stableStatePresentationUpdateCallbacks;
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;WKPasswordView&gt; _passwordView;
</span><ins>+
+    BOOL _hasInstalledPreCommitHandlerForVisibleRectUpdate;
+    BOOL _visibleContentRectUpdateScheduledFromScrollViewInStableState;
+    Vector&lt;BlockPtr&lt;void ()&gt;&gt; _visibleContentRectUpdateCallbacks;
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     std::unique_ptr&lt;WebKit::WebViewImpl&gt; _impl;
</span><span class="lines">@@ -1194,7 +1198,7 @@
</span><span class="cx">     _delayUpdateVisibleContentRects = NO;
</span><span class="cx">     if (_hadDelayedUpdateVisibleContentRects) {
</span><span class="cx">         _hadDelayedUpdateVisibleContentRects = NO;
</span><del>-        [self _updateVisibleContentRectAfterScrollInView:_scrollView.get()];
</del><ins>+        [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1464,7 +1468,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (needUpdateVisbleContentRects)
</span><del>-        [self _updateVisibleContentRects];
</del><ins>+        [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> 
</span><span class="cx">     if (WebKit::RemoteLayerTreeScrollingPerformanceData* scrollPerfData = _page-&gt;scrollingPerformanceData())
</span><span class="cx">         scrollPerfData-&gt;didCommitLayerTree([self visibleRectInViewCoordinates]);
</span><span class="lines">@@ -1992,7 +1996,7 @@
</span><span class="cx">     if (![self usesStandardContentView])
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    [self _updateVisibleContentRectAfterScrollInView:_scrollView.get()];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx">     [_contentView didFinishScrolling];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2046,7 +2050,7 @@
</span><span class="cx">     if (![self usesStandardContentView])
</span><span class="cx">         [_customContentView scrollViewDidScroll:(UIScrollView *)scrollView];
</span><span class="cx"> 
</span><del>-    [self _updateVisibleContentRectAfterScrollInView:scrollView];
</del><ins>+    [self _scheduleVisibleContentRectUpdateAfterScrollInView:scrollView];
</ins><span class="cx">     
</span><span class="cx">     if (WebKit::RemoteLayerTreeScrollingPerformanceData* scrollPerfData = _page-&gt;scrollingPerformanceData())
</span><span class="cx">         scrollPerfData-&gt;didScroll([self visibleRectInViewCoordinates]);
</span><span class="lines">@@ -2055,13 +2059,13 @@
</span><span class="cx"> - (void)scrollViewDidZoom:(UIScrollView *)scrollView
</span><span class="cx"> {
</span><span class="cx">     [self _updateScrollViewBackground];
</span><del>-    [self _updateVisibleContentRectAfterScrollInView:scrollView];
</del><ins>+    [self _scheduleVisibleContentRectUpdateAfterScrollInView:scrollView];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
</span><span class="cx"> {
</span><span class="cx">     ASSERT(scrollView == _scrollView);
</span><del>-    [self _updateVisibleContentRectAfterScrollInView:scrollView];
</del><ins>+    [self _scheduleVisibleContentRectUpdateAfterScrollInView:scrollView];
</ins><span class="cx">     [_contentView didZoomToScale:scale];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2076,7 +2080,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     [_contentView didInterruptScrolling];
</span><del>-    [self _updateVisibleContentRectAfterScrollInView:scrollView];
</del><ins>+    [self _scheduleVisibleContentRectUpdateAfterScrollInView:scrollView];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (CGRect)_visibleRectInEnclosingScrollView:(UIScrollView *)enclosingScrollView
</span><span class="lines">@@ -2107,7 +2111,7 @@
</span><span class="cx"> // Called when some ancestor UIScrollView scrolls.
</span><span class="cx"> - (void)_didScroll
</span><span class="cx"> {
</span><del>-    [self _updateVisibleContentRectAfterScrollInView:[self _scroller]];
</del><ins>+    [self _scheduleVisibleContentRectUpdateAfterScrollInView:[self _scroller]];
</ins><span class="cx"> 
</span><span class="cx">     const NSTimeInterval ScrollingEndedTimerInterval = 0.032;
</span><span class="cx">     if (!_enclosingScrollViewScrollTimer) {
</span><span class="lines">@@ -2125,7 +2129,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    [self _updateVisibleContentRects];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx">     [_enclosingScrollViewScrollTimer invalidate];
</span><span class="cx">     _enclosingScrollViewScrollTimer = nil;
</span><span class="cx"> }
</span><span class="lines">@@ -2150,7 +2154,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     [_customContentView web_setMinimumSize:bounds.size];
</span><del>-    [self _updateVisibleContentRects];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Unobscured content rect where the user can interact. When the keyboard is up, this should be the area above or below the keyboard, wherever there is enough space.
</span><span class="lines">@@ -2173,23 +2177,22 @@
</span><span class="cx">     return !pointsEqualInDevicePixels(contentOffset, boundedOffset, deviceScaleFactor);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_updateVisibleContentRects
</del><ins>+- (void)_scheduleVisibleContentRectUpdate
</ins><span class="cx"> {
</span><del>-    // For visible rect updates not associated with a spefic UIScrollView, just consider our own scroller.
-    [self _updateVisibleContentRectAfterScrollInView:_scrollView.get()];
</del><ins>+    // For visible rect updates not associated with a specific UIScrollView, just consider our own scroller.
+    [self _scheduleVisibleContentRectUpdateAfterScrollInView:_scrollView.get()];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_updateVisibleContentRectAfterScrollInView:(UIScrollView *)scrollView
</del><ins>+- (BOOL)_scrollViewIsInStableState:(UIScrollView *)scrollView
</ins><span class="cx"> {
</span><span class="cx">     BOOL isStableState = !([scrollView isDragging] || [scrollView isDecelerating] || [scrollView isZooming] || [scrollView _isAnimatingZoom] || [scrollView _isScrollingToTop]);
</span><span class="cx"> 
</span><span class="cx">     if (isStableState &amp;&amp; scrollView == _scrollView.get())
</span><span class="cx">         isStableState = !_isChangingObscuredInsetsInteractively;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (isStableState &amp;&amp; scrollView == _scrollView.get())
</span><span class="cx">         isStableState = ![self _scrollViewIsRubberBanding];
</span><span class="cx"> 
</span><del>-    // FIXME: this can be made static after we stop supporting iOS 8.x.
</del><span class="cx">     if (isStableState)
</span><span class="cx">         isStableState = !scrollView._isInterruptingDeceleration;
</span><span class="cx"> 
</span><span class="lines">@@ -2196,9 +2199,25 @@
</span><span class="cx">     if (NSNumber *stableOverride = self._stableStateOverride)
</span><span class="cx">         isStableState = stableOverride.boolValue;
</span><span class="cx"> 
</span><del>-    [self _updateContentRectsWithState:isStableState];
</del><ins>+    return isStableState;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_scheduleVisibleContentRectUpdateAfterScrollInView:(UIScrollView *)scrollView
+{
+    _visibleContentRectUpdateScheduledFromScrollViewInStableState = [self _scrollViewIsInStableState:scrollView];
+
+    if (_hasInstalledPreCommitHandlerForVisibleRectUpdate)
+        return;
+
+    _hasInstalledPreCommitHandlerForVisibleRectUpdate = YES;
+
+    [CATransaction addCommitHandler:[retainedSelf = retainPtr(self)] {
+        WKWebView *webView = retainedSelf.get();
+        [webView _updateVisibleContentRects];
+        webView-&gt;_hasInstalledPreCommitHandlerForVisibleRectUpdate = NO;
+    } forPhase:kCATransactionPhasePreCommit];
+}
+
</ins><span class="cx"> static bool scrollViewCanScroll(UIScrollView *scrollView)
</span><span class="cx"> {
</span><span class="cx">     if (!scrollView)
</span><span class="lines">@@ -2237,8 +2256,10 @@
</span><span class="cx">     return extendedBounds;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_updateContentRectsWithState:(BOOL)inStableState
</del><ins>+- (void)_updateVisibleContentRects
</ins><span class="cx"> {
</span><ins>+    BOOL inStableState = _visibleContentRectUpdateScheduledFromScrollViewInStableState;
+
</ins><span class="cx">     if (![self usesStandardContentView]) {
</span><span class="cx">         [_passwordView setFrame:self.bounds];
</span><span class="cx">         [_customContentView web_computedContentInsetDidChange];
</span><span class="lines">@@ -2297,6 +2318,11 @@
</span><span class="cx">         inStableState:inStableState
</span><span class="cx">         isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively
</span><span class="cx">         enclosedInScrollableAncestorView:scrollViewCanScroll([self _scroller])];
</span><ins>+
+    while (!_visibleContentRectUpdateCallbacks.isEmpty()) {
+        auto callback = _visibleContentRectUpdateCallbacks.takeLast();
+        callback();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_didFinishLoadForMainFrame
</span><span class="lines">@@ -2342,7 +2368,7 @@
</span><span class="cx">             _totalScrollViewBottomInsetAdjustmentForKeyboard += bottomInsetAfterAdjustment - bottomInsetBeforeAdjustment;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    [self _updateVisibleContentRects];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)_shouldUpdateKeyboardWithInfo:(NSDictionary *)keyboardInfo
</span><span class="lines">@@ -4299,7 +4325,7 @@
</span><span class="cx"> 
</span><span class="cx">     _obscuredInsets = obscuredInsets;
</span><span class="cx"> 
</span><del>-    [self _updateVisibleContentRects];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_setInterfaceOrientationOverride:(UIInterfaceOrientation)interfaceOrientation
</span><span class="lines">@@ -4372,7 +4398,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(_isChangingObscuredInsetsInteractively);
</span><span class="cx">     _isChangingObscuredInsetsInteractively = NO;
</span><del>-    [self _updateVisibleContentRects];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_hideContentUntilNextUpdate
</span><span class="lines">@@ -4418,7 +4444,7 @@
</span><span class="cx">             _page-&gt;setMaximumUnobscuredSize(WebCore::FloatSize(newMaximumUnobscuredSize));
</span><span class="cx">         if (_overridesInterfaceOrientation)
</span><span class="cx">             _page-&gt;setDeviceOrientation(newOrientation);
</span><del>-        [self _updateVisibleContentRects];
</del><ins>+        [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -4428,7 +4454,7 @@
</span><span class="cx">         &amp;&amp; oldOrientation == newOrientation
</span><span class="cx">         &amp;&amp; UIEdgeInsetsEqualToEdgeInsets(oldObscuredInsets, newObscuredInsets)) {
</span><span class="cx">         _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing;
</span><del>-        [self _updateVisibleContentRects];
</del><ins>+        [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -4546,7 +4572,7 @@
</span><span class="cx"> 
</span><span class="cx">     _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing;
</span><span class="cx">     [_contentView setHidden:NO];
</span><del>-    [self _updateVisibleContentRects];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> 
</span><span class="cx">     while (!_snapshotsDeferredDuringResize.isEmpty())
</span><span class="cx">         _snapshotsDeferredDuringResize.takeLast()();
</span><span class="lines">@@ -5130,6 +5156,16 @@
</span><span class="cx">     [self _doAfterNextPresentationUpdate:updateBlock];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_doAfterNextVisibleContentRectUpdate:(void (^)(void))updateBlock
+{
+#if PLATFORM(IOS)
+    _visibleContentRectUpdateCallbacks.append(makeBlockPtr(updateBlock));
+    [self _scheduleVisibleContentRectUpdate];
+#else
+    dispatch_async(dispatch_get_main_queue(), updateBlock);
+#endif
+}
+
</ins><span class="cx"> - (void)_disableBackForwardSnapshotVolatilityForTesting
</span><span class="cx"> {
</span><span class="cx">     WebKit::ViewSnapshotStore::singleton().setDisableSnapshotVolatilityForTesting(true);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -100,9 +100,7 @@
</span><span class="cx"> - (void)_willInvokeUIScrollViewDelegateCallback;
</span><span class="cx"> - (void)_didInvokeUIScrollViewDelegateCallback;
</span><span class="cx"> 
</span><del>-- (void)_updateVisibleContentRects;
-- (void)_updateVisibleContentRectAfterScrollInView:(UIScrollView *)scrollView;
-- (void)_updateContentRectsWithState:(BOOL)inStableState;
</del><ins>+- (void)_scheduleVisibleContentRectUpdate;
</ins><span class="cx"> 
</span><span class="cx"> - (void)_didFinishLoadForMainFrame;
</span><span class="cx"> - (void)_didFailLoadForMainFrame;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -341,6 +341,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(10.12), ios(10.0));
</span><span class="cx"> - (void)_doAfterNextPresentationUpdateWithoutWaitingForPainting:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><ins>+- (void)_doAfterNextVisibleContentRectUpdate:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</ins><span class="cx"> 
</span><span class="cx"> - (void)_disableBackForwardSnapshotVolatilityForTesting WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -573,7 +573,7 @@
</span><span class="cx">         [self updateFixedClippingView:fixedPositionRect];
</span><span class="cx"> 
</span><span class="cx">         // We need to push the new content bounds to the webview to update fixed position rects.
</span><del>-        [_webView _updateVisibleContentRects];
</del><ins>+        [_webView _scheduleVisibleContentRectUpdate];
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     // Updating the selection requires a full editor state. If the editor state is missing post layout
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -3814,7 +3814,7 @@
</span><span class="cx">     
</span><span class="cx">     // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects.
</span><span class="cx">     if (editableChanged)
</span><del>-        [_webView _updateVisibleContentRects];
</del><ins>+        [_webView _scheduleVisibleContentRectUpdate];
</ins><span class="cx">     
</span><span class="cx">     [self _displayFormNodeInputView];
</span><span class="cx"> 
</span><span class="lines">@@ -3848,7 +3848,7 @@
</span><span class="cx"> 
</span><span class="cx">     // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects.
</span><span class="cx">     if (editableChanged)
</span><del>-        [_webView _updateVisibleContentRects];
</del><ins>+        [_webView _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> 
</span><span class="cx">     [_webView didEndFormControlInteraction];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKScrollViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -224,7 +224,7 @@
</span><span class="cx"> {
</span><span class="cx">     [super setContentInset:contentInset];
</span><span class="cx"> 
</span><del>-    [_internalDelegate _updateVisibleContentRects];
</del><ins>+    [_internalDelegate _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Fetch top/left rubberband amounts (as negative values).
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/ChangeLog        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2017-02-16  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        WKWebView inside a UICollectionView flashes when items are inserted above it
+        https://bugs.webkit.org/show_bug.cgi?id=168376
+        &lt;rdar://problem/29322051&gt;
+
+        Reviewed by Simon Fraser.
+
+        * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+        (-[TestRunnerWKWebView _setStableStateOverride:]):
+        Update the one external caller of this internal method...
+
+        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::doAfterVisibleContentRectUpdate):
+        * DumpRenderTree/mac/UIScriptControllerMac.mm:
+        (WTR::UIScriptController::doAfterVisibleContentRectUpdate):
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::doAfterVisibleContentRectUpdate):
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::doAfterVisibleContentRectUpdate):
+        * WebKitTestRunner/mac/UIScriptControllerMac.mm:
+        (WTR::UIScriptController::doAfterVisibleContentRectUpdate):
+        Expose doAfterVisibleContentRectUpdate to DRT and WKTR. It is called
+        back after we dispatch a visible content rect update from the UI process
+        to the Web Content process, so any messages sent from the block will arrive
+        after the visible content rect update.
+
</ins><span class="cx"> 2017-02-16  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Add two new buildbots that build-only test on Debian stable and Ubuntu LTS.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeiosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -63,6 +63,11 @@
</span><span class="cx">     doAsyncTask(callback);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::doAfterVisibleContentRectUpdate(JSValueRef callback)
+{
+    doAsyncTask(callback);
+}
+
</ins><span class="cx"> void UIScriptController::zoomToScale(double scale, JSValueRef callback)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;UIScriptController&gt; protectedThis(this);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacUIScriptControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -59,6 +59,11 @@
</span><span class="cx">     doAsyncTask(callback);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::doAfterVisibleContentRectUpdate(JSValueRef callback)
+{
+    doAsyncTask(callback);
+}
+
</ins><span class="cx"> void UIScriptController::insertText(JSStringRef, int, int)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx">     void doAfterPresentationUpdate(object callback); // Call the callback after sending a message to the WebProcess and receiving a subsequent update.
</span><span class="cx">     void doAfterNextStablePresentationUpdate(object callback);
</span><span class="cx"> 
</span><ins>+    void doAfterVisibleContentRectUpdate(object callback);
+
</ins><span class="cx">     void simulateAccessibilitySettingsChangeNotification(object callback);
</span><span class="cx"> 
</span><span class="cx">     // Interaction.
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextUIScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -74,6 +74,10 @@
</span><span class="cx"> void UIScriptController::doAfterNextStablePresentationUpdate(JSValueRef)
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+
+void UIScriptController::doAfterVisibleContentRectUpdate(JSValueRef)
+{
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void UIScriptController::setDidStartFormControlInteractionCallback(JSValueRef callback)
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextUIScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx">     void doAsyncTask(JSValueRef callback);
</span><span class="cx">     void doAfterPresentationUpdate(JSValueRef callback);
</span><span class="cx">     void doAfterNextStablePresentationUpdate(JSValueRef callback);
</span><ins>+    void doAfterVisibleContentRectUpdate(JSValueRef callback);
</ins><span class="cx"> 
</span><span class="cx">     void zoomToScale(double scale, JSValueRef callback);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view;
</span><span class="cx"> - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale;
</span><span class="cx"> - (void)_didFinishScrolling;
</span><del>-- (void)_updateVisibleContentRects;
</del><ins>+- (void)_scheduleVisibleContentRectUpdate;
</ins><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> #endif
</span><span class="lines">@@ -187,7 +187,7 @@
</span><span class="cx"> - (void)_setStableStateOverride:(NSNumber *)overrideBoolean
</span><span class="cx"> {
</span><span class="cx">     m_stableStateOverride = overrideBoolean;
</span><del>-    [self _updateVisibleContentRects];
</del><ins>+    [self _scheduleVisibleContentRectUpdate];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_accessibilityDidGetSpeakSelectionContent:(NSString *)content
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -94,6 +94,18 @@
</span><span class="cx">     }];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::doAfterVisibleContentRectUpdate(JSValueRef callback)
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
+
+    unsigned callbackID = m_context-&gt;prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+    [webView _doAfterNextVisibleContentRectUpdate:^ {
+        if (!m_context)
+            return;
+        m_context-&gt;asyncTaskComplete(callbackID);
+    }];
+}
+
</ins><span class="cx"> void UIScriptController::zoomToScale(double scale, JSValueRef callback)
</span><span class="cx"> {
</span><span class="cx">     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacUIScriptControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm (212458 => 212459)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm        2017-02-16 21:04:25 UTC (rev 212458)
+++ trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm        2017-02-16 21:09:40 UTC (rev 212459)
</span><span class="lines">@@ -66,6 +66,11 @@
</span><span class="cx">     doAsyncTask(callback);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::doAfterVisibleContentRectUpdate(JSValueRef callback)
+{
+    doAsyncTask(callback);
+}
+
</ins><span class="cx"> void UIScriptController::insertText(JSStringRef text, int location, int length)
</span><span class="cx"> {
</span><span class="cx"> #if WK_API_ENABLED
</span></span></pre>
</div>
</div>

</body>
</html>