<!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>[182150] trunk/Source/WebKit2</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/182150">182150</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-03-30 12:02:15 -0700 (Mon, 30 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Swipe snapshot removed too early (jumps around) on arstechnica and NYT
https://bugs.webkit.org/show_bug.cgi?id=143199
<rdar://problem/18420467>
Reviewed by Dan Bernstein.
Make ViewGestureControllerIOS's snapshot removal timing behave more like the Mac version.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:]):
Let ViewGestureController know when the page has finished state restoration.
(-[WKWebView _didFinishLoadForMainFrame]):
(-[WKWebView _didSameDocumentNavigationForMainFrame:]):
Forward these to ViewGestureController.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didFinishLoadForMainFrame):
Forward didFinishLoadForMainFrame to WKWebView.
* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::ViewGestureController):
(WebKit::ViewGestureController::endSwipeGesture):
Split the swipe snapshot removal state into a bunch of bools.
(WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree):
(WebKit::ViewGestureController::setRenderTreeSize):
(WebKit::ViewGestureController::removeSwipeSnapshotIfReady):
(WebKit::ViewGestureController::removeSwipeSnapshot):
Unify the snapshot removal logic into one function; removeSwipeSnapshotIfReady
completely owns the decision. For now, we're waiting for everything, but
we can do better in the future (using firstVisuallyNonEmptyLayout like Mac used to).
(WebKit::ViewGestureController::didRestoreScrollPosition):
(WebKit::ViewGestureController::didFinishLoadForMainFrame):
(WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
(WebKit::ViewGestureController::activeLoadMonitoringTimerFired):
Add more conditions for swipe snapshot removal. We'll now wait for
didFinishLoadForMainFrame (or didSameDocumentNavigationForMainFrame),
for active loads to finish, and for the scroll position to be restored.
This brings the iOS implementation in line with the slightly better Mac
implementation, and also sets the stage for deduplication of all of this code.
* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::ViewGestureController):</pre>
<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm">trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerh">trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm">trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (182149 => 182150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-03-30 18:58:23 UTC (rev 182149)
+++ trunk/Source/WebKit2/ChangeLog        2015-03-30 19:02:15 UTC (rev 182150)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2015-03-30 Tim Horton <timothy_horton@apple.com>
+
+ Swipe snapshot removed too early (jumps around) on arstechnica and NYT
+ https://bugs.webkit.org/show_bug.cgi?id=143199
+ <rdar://problem/18420467>
+
+ Reviewed by Dan Bernstein.
+
+ Make ViewGestureControllerIOS's snapshot removal timing behave more like the Mac version.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _didCommitLayerTree:]):
+ Let ViewGestureController know when the page has finished state restoration.
+
+ (-[WKWebView _didFinishLoadForMainFrame]):
+ (-[WKWebView _didSameDocumentNavigationForMainFrame:]):
+ Forward these to ViewGestureController.
+
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::didFinishLoadForMainFrame):
+ Forward didFinishLoadForMainFrame to WKWebView.
+
+ * UIProcess/ios/ViewGestureControllerIOS.mm:
+ (WebKit::ViewGestureController::ViewGestureController):
+ (WebKit::ViewGestureController::endSwipeGesture):
+ Split the swipe snapshot removal state into a bunch of bools.
+
+ (WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree):
+ (WebKit::ViewGestureController::setRenderTreeSize):
+ (WebKit::ViewGestureController::removeSwipeSnapshotIfReady):
+ (WebKit::ViewGestureController::removeSwipeSnapshot):
+ Unify the snapshot removal logic into one function; removeSwipeSnapshotIfReady
+ completely owns the decision. For now, we're waiting for everything, but
+ we can do better in the future (using firstVisuallyNonEmptyLayout like Mac used to).
+
+ (WebKit::ViewGestureController::didRestoreScrollPosition):
+ (WebKit::ViewGestureController::didFinishLoadForMainFrame):
+ (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
+ (WebKit::ViewGestureController::activeLoadMonitoringTimerFired):
+ Add more conditions for swipe snapshot removal. We'll now wait for
+ didFinishLoadForMainFrame (or didSameDocumentNavigationForMainFrame),
+ for active loads to finish, and for the scroll position to be restored.
+ This brings the iOS implementation in line with the slightly better Mac
+ implementation, and also sets the stage for deduplication of all of this code.
+
+ * UIProcess/mac/ViewGestureController.h:
+ * UIProcess/mac/ViewGestureControllerMac.mm:
+ (WebKit::ViewGestureController::ViewGestureController):
+
</ins><span class="cx"> 2015-03-30 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [WK2][NetworkCache] Add support for "Cache-Control: max-stale" request header
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (182149 => 182150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-03-30 18:58:23 UTC (rev 182149)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-03-30 19:02:15 UTC (rev 182150)
</span><span class="lines">@@ -907,7 +907,9 @@
</span><span class="cx"> [self _updateVisibleContentRects];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (_needsToRestoreExposedRect && layerTreeTransaction.transactionID() >= _firstTransactionIDAfterPageRestore) {
</del><ins>+ bool isTransactionAfterPageRestore = layerTreeTransaction.transactionID() >= _firstTransactionIDAfterPageRestore;
+
+ if (_needsToRestoreExposedRect && isTransactionAfterPageRestore) {
</ins><span class="cx"> _needsToRestoreExposedRect = NO;
</span><span class="cx">
</span><span class="cx"> if (areEssentiallyEqualAsFloat(contentZoomScale(self), _scaleToRestore)) {
</span><span class="lines">@@ -915,11 +917,12 @@
</span><span class="cx"> exposedPosition.scale(_scaleToRestore, _scaleToRestore);
</span><span class="cx">
</span><span class="cx"> changeContentOffsetBoundedInValidRange(_scrollView.get(), exposedPosition);
</span><ins>+ _gestureController->didRestoreScrollPosition();
</ins><span class="cx"> }
</span><span class="cx"> [self _updateVisibleContentRects];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (_needsToRestoreUnobscuredCenter && layerTreeTransaction.transactionID() >= _firstTransactionIDAfterPageRestore) {
</del><ins>+ if (_needsToRestoreUnobscuredCenter && isTransactionAfterPageRestore) {
</ins><span class="cx"> _needsToRestoreUnobscuredCenter = NO;
</span><span class="cx">
</span><span class="cx"> if (areEssentiallyEqualAsFloat(contentZoomScale(self), _scaleToRestore)) {
</span><span class="lines">@@ -931,6 +934,7 @@
</span><span class="cx"> topLeftInDocumentCoordinate.moveBy(WebCore::FloatPoint(-_obscuredInsets.left, -_obscuredInsets.top));
</span><span class="cx">
</span><span class="cx"> changeContentOffsetBoundedInValidRange(_scrollView.get(), topLeftInDocumentCoordinate);
</span><ins>+ _gestureController->didRestoreScrollPosition();
</ins><span class="cx"> }
</span><span class="cx"> [self _updateVisibleContentRects];
</span><span class="cx"> }
</span><span class="lines">@@ -1496,9 +1500,18 @@
</span><span class="cx"> inStableState:isStableState isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)_didFinishLoadForMainFrame
+{
+ if (_gestureController)
+ _gestureController->didFinishLoadForMainFrame();
+}
+
</ins><span class="cx"> - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType
</span><span class="cx"> {
</span><span class="cx"> [_customContentView web_didSameDocumentNavigation:toAPI(navigationType)];
</span><ins>+
+ if (_gestureController)
+ _gestureController->didSameDocumentNavigationForMainFrame(navigationType);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (182149 => 182150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2015-03-30 18:58:23 UTC (rev 182149)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2015-03-30 19:02:15 UTC (rev 182150)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)_updateVisibleContentRects;
</span><span class="cx">
</span><ins>+- (void)_didFinishLoadForMainFrame;
</ins><span class="cx"> - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType;
</span><span class="cx">
</span><span class="cx"> - (BOOL)_isShowingVideoOptimized;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (182149 => 182150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2015-03-30 18:58:23 UTC (rev 182149)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2015-03-30 19:02:15 UTC (rev 182150)
</span><span class="lines">@@ -705,6 +705,7 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::didFinishLoadForMainFrame()
</span><span class="cx"> {
</span><ins>+ [m_webView _didFinishLoadForMainFrame];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType navigationType)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (182149 => 182150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2015-03-30 18:58:23 UTC (rev 182149)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2015-03-30 19:02:15 UTC (rev 182150)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx">
</span><span class="cx"> static const float swipeSnapshotRemovalRenderTreeSizeTargetFraction = 0.5;
</span><span class="cx"> static const std::chrono::seconds swipeSnapshotRemovalWatchdogDuration = 3_s;
</span><ins>+static const std::chrono::milliseconds swipeSnapshotRemovalActiveLoadMonitoringInterval = 250_ms;
</ins><span class="cx">
</span><span class="cx"> // The key in this map is the associated page ID.
</span><span class="cx"> static HashMap<uint64_t, WebKit::ViewGestureController*>& viewGestureControllersForAllPages()
</span><span class="lines">@@ -138,11 +139,8 @@
</span><span class="cx">
</span><span class="cx"> ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
</span><span class="cx"> : m_webPageProxy(webPageProxy)
</span><del>- , m_activeGestureType(ViewGestureType::None)
</del><span class="cx"> , m_swipeWatchdogTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
</span><del>- , m_snapshotRemovalTargetRenderTreeSize(0)
- , m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit(false)
- , m_gesturePendingSnapshotRemoval(0)
</del><ins>+ , m_swipeActiveLoadMonitoringTimer(RunLoop::main(), this, &ViewGestureController::activeLoadMonitoringTimerFired)
</ins><span class="cx"> {
</span><span class="cx"> viewGestureControllersForAllPages().add(webPageProxy.pageID(), this);
</span><span class="cx"> }
</span><span class="lines">@@ -301,6 +299,12 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ m_swipeWaitingForRenderTreeSizeThreshold = true;
+ m_swipeWaitingForRepaint = true;
+ m_swipeWaitingForDidFinishLoad = true;
+ m_swipeWaitingForSubresourceLoads = true;
+ m_swipeWaitingForScrollPositionRestoration = true;
+
</ins><span class="cx"> m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -314,7 +318,11 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit = true;
</del><ins>+ if (!m_swipeWaitingForRepaint)
+ return;
+
+ m_swipeWaitingForRepaint = false;
+ removeSwipeSnapshotIfReady();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ViewGestureController::setRenderTreeSize(uint64_t renderTreeSize)
</span><span class="lines">@@ -322,23 +330,92 @@
</span><span class="cx"> if (m_activeGestureType != ViewGestureType::Swipe)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (!m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit)
</del><ins>+ if (!m_swipeWaitingForRenderTreeSizeThreshold)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- if (!m_snapshotRemovalTargetRenderTreeSize || renderTreeSize > m_snapshotRemovalTargetRenderTreeSize)
- removeSwipeSnapshot();
</del><ins>+ if (!m_snapshotRemovalTargetRenderTreeSize || renderTreeSize > m_snapshotRemovalTargetRenderTreeSize) {
+ m_swipeWaitingForRenderTreeSizeThreshold = false;
+ removeSwipeSnapshotIfReady();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void ViewGestureController::didRestoreScrollPosition()
+{
+ if (m_activeGestureType != ViewGestureType::Swipe)
+ return;
+
+ if (!m_swipeWaitingForScrollPositionRestoration)
+ return;
+
+ m_swipeWaitingForScrollPositionRestoration = false;
+ removeSwipeSnapshotIfReady();
+}
+
+void ViewGestureController::didFinishLoadForMainFrame()
+{
+ if (m_activeGestureType != ViewGestureType::Swipe)
+ return;
+
+ if (!m_swipeWaitingForDidFinishLoad)
+ return;
+
+ m_swipeWaitingForDidFinishLoad = false;
+
+ if (m_webPageProxy.pageLoadState().isLoading()) {
+ m_swipeActiveLoadMonitoringTimer.startRepeating(swipeSnapshotRemovalActiveLoadMonitoringInterval);
+ return;
+ }
+
+ m_swipeWaitingForSubresourceLoads = false;
+ removeSwipeSnapshotIfReady();
+}
+
+void ViewGestureController::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType type)
+{
+ if (m_activeGestureType != ViewGestureType::Swipe)
+ return;
+
+ // This is nearly equivalent to didFinishLoad in the same document navigation case.
+ m_swipeWaitingForDidFinishLoad = false;
+
+ if (type != SameDocumentNavigationSessionStateReplace && type != SameDocumentNavigationSessionStatePop)
+ return;
+
+ m_swipeActiveLoadMonitoringTimer.startRepeating(swipeSnapshotRemovalActiveLoadMonitoringInterval);
+}
+
+void ViewGestureController::activeLoadMonitoringTimerFired()
+{
+ if (m_webPageProxy.pageLoadState().isLoading())
+ return;
+
+ m_swipeWaitingForSubresourceLoads = false;
+ removeSwipeSnapshotIfReady();
+}
+
</ins><span class="cx"> void ViewGestureController::swipeSnapshotWatchdogTimerFired()
</span><span class="cx"> {
</span><span class="cx"> removeSwipeSnapshot();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ViewGestureController::removeSwipeSnapshotIfReady()
+{
+ if (m_swipeWaitingForRenderTreeSizeThreshold || m_swipeWaitingForRepaint || m_swipeWaitingForDidFinishLoad || m_swipeWaitingForSubresourceLoads || m_swipeWaitingForScrollPositionRestoration)
+ return;
+
+ removeSwipeSnapshot();
+}
+
</ins><span class="cx"> void ViewGestureController::removeSwipeSnapshot()
</span><span class="cx"> {
</span><del>- m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit = false;
</del><ins>+ m_swipeWaitingForRenderTreeSizeThreshold = false;
+ m_swipeWaitingForRepaint = false;
+ m_swipeWaitingForDidFinishLoad = false;
+ m_swipeWaitingForSubresourceLoads = false;
+ m_swipeWaitingForScrollPositionRestoration = false;
</ins><span class="cx">
</span><span class="cx"> m_swipeWatchdogTimer.stop();
</span><ins>+ m_swipeActiveLoadMonitoringTimer.stop();
</ins><span class="cx">
</span><span class="cx"> if (m_activeGestureType != ViewGestureType::Swipe)
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (182149 => 182150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2015-03-30 18:58:23 UTC (rev 182149)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2015-03-30 19:02:15 UTC (rev 182150)
</span><span class="lines">@@ -109,8 +109,6 @@
</span><span class="cx"> void setShouldIgnorePinnedState(bool ignore) { m_shouldIgnorePinnedState = ignore; }
</span><span class="cx">
</span><span class="cx"> void didFirstVisuallyNonEmptyLayoutForMainFrame();
</span><del>- void didFinishLoadForMainFrame();
- void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType);
</del><span class="cx"> #else
</span><span class="cx"> void installSwipeHandler(UIView *gestureRecognizerView, UIView *swipingView);
</span><span class="cx"> void setAlternateBackForwardListSourceView(WKWebView *);
</span><span class="lines">@@ -119,15 +117,19 @@
</span><span class="cx"> void endSwipeGesture(WebBackForwardListItem* targetItem, _UIViewControllerTransitionContext *, bool cancelled);
</span><span class="cx"> void willCommitPostSwipeTransitionLayerTree(bool);
</span><span class="cx"> void setRenderTreeSize(uint64_t);
</span><ins>+ void didRestoreScrollPosition();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ void didFinishLoadForMainFrame();
</ins><span class="cx"> void removeSwipeSnapshot();
</span><ins>+ void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> // IPC::MessageReceiver.
</span><span class="cx"> virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
</span><span class="cx">
</span><span class="cx"> void swipeSnapshotWatchdogTimerFired();
</span><ins>+ void activeLoadMonitoringTimerFired();
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> // Message handlers.
</span><span class="lines">@@ -135,7 +137,6 @@
</span><span class="cx"> void didCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect renderRect, WebCore::FloatRect visibleContentBounds, bool isReplacedElement, double viewportMinimumScale, double viewportMaximumScale);
</span><span class="cx"> void didHitRenderTreeSizeThreshold();
</span><span class="cx"> void removeSwipeSnapshotAfterRepaint();
</span><del>- void activeLoadMonitoringTimerFired();
</del><span class="cx">
</span><span class="cx"> void endMagnificationGesture();
</span><span class="cx"> WebCore::FloatPoint scaledMagnificationOrigin(WebCore::FloatPoint origin, double scale);
</span><span class="lines">@@ -152,67 +153,71 @@
</span><span class="cx"> CALayer *determineLayerAdjacentToSnapshotForParent(SwipeDirection, CALayer *snapshotLayerParent) const;
</span><span class="cx"> void applyDebuggingPropertiesToSwipeViews();
</span><span class="cx"> void didMoveSwipeSnapshotLayer();
</span><ins>+#else
+ void removeSwipeSnapshotIfReady();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> WebPageProxy& m_webPageProxy;
</span><del>- ViewGestureType m_activeGestureType;
</del><ins>+ ViewGestureType m_activeGestureType { ViewGestureType::None };
</ins><span class="cx">
</span><span class="cx"> RunLoop::Timer<ViewGestureController> m_swipeWatchdogTimer;
</span><ins>+ RunLoop::Timer<ViewGestureController> m_swipeActiveLoadMonitoringTimer;
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> RefPtr<ViewSnapshot> m_currentSwipeSnapshot;
</span><span class="cx">
</span><span class="cx"> RunLoop::Timer<ViewGestureController> m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer;
</span><del>- RunLoop::Timer<ViewGestureController> m_swipeActiveLoadMonitoringTimer;
</del><span class="cx">
</span><span class="cx"> double m_magnification;
</span><span class="cx"> WebCore::FloatPoint m_magnificationOrigin;
</span><span class="cx">
</span><span class="cx"> WebCore::FloatRect m_lastSmartMagnificationUnscaledTargetRect;
</span><del>- bool m_lastMagnificationGestureWasSmartMagnification;
</del><ins>+ bool m_lastMagnificationGestureWasSmartMagnification { false };
</ins><span class="cx"> WebCore::FloatPoint m_lastSmartMagnificationOrigin;
</span><span class="cx">
</span><span class="cx"> WebCore::FloatRect m_visibleContentRect;
</span><del>- bool m_visibleContentRectIsValid;
- bool m_frameHandlesMagnificationGesture;
</del><ins>+ bool m_visibleContentRectIsValid { false };
+ bool m_frameHandlesMagnificationGesture { false };
</ins><span class="cx">
</span><span class="cx"> RetainPtr<WKSwipeCancellationTracker> m_swipeCancellationTracker;
</span><span class="cx"> RetainPtr<CALayer> m_swipeLayer;
</span><span class="cx"> RetainPtr<CALayer> m_swipeSnapshotLayer;
</span><span class="cx"> Vector<RetainPtr<CALayer>> m_currentSwipeLiveLayers;
</span><span class="cx">
</span><del>- SwipeTransitionStyle m_swipeTransitionStyle;
</del><ins>+ SwipeTransitionStyle m_swipeTransitionStyle { SwipeTransitionStyle::Overlap };
</ins><span class="cx"> Vector<RetainPtr<NSView>> m_customSwipeViews;
</span><del>- float m_customSwipeViewsTopContentInset;
</del><ins>+ float m_customSwipeViewsTopContentInset { 0 };
</ins><span class="cx"> WebCore::FloatRect m_currentSwipeCustomViewBounds;
</span><span class="cx">
</span><span class="cx"> // If we need to wait for content to decide if it is going to consume
</span><span class="cx"> // the scroll event that would have started a swipe, we'll fill these in.
</span><del>- PendingSwipeReason m_pendingSwipeReason;
</del><ins>+ PendingSwipeReason m_pendingSwipeReason { PendingSwipeReason::None };
</ins><span class="cx"> SwipeDirection m_pendingSwipeDirection;
</span><span class="cx"> WebCore::FloatSize m_cumulativeDeltaForPendingSwipe;
</span><span class="cx">
</span><del>- void (^m_didMoveSwipeSnapshotCallback)(CGRect);
</del><ins>+ void (^m_didMoveSwipeSnapshotCallback)(CGRect) { nullptr };
</ins><span class="cx">
</span><del>- bool m_shouldIgnorePinnedState;
-
- bool m_swipeWaitingForVisuallyNonEmptyLayout;
- bool m_swipeWaitingForRenderTreeSizeThreshold;
- bool m_swipeWaitingForRepaint;
- bool m_swipeInProgress;
</del><ins>+ bool m_shouldIgnorePinnedState { false };
+ bool m_swipeInProgress { false };
</ins><span class="cx"> #else
</span><del>- UIView *m_liveSwipeView;
</del><ins>+ UIView *m_liveSwipeView { nullptr };
</ins><span class="cx"> RetainPtr<UIView> m_liveSwipeViewClippingView;
</span><span class="cx"> RetainPtr<UIView> m_snapshotView;
</span><span class="cx"> RetainPtr<UIView> m_transitionContainerView;
</span><span class="cx"> RetainPtr<WKSwipeTransitionController> m_swipeInteractiveTransitionDelegate;
</span><span class="cx"> RetainPtr<_UIViewControllerOneToOneTransitionContext> m_swipeTransitionContext;
</span><del>- uint64_t m_snapshotRemovalTargetRenderTreeSize;
- bool m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit;
</del><ins>+ uint64_t m_snapshotRemovalTargetRenderTreeSize { 0 };
</ins><span class="cx"> WeakObjCPtr<WKWebView> m_alternateBackForwardListSourceView;
</span><span class="cx"> RefPtr<WebPageProxy> m_webPageProxyForBackForwardListForCurrentSwipe;
</span><del>- uint64_t m_gesturePendingSnapshotRemoval;
</del><ins>+ uint64_t m_gesturePendingSnapshotRemoval { 0 };
</ins><span class="cx"> #endif
</span><ins>+
+ bool m_swipeWaitingForVisuallyNonEmptyLayout { false };
+ bool m_swipeWaitingForRenderTreeSizeThreshold { false };
+ bool m_swipeWaitingForRepaint { false };
+ bool m_swipeWaitingForDidFinishLoad { false };
+ bool m_swipeWaitingForSubresourceLoads { false };
+ bool m_swipeWaitingForScrollPositionRestoration { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (182149 => 182150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2015-03-30 18:58:23 UTC (rev 182149)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2015-03-30 19:02:15 UTC (rev 182150)
</span><span class="lines">@@ -86,22 +86,9 @@
</span><span class="cx">
</span><span class="cx"> ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
</span><span class="cx"> : m_webPageProxy(webPageProxy)
</span><del>- , m_activeGestureType(ViewGestureType::None)
</del><span class="cx"> , m_swipeWatchdogTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
</span><del>- , m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
</del><span class="cx"> , m_swipeActiveLoadMonitoringTimer(RunLoop::main(), this, &ViewGestureController::activeLoadMonitoringTimerFired)
</span><del>- , m_lastMagnificationGestureWasSmartMagnification(false)
- , m_visibleContentRectIsValid(false)
- , m_frameHandlesMagnificationGesture(false)
- , m_swipeTransitionStyle(SwipeTransitionStyle::Overlap)
- , m_customSwipeViewsTopContentInset(0)
- , m_pendingSwipeReason(PendingSwipeReason::None)
- , m_didMoveSwipeSnapshotCallback(nullptr)
- , m_shouldIgnorePinnedState(false)
- , m_swipeWaitingForVisuallyNonEmptyLayout(false)
- , m_swipeWaitingForRenderTreeSizeThreshold(false)
- , m_swipeWaitingForRepaint(false)
- , m_swipeInProgress(false)
</del><ins>+ , m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer(RunLoop::main(), this, &ViewGestureController::swipeSnapshotWatchdogTimerFired)
</ins><span class="cx"> {
</span><span class="cx"> m_webPageProxy.process().addMessageReceiver(Messages::ViewGestureController::messageReceiverName(), m_webPageProxy.pageID(), *this);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>