<!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>[173077] tags/Safari-600.1.15.2/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/173077">173077</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2014-08-28 13:34:58 -0700 (Thu, 28 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/172966">r172966</a>. &lt;rdar://problem/18107826&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#tagsSafari6001152SourceWebKit2ChangeLog">tags/Safari-600.1.15.2/Source/WebKit2/ChangeLog</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessAPImacWKViewmm">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessAPImacWKViewInternalh">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessPageClienth">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessWebPageProxycpp">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessiosPageClientImplIOSh">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessiosPageClientImplIOSmm">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessmacPageClientImplh">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessmacPageClientImplmm">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessmacViewGestureControllerh">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureController.h</a></li>
<li><a href="#tagsSafari6001152SourceWebKit2UIProcessmacViewGestureControllerMacmm">tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="tagsSafari6001152SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/ChangeLog (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/ChangeLog        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/ChangeLog        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -1,3 +1,81 @@
</span><ins>+2014-08-28  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
+        Merge r172966. &lt;rdar://problem/18107826&gt;
+
+    2014-08-26  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+            REGRESSION (r172771): Amazon product page becomes unresponsive after swiping back to it
+            https://bugs.webkit.org/show_bug.cgi?id=136260
+            &lt;rdar://problem/18107826&gt;
+
+            Reviewed by Dan Bernstein.
+
+            Previously, when a swipe ended up performing a same-document navigation,
+            we would never get didFinishLoadForMainFrame nor didFirstVisuallyNonEmptyLayoutForMainFrame
+            nor would we even get didHitRenderTreeSizeThreshold in all cases, so we would never
+            remove the swipe snapshot. Previous implementations removed the snapshot on
+            didSameDocumentNavigation for the main frame if the navigation type was Replace or Pop,
+            so we will match that behavior.
+
+            Also, reinstate the watchdog that starts at swipe-end which would have prevented
+            this bug from forever breaking the view it was associated with.
+
+            Also, defend against removing the snapshot before the swipe has finished (before
+            we have even caused the navigation that we're watching for the effects of).
+
+            * UIProcess/API/mac/WKView.mm:
+            (-[WKView _didSameDocumentNavigationForMainFrame:]):
+            * UIProcess/API/mac/WKViewInternal.h:
+            * UIProcess/PageClient.h:
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
+            * UIProcess/ios/PageClientImplIOS.h:
+            * UIProcess/ios/PageClientImplIOS.mm:
+            (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
+            * UIProcess/mac/PageClientImpl.h:
+            * UIProcess/mac/PageClientImpl.mm:
+            (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
+            Plumb main-frame same-document navigation notification from WebPageProxy
+            to ViewGestureControllerMac via PageClient and WKView.
+
+            * UIProcess/mac/ViewGestureController.h:
+            * UIProcess/mac/ViewGestureControllerMac.mm:
+            (WebKit::ViewGestureController::ViewGestureController):
+            (WebKit::ViewGestureController::beginSwipeGesture):
+            (WebKit::ViewGestureController::endSwipeGesture):
+            Keep track of whether a swipe is currently occurring. We can't use
+            activeGestureType for this because the swipe currently remains the &quot;active&quot;
+            gesture until the snapshot is removed.
+
+            Reintroduce the old swipeWatchdogTimer (and rename the shorter timer that starts
+            when we get a visually non-empty layout) so that we will always remove the
+            snapshot after 5 seconds, even if we haven't committed the load.
+            This could lead to flashing back to the old content if we fail to get a single
+            byte for 5 seconds, but that is a rare case and should eventually get additional
+            special treatment (dropping the tiles until we do get content, or some such).
+
+            (WebKit::ViewGestureController::didHitRenderTreeSizeThreshold):
+            If a swipe is still in progress, we haven't done our navigation and thus
+            don't care about render tree size changes.
+
+            (WebKit::ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame):
+            If a swipe is still in progress, we haven't done our navigation and thus
+            don't care about layouts.
+
+            Stop the 5 second overall watchdog if we start the 3 second after-visuallyNonEmptyLayout
+            watchdog. This means that the snapshot could stay up for a maximum of 8 seconds
+            for a very, very slow load.
+
+            (WebKit::ViewGestureController::didFinishLoadForMainFrame):
+            If a swipe is still in progress, we haven't done our navigation and thus
+            don't care about loads that complete.
+
+            (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
+            Remove the swipe snapshot after painting if we do replaceState or popState.
+
+            (WebKit::ViewGestureController::removeSwipeSnapshotAfterRepaint):
+            If a swipe is still in progress, we shouldn't remove the snapshot yet.
+
</ins><span class="cx"> 2014-08-19  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r172643. &lt;rdar://problem/18032571&gt;
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKView.mm (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -3610,6 +3610,12 @@
</span><span class="cx">         _data-&gt;_gestureController-&gt;didFinishLoadForMainFrame();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_didSameDocumentNavigationForMainFrame:(SameDocumentNavigationType)type
+{
+    if (_data-&gt;_gestureController)
+        _data-&gt;_gestureController-&gt;didSameDocumentNavigationForMainFrame(type);
+}
+
</ins><span class="cx"> - (void)_removeNavigationGestureSnapshot
</span><span class="cx"> {
</span><span class="cx">     if (_data-&gt;_gestureController)
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #import &quot;WKViewPrivate.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;PluginComplexTextInputState.h&quot;
</span><ins>+#import &quot;SameDocumentNavigationType.h&quot;
</ins><span class="cx"> #import &quot;WebFindOptions.h&quot;
</span><span class="cx"> #import &lt;wtf/Forward.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="lines">@@ -109,6 +110,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_didFirstVisuallyNonEmptyLayoutForMainFrame;
</span><span class="cx"> - (void)_didFinishLoadForMainFrame;
</span><ins>+- (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)type;
</ins><span class="cx"> - (void)_removeNavigationGestureSnapshot;
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/PageClient.h (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/PageClient.h        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/PageClient.h        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -305,6 +305,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() = 0;
</span><span class="cx">     virtual void didFinishLoadForMainFrame() = 0;
</span><ins>+    virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/WebPageProxy.cpp (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -2709,14 +2709,20 @@
</span><span class="cx"> 
</span><span class="cx">     auto transaction = m_pageLoadState.transaction();
</span><span class="cx"> 
</span><del>-    if (frame-&gt;isMainFrame())
</del><ins>+    bool isMainFrame = frame-&gt;isMainFrame();
+    if (isMainFrame)
</ins><span class="cx">         m_pageLoadState.didSameDocumentNavigation(transaction, url);
</span><span class="cx"> 
</span><span class="cx">     m_pageLoadState.clearPendingAPIRequestURL(transaction);
</span><span class="cx">     frame-&gt;didSameDocumentNavigation(url);
</span><span class="cx"> 
</span><span class="cx">     m_pageLoadState.commitChanges();
</span><del>-    m_loaderClient-&gt;didSameDocumentNavigationForFrame(this, frame, navigationID, static_cast&lt;SameDocumentNavigationType&gt;(opaqueSameDocumentNavigationType), userData.get());
</del><ins>+
+    SameDocumentNavigationType navigationType = static_cast&lt;SameDocumentNavigationType&gt;(opaqueSameDocumentNavigationType);
+    m_loaderClient-&gt;didSameDocumentNavigationForFrame(this, frame, navigationID, navigationType, userData.get());
+
+    if (isMainFrame)
+        m_pageClient.didSameDocumentNavigationForMainFrame(navigationType);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String&amp; title, IPC::MessageDecoder&amp; decoder)
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -177,6 +177,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
</span><span class="cx">     virtual void didFinishLoadForMainFrame() override;
</span><ins>+    virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
</ins><span class="cx"> 
</span><span class="cx">     WKContentView *m_contentView;
</span><span class="cx">     WKWebView *m_webView;
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -690,6 +690,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType)
+{
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.h (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -181,6 +181,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
</span><span class="cx">     virtual void didFinishLoadForMainFrame() override;
</span><ins>+    virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
</ins><span class="cx">     virtual void removeNavigationGestureSnapshot() override;
</span><span class="cx"> 
</span><span class="cx">     WKView *m_wkView;
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -732,6 +732,11 @@
</span><span class="cx">     [m_wkView _didFinishLoadForMainFrame];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType type)
+{
+    [m_wkView _didSameDocumentNavigationForMainFrame:type];
+}
+
</ins><span class="cx"> void PageClientImpl::removeNavigationGestureSnapshot()
</span><span class="cx"> {
</span><span class="cx">     [m_wkView _removeNavigationGestureSnapshot];
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessmacViewGestureControllerh"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureController.h (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define ViewGestureController_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MessageReceiver.h&quot;
</span><ins>+#include &quot;SameDocumentNavigationType.h&quot;
</ins><span class="cx"> #include &quot;WeakObjCPtr.h&quot;
</span><span class="cx"> #include &lt;WebCore/FloatRect.h&gt;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="lines">@@ -107,6 +108,7 @@
</span><span class="cx"> 
</span><span class="cx">     void didFirstVisuallyNonEmptyLayoutForMainFrame();
</span><span class="cx">     void didFinishLoadForMainFrame();
</span><ins>+    void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType);
</ins><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">@@ -158,6 +160,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><ins>+    RunLoop::Timer&lt;ViewGestureController&gt; m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer;
+
</ins><span class="cx">     double m_magnification;
</span><span class="cx">     WebCore::FloatPoint m_magnificationOrigin;
</span><span class="cx"> 
</span><span class="lines">@@ -190,6 +194,7 @@
</span><span class="cx">     bool m_swipeWaitingForVisuallyNonEmptyLayout;
</span><span class="cx">     bool m_swipeWaitingForRenderTreeSizeThreshold;
</span><span class="cx">     bool m_swipeWaitingForRepaint;
</span><ins>+    bool m_swipeInProgress;
</ins><span class="cx"> #else    
</span><span class="cx">     UIView *m_liveSwipeView;
</span><span class="cx">     RetainPtr&lt;UIView&gt; m_liveSwipeViewClippingView;
</span></span></pre></div>
<a id="tagsSafari6001152SourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (173076 => 173077)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-08-28 20:27:14 UTC (rev 173076)
+++ tags/Safari-600.1.15.2/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-08-28 20:34:58 UTC (rev 173077)
</span><span class="lines">@@ -77,7 +77,8 @@
</span><span class="cx"> static const float minimumScrollEventRatioForSwipe = 0.5;
</span><span class="cx"> 
</span><span class="cx"> static const float swipeSnapshotRemovalRenderTreeSizeTargetFraction = 0.5;
</span><del>-static const std::chrono::seconds swipeSnapshotRemovalWatchdogDuration = 3_s;
</del><ins>+static const std::chrono::seconds swipeSnapshotRemovalWatchdogDuration = 5_s;
+static const std::chrono::seconds swipeSnapshotRemovalWatchdogAfterFirstVisuallyNonEmptyLayoutDuration = 3_s;
</ins><span class="cx"> 
</span><span class="cx"> @interface WKSwipeCancellationTracker : NSObject {
</span><span class="cx"> @private
</span><span class="lines">@@ -98,6 +99,7 @@
</span><span class="cx">     : m_webPageProxy(webPageProxy)
</span><span class="cx">     , m_activeGestureType(ViewGestureType::None)
</span><span class="cx">     , m_swipeWatchdogTimer(RunLoop::main(), this, &amp;ViewGestureController::swipeSnapshotWatchdogTimerFired)
</span><ins>+    , m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer(RunLoop::main(), this, &amp;ViewGestureController::swipeSnapshotWatchdogTimerFired)
</ins><span class="cx">     , m_lastMagnificationGestureWasSmartMagnification(false)
</span><span class="cx">     , m_visibleContentRectIsValid(false)
</span><span class="cx">     , m_frameHandlesMagnificationGesture(false)
</span><span class="lines">@@ -108,6 +110,7 @@
</span><span class="cx">     , m_swipeWaitingForVisuallyNonEmptyLayout(false)
</span><span class="cx">     , m_swipeWaitingForRenderTreeSizeThreshold(false)
</span><span class="cx">     , m_swipeWaitingForRepaint(false)
</span><ins>+    , m_swipeInProgress(false)
</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 class="lines">@@ -505,6 +508,7 @@
</span><span class="cx">     m_webPageProxy.navigationGestureDidBegin();
</span><span class="cx"> 
</span><span class="cx">     m_activeGestureType = ViewGestureType::Swipe;
</span><ins>+    m_swipeInProgress = true;
</ins><span class="cx"> 
</span><span class="cx">     CALayer *rootContentLayer = m_webPageProxy.acceleratedCompositingRootLayer();
</span><span class="cx"> 
</span><span class="lines">@@ -627,6 +631,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_swipeCancellationTracker = nullptr;
</span><span class="cx"> 
</span><ins>+    m_swipeInProgress = false;
+
</ins><span class="cx">     CALayer *rootLayer = m_webPageProxy.acceleratedCompositingRootLayer();
</span><span class="cx"> 
</span><span class="cx">     [rootLayer setShadowOpacity:0];
</span><span class="lines">@@ -649,11 +655,13 @@
</span><span class="cx"> 
</span><span class="cx">     m_webPageProxy.navigationGestureDidEnd(true, *targetItem);
</span><span class="cx">     m_webPageProxy.goToBackForwardItem(targetItem);
</span><ins>+
+    m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ViewGestureController::didHitRenderTreeSizeThreshold()
</span><span class="cx"> {
</span><del>-    if (m_activeGestureType != ViewGestureType::Swipe)
</del><ins>+    if (m_activeGestureType != ViewGestureType::Swipe || m_swipeInProgress)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_swipeWaitingForRenderTreeSizeThreshold = false;
</span><span class="lines">@@ -664,20 +672,27 @@
</span><span class="cx"> 
</span><span class="cx"> void ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame()
</span><span class="cx"> {
</span><del>-    if (m_activeGestureType != ViewGestureType::Swipe)
</del><ins>+    if (m_activeGestureType != ViewGestureType::Swipe || m_swipeInProgress)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_swipeWaitingForVisuallyNonEmptyLayout = false;
</span><span class="cx"> 
</span><span class="cx">     if (!m_swipeWaitingForRenderTreeSizeThreshold)
</span><span class="cx">         removeSwipeSnapshotAfterRepaint();
</span><del>-    else
-        m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
</del><ins>+    else {
+        m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer.startOneShot(swipeSnapshotRemovalWatchdogAfterFirstVisuallyNonEmptyLayoutDuration.count());
+        m_swipeWatchdogTimer.stop();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ViewGestureController::didFinishLoadForMainFrame()
</span><span class="cx"> {
</span><del>-    if (m_activeGestureType != ViewGestureType::Swipe)
</del><ins>+    removeSwipeSnapshotAfterRepaint();
+}
+
+void ViewGestureController::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType type)
+{
+    if (type != SameDocumentNavigationSessionStateReplace &amp;&amp; type != SameDocumentNavigationSessionStatePop)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     removeSwipeSnapshotAfterRepaint();
</span><span class="lines">@@ -690,7 +705,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ViewGestureController::removeSwipeSnapshotAfterRepaint()
</span><span class="cx"> {
</span><del>-    if (m_activeGestureType != ViewGestureType::Swipe)
</del><ins>+    if (m_activeGestureType != ViewGestureType::Swipe || m_swipeInProgress)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (m_swipeWaitingForRepaint)
</span><span class="lines">@@ -709,6 +724,7 @@
</span><span class="cx">     m_swipeWaitingForRepaint = false;
</span><span class="cx"> 
</span><span class="cx">     m_swipeWatchdogTimer.stop();
</span><ins>+    m_swipeWatchdogAfterFirstVisuallyNonEmptyLayoutTimer.stop();
</ins><span class="cx"> 
</span><span class="cx">     if (m_activeGestureType != ViewGestureType::Swipe)
</span><span class="cx">         return;
</span></span></pre>
</div>
</div>

</body>
</html>