<!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>[171034] 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/171034">171034</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2014-07-12 16:32:39 -0700 (Sat, 12 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre><rdar://problem/16020380> [Cocoa] Inform the client when back-forward navigation gestures begin and end
https://bugs.webkit.org/show_bug.cgi?id=134853
Reviewed by Sam Weinig.
* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new WKNavigationDelegate
methods.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _isShowingNavigationGestureSnapshot]): Added this getter.
* UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new property
_isShowingNavigationGestureSnapshot.
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate): Initialize new flags in
m_navigationDelegateMethods.
(WebKit::NavigationState::navigationGestureDidBegin): Added. Calls the new
WKNavigationDelegate method.
(WebKit::NavigationState::navigationGestureWillEnd): Ditto.
(WebKit::NavigationState::navigationGestureDidEnd): Ditto.
* UIProcess/PageClient.h: Declared new client functions.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy): Initialize new member variable.
(WebKit::WebPageProxy::navigationGestureDidBegin): Set m_isShowingNavigationGestureSnapshot
and call the new client function.
(WebKit::WebPageProxy::navigationGestureWillEnd): Call the new client function.
(WebKit::WebPageProxy::navigationGestureDidEnd): Ditto.
(WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved): Clear
m_isShowingNavigationGestureSnapshot.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isShowingNavigationGestureSnapshot): Added this getter.
* UIProcess/ios/PageClientImplIOS.h: Declared overrides of new client functions.
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new
NavigationState function.
(WebKit::PageClientImpl::navigationGestureWillEnd): Ditto.
(WebKit::PageClientImpl::navigationGestureDidEnd): Ditto.
* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture): Added calls to
WebPageProxy::navigationGestureDidBegin and WebPageProxy::navigationGestureWillEnd.
(WebKit::ViewGestureController::endSwipeGesture): Added calls to
WebPageProxy::navigationGestureDidEnd.
(WebKit::ViewGestureController::removeSwipeSnapshot): Added call to
WebPageProxy::navigationGestureSnapshotWasRemoved.
* UIProcess/mac/PageClientImpl.h: Declared overrides of new client functions.
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new
NavigationState function.
(WebKit::PageClientImpl::navigationGestureWillEnd): Ditto.
(WebKit::PageClientImpl::navigationGestureDidEnd): Ditto.
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::beginSwipeGesture): Added call to
WebPageProxy::navigationGestureDidBegin.
(WebKit::ViewGestureController::endSwipeGesture): Added calls to
WebPageProxy::navigationGestureDidEnd.
(WebKit::ViewGestureController::removeSwipeSnapshot): Added call to
WebPageProxy::navigationGestureSnapshotWasRemoved.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNavigationDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaNavigationStateh">trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaNavigationStatemm">trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.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="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</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 (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -1,3 +1,71 @@
</span><ins>+2014-07-12 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/16020380> [Cocoa] Inform the client when back-forward navigation gestures begin and end
+ https://bugs.webkit.org/show_bug.cgi?id=134853
+
+ Reviewed by Sam Weinig.
+
+ * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new WKNavigationDelegate
+ methods.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _isShowingNavigationGestureSnapshot]): Added this getter.
+
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new property
+ _isShowingNavigationGestureSnapshot.
+
+ * UIProcess/Cocoa/NavigationState.h:
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::setNavigationDelegate): Initialize new flags in
+ m_navigationDelegateMethods.
+ (WebKit::NavigationState::navigationGestureDidBegin): Added. Calls the new
+ WKNavigationDelegate method.
+ (WebKit::NavigationState::navigationGestureWillEnd): Ditto.
+ (WebKit::NavigationState::navigationGestureDidEnd): Ditto.
+
+ * UIProcess/PageClient.h: Declared new client functions.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy): Initialize new member variable.
+ (WebKit::WebPageProxy::navigationGestureDidBegin): Set m_isShowingNavigationGestureSnapshot
+ and call the new client function.
+ (WebKit::WebPageProxy::navigationGestureWillEnd): Call the new client function.
+ (WebKit::WebPageProxy::navigationGestureDidEnd): Ditto.
+ (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved): Clear
+ m_isShowingNavigationGestureSnapshot.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::isShowingNavigationGestureSnapshot): Added this getter.
+
+ * UIProcess/ios/PageClientImplIOS.h: Declared overrides of new client functions.
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new
+ NavigationState function.
+ (WebKit::PageClientImpl::navigationGestureWillEnd): Ditto.
+ (WebKit::PageClientImpl::navigationGestureDidEnd): Ditto.
+
+ * UIProcess/ios/ViewGestureControllerIOS.mm:
+ (WebKit::ViewGestureController::beginSwipeGesture): Added calls to
+ WebPageProxy::navigationGestureDidBegin and WebPageProxy::navigationGestureWillEnd.
+ (WebKit::ViewGestureController::endSwipeGesture): Added calls to
+ WebPageProxy::navigationGestureDidEnd.
+ (WebKit::ViewGestureController::removeSwipeSnapshot): Added call to
+ WebPageProxy::navigationGestureSnapshotWasRemoved.
+
+ * UIProcess/mac/PageClientImpl.h: Declared overrides of new client functions.
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new
+ NavigationState function.
+ (WebKit::PageClientImpl::navigationGestureWillEnd): Ditto.
+ (WebKit::PageClientImpl::navigationGestureDidEnd): Ditto.
+
+ * UIProcess/mac/ViewGestureControllerMac.mm:
+ (WebKit::ViewGestureController::beginSwipeGesture): Added call to
+ WebPageProxy::navigationGestureDidBegin.
+ (WebKit::ViewGestureController::endSwipeGesture): Added calls to
+ WebPageProxy::navigationGestureDidEnd.
+ (WebKit::ViewGestureController::removeSwipeSnapshot): Added call to
+ WebPageProxy::navigationGestureSnapshotWasRemoved.
+
</ins><span class="cx"> 2014-07-12 Oliver Hunt <oliver@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix typo in prior patch
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNavigationDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -59,6 +59,13 @@
</span><span class="cx">
</span><span class="cx"> - (NSData *)_webCryptoMasterKeyForWebView:(WKWebView *)webView;
</span><span class="cx">
</span><ins>+- (void)_webViewDidBeginNavigationGesture:(WKWebView *)webView;
+// Item is nil if the gesture ended without navigation.
+- (void)_webViewDidEndNavigationGesture:(WKWebView *)webView withNavigationToBackForwardListItem:(WKBackForwardListItem *)item;
+// Only called if how the gesture will end (with or without navigation) is known before it ends.
+- (void)_webViewWillEndNavigationGesture:(WKWebView *)webView withNavigationToBackForwardListItem:(WKBackForwardListItem *)item;
+
+
</ins><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didStartLoadForQuickLookDocumentInMainFrameWithFileName:(NSString *)fileName uti:(NSString *)uti;
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didFinishLoadForQuickLookDocumentInMainFrame:(NSData *)documentData;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -1980,6 +1980,11 @@
</span><span class="cx"> return NO;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (BOOL)_isShowingNavigationGestureSnapshot
+{
+ return _page->isShowingNavigationGestureSnapshot();
+}
+
</ins><span class="cx"> #pragma mark iOS-specific methods
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -101,6 +101,8 @@
</span><span class="cx">
</span><span class="cx"> @property (nonatomic, readonly) BOOL _networkRequestsInProgress;
</span><span class="cx">
</span><ins>+@property (nonatomic, readonly, getter=_isShowingNavigationGestureSnapshot) BOOL _showingNavigationGestureSnapshot;
+
</ins><span class="cx"> - (void)_close;
</span><span class="cx">
</span><span class="cx"> #if TARGET_OS_IPHONE
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaNavigationStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -74,6 +74,11 @@
</span><span class="cx"> void didPerformServerRedirect(const WTF::String& sourceURL, const WTF::String& destinationURL);
</span><span class="cx"> void didUpdateHistoryTitle(const WTF::String& title, const WTF::String& url);
</span><span class="cx">
</span><ins>+ // Called by the page client.
+ void navigationGestureDidBegin();
+ void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&);
+ void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&);
+
</ins><span class="cx"> private:
</span><span class="cx"> class PolicyClient : public API::PolicyClient {
</span><span class="cx"> public:
</span><span class="lines">@@ -158,6 +163,9 @@
</span><span class="cx"> bool webViewDidReceiveAuthenticationChallenge : 1;
</span><span class="cx"> bool webViewWebProcessDidCrash : 1;
</span><span class="cx"> bool webCryptoMasterKeyForWebView : 1;
</span><ins>+ bool webViewDidBeginNavigationGesture : 1;
+ bool webViewWillEndNavigationGestureWithNavigationToBackForwardListItem : 1;
+ bool webViewDidEndNavigationGestureWithNavigationToBackForwardListItem : 1;
</ins><span class="cx"> #if USE(QUICK_LOOK)
</span><span class="cx"> bool webViewDidStartLoadForQuickLookDocumentInMainFrame : 1;
</span><span class="cx"> bool webViewDidFinishLoadForQuickLookDocumentInMainFrame : 1;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaNavigationStatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -137,6 +137,9 @@
</span><span class="cx"> m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:didReceiveAuthenticationChallenge:)];
</span><span class="cx"> m_navigationDelegateMethods.webViewWebProcessDidCrash = [delegate respondsToSelector:@selector(_webViewWebProcessDidCrash:)];
</span><span class="cx"> m_navigationDelegateMethods.webCryptoMasterKeyForWebView = [delegate respondsToSelector:@selector(_webCryptoMasterKeyForWebView:)];
</span><ins>+ m_navigationDelegateMethods.webViewDidBeginNavigationGesture = [delegate respondsToSelector:@selector(_webViewDidBeginNavigationGesture:)];
+ m_navigationDelegateMethods.webViewWillEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewWillEndNavigationGesture:withNavigationToBackForwardListItem:)];
+ m_navigationDelegateMethods.webViewDidEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewDidEndNavigationGesture:withNavigationToBackForwardListItem:)];
</ins><span class="cx"> #if USE(QUICK_LOOK)
</span><span class="cx"> m_navigationDelegateMethods.webViewDidStartLoadForQuickLookDocumentInMainFrame = [delegate respondsToSelector:@selector(_webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:)];
</span><span class="cx"> m_navigationDelegateMethods.webViewDidFinishLoadForQuickLookDocumentInMainFrame = [delegate respondsToSelector:@selector(_webView:didFinishLoadForQuickLookDocumentInMainFrame:)];
</span><span class="lines">@@ -251,6 +254,42 @@
</span><span class="cx"> [historyDelegate _webView:m_webView didUpdateHistoryTitle:title forURL:[NSURL _web_URLWithWTFString:url]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void NavigationState::navigationGestureDidBegin()
+{
+ if (!m_navigationDelegateMethods.webViewDidBeginNavigationGesture)
+ return;
+
+ auto navigationDelegate = m_navigationDelegate.get();
+ if (!navigationDelegate)
+ return;
+
+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewDidBeginNavigationGesture:m_webView];
+}
+
+void NavigationState::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ if (!m_navigationDelegateMethods.webViewWillEndNavigationGestureWithNavigationToBackForwardListItem)
+ return;
+
+ auto navigationDelegate = m_navigationDelegate.get();
+ if (!navigationDelegate)
+ return;
+
+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewWillEndNavigationGesture:m_webView withNavigationToBackForwardListItem:willNavigate ? wrapper(item) : nil];
+}
+
+void NavigationState::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ if (!m_navigationDelegateMethods.webViewDidEndNavigationGestureWithNavigationToBackForwardListItem)
+ return;
+
+ auto navigationDelegate = m_navigationDelegate.get();
+ if (!navigationDelegate)
+ return;
+
+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewDidEndNavigationGesture:m_webView withNavigationToBackForwardListItem:willNavigate ? wrapper(item) : nil];
+}
+
</ins><span class="cx"> NavigationState::PolicyClient::PolicyClient(NavigationState& navigationState)
</span><span class="cx"> : m_navigationState(navigationState)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -294,6 +294,10 @@
</span><span class="cx">
</span><span class="cx"> // Custom representations.
</span><span class="cx"> virtual void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) = 0;
</span><ins>+
+ virtual void navigationGestureDidBegin() = 0;
+ virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) = 0;
+ virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -355,6 +355,7 @@
</span><span class="cx"> , m_enableHorizontalRubberBanding(true)
</span><span class="cx"> , m_backgroundExtendsBeyondPage(false)
</span><span class="cx"> , m_shouldRecordNavigationSnapshots(false)
</span><ins>+ , m_isShowingNavigationGestureSnapshot(false)
</ins><span class="cx"> , m_pageCount(0)
</span><span class="cx"> , m_renderTreeSize(0)
</span><span class="cx"> , m_shouldSendEventsSynchronously(false)
</span><span class="lines">@@ -5126,4 +5127,25 @@
</span><span class="cx"> m_process->send(Messages::WebPage::TakeSnapshot(rect, bitmapSize, options, callbackID), m_pageID);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebPageProxy::navigationGestureDidBegin()
+{
+ m_isShowingNavigationGestureSnapshot = true;
+ m_pageClient.navigationGestureDidBegin();
+}
+
+void WebPageProxy::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ m_pageClient.navigationGestureWillEnd(willNavigate, item);
+}
+
+void WebPageProxy::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ m_pageClient.navigationGestureDidEnd(willNavigate, item);
+}
+
+void WebPageProxy::navigationGestureSnapshotWasRemoved()
+{
+ m_isShowingNavigationGestureSnapshot = false;
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -897,6 +897,13 @@
</span><span class="cx">
</span><span class="cx"> void takeSnapshot(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions, std::function<void (const ShareableBitmap::Handle&, CallbackBase::Error)>);
</span><span class="cx">
</span><ins>+ void navigationGestureDidBegin();
+ void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&);
+ void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&);
+ void navigationGestureSnapshotWasRemoved();
+
+ bool isShowingNavigationGestureSnapshot() const { return m_isShowingNavigationGestureSnapshot; }
+
</ins><span class="cx"> private:
</span><span class="cx"> WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, const WebPageConfiguration&);
</span><span class="cx"> void platformInitialize();
</span><span class="lines">@@ -1485,6 +1492,7 @@
</span><span class="cx"> bool m_backgroundExtendsBeyondPage;
</span><span class="cx">
</span><span class="cx"> bool m_shouldRecordNavigationSnapshots;
</span><ins>+ bool m_isShowingNavigationGestureSnapshot;
</ins><span class="cx">
</span><span class="cx"> unsigned m_pageCount;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -167,6 +167,10 @@
</span><span class="cx">
</span><span class="cx"> virtual Vector<String> mimeTypesWithCustomContentProviders() override;
</span><span class="cx">
</span><ins>+ virtual void navigationGestureDidBegin() override;
+ virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
+ virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
+
</ins><span class="cx"> WKContentView *m_contentView;
</span><span class="cx"> WKWebView *m_webView;
</span><span class="cx"> RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -32,8 +32,9 @@
</span><span class="cx"> #import "DataReference.h"
</span><span class="cx"> #import "DownloadProxy.h"
</span><span class="cx"> #import "FindIndicator.h"
</span><ins>+#import "InteractionInformationAtPosition.h"
</ins><span class="cx"> #import "NativeWebKeyboardEvent.h"
</span><del>-#import "InteractionInformationAtPosition.h"
</del><ins>+#import "NavigationState.h"
</ins><span class="cx"> #import "ViewSnapshotStore.h"
</span><span class="cx"> #import "WKContentView.h"
</span><span class="cx"> #import "WKContentViewInteraction.h"
</span><span class="lines">@@ -651,6 +652,21 @@
</span><span class="cx"> return m_webView.configuration._contentProviderRegistry._mimeTypesWithCustomContentProviders;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void PageClientImpl::navigationGestureDidBegin()
+{
+ NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidBegin();
+}
+
+void PageClientImpl::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ NavigationState::fromWebPage(*m_webView->_page).navigationGestureWillEnd(willNavigate, item);
+}
+
+void PageClientImpl::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidEnd(willNavigate, item);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -157,7 +157,9 @@
</span><span class="cx"> {
</span><span class="cx"> if (m_activeGestureType != ViewGestureType::None)
</span><span class="cx"> return;
</span><del>-
</del><ins>+
+ m_webPageProxy.navigationGestureDidBegin();
+
</ins><span class="cx"> ViewSnapshotStore::shared().recordSnapshot(m_webPageProxy);
</span><span class="cx">
</span><span class="cx"> WebKit::WebBackForwardListItem* targetItem = direction == SwipeDirection::Left ? m_webPageProxy.backForwardList().backItem() : m_webPageProxy.backForwardList().forwardItem();
</span><span class="lines">@@ -209,6 +211,10 @@
</span><span class="cx"> [transitionContext _setAnimator:animationController.get()];
</span><span class="cx"> [transitionContext _setInteractor:transition];
</span><span class="cx"> [transitionContext _setTransitionIsInFlight:YES];
</span><ins>+ [transitionContext _setInteractiveUpdateHandler:^(BOOL finish, CGFloat percent, BOOL transitionCompleted, _UIViewControllerTransitionContext *) {
+ if (finish)
+ m_webPageProxy.navigationGestureWillEnd(transitionCompleted, *targetItem);
+ }];
</ins><span class="cx"> [transitionContext _setCompletionHandler:^(_UIViewControllerTransitionContext *context, BOOL didComplete) { endSwipeGesture(targetItem, context, !didComplete); }];
</span><span class="cx"> [transitionContext _setInteractiveUpdateHandler:^(BOOL, CGFloat, BOOL, _UIViewControllerTransitionContext *) { }];
</span><span class="cx">
</span><span class="lines">@@ -240,6 +246,7 @@
</span><span class="cx">
</span><span class="cx"> if (cancelled) {
</span><span class="cx"> removeSwipeSnapshot();
</span><ins>+ m_webPageProxy.navigationGestureDidEnd(false, *targetItem);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -251,6 +258,8 @@
</span><span class="cx"> // like we normally would when going back or forward, because we are
</span><span class="cx"> // displaying the destination item's snapshot.
</span><span class="cx"> ViewSnapshotStore::shared().disableSnapshotting();
</span><ins>+
+ m_webPageProxy.navigationGestureDidEnd(true, *targetItem);
</ins><span class="cx"> m_webPageProxy.goToBackForwardItem(targetItem);
</span><span class="cx"> ViewSnapshotStore::shared().enableSnapshotting();
</span><span class="cx">
</span><span class="lines">@@ -314,6 +323,8 @@
</span><span class="cx">
</span><span class="cx"> m_snapshotRemovalTargetRenderTreeSize = 0;
</span><span class="cx"> m_activeGestureType = ViewGestureType::None;
</span><ins>+
+ m_webPageProxy.navigationGestureSnapshotWasRemoved();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -173,6 +173,10 @@
</span><span class="cx"> virtual void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ virtual void navigationGestureDidBegin() override;
+ virtual void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
+ virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
+
</ins><span class="cx"> NSView *activeView() const;
</span><span class="cx">
</span><span class="cx"> WKView *m_wkView;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">
</span><del>-#import "_WKDownloadInternal.h"
</del><span class="cx"> #import "AttributedString.h"
</span><span class="cx"> #import "ColorSpaceData.h"
</span><span class="cx"> #import "DataReference.h"
</span><span class="lines">@@ -37,17 +36,20 @@
</span><span class="cx"> #import "FindIndicator.h"
</span><span class="cx"> #import "NativeWebKeyboardEvent.h"
</span><span class="cx"> #import "NativeWebWheelEvent.h"
</span><ins>+#import "NavigationState.h"
</ins><span class="cx"> #import "StringUtilities.h"
</span><span class="cx"> #import "ViewSnapshotStore.h"
</span><span class="cx"> #import "WKAPICast.h"
</span><span class="cx"> #import "WKFullScreenWindowController.h"
</span><span class="cx"> #import "WKStringCF.h"
</span><span class="cx"> #import "WKViewInternal.h"
</span><ins>+#import "WKWebViewInternal.h"
</ins><span class="cx"> #import "WebColorPickerMac.h"
</span><span class="cx"> #import "WebContextMenuProxyMac.h"
</span><span class="cx"> #import "WebEditCommandProxy.h"
</span><span class="cx"> #import "WebPopupMenuProxyMac.h"
</span><span class="cx"> #import "WindowServerConnection.h"
</span><ins>+#import "_WKDownloadInternal.h"
</ins><span class="cx"> #import "_WKThumbnailView.h"
</span><span class="cx"> #import <WebCore/AlternativeTextUIController.h>
</span><span class="cx"> #import <WebCore/BitmapImage.h>
</span><span class="lines">@@ -685,6 +687,21 @@
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(FULLSCREEN_API)
</span><span class="cx">
</span><ins>+void PageClientImpl::navigationGestureDidBegin()
+{
+ NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidBegin();
+}
+
+void PageClientImpl::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ NavigationState::fromWebPage(*m_webView->_page).navigationGestureWillEnd(willNavigate, item);
+}
+
+void PageClientImpl::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item)
+{
+ NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidEnd(willNavigate, item);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (171033 => 171034)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-07-12 22:39:43 UTC (rev 171033)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-07-12 23:32:39 UTC (rev 171034)
</span><span class="lines">@@ -496,6 +496,8 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_currentSwipeLiveLayers.isEmpty());
</span><span class="cx">
</span><ins>+ m_webPageProxy.navigationGestureDidBegin();
+
</ins><span class="cx"> m_activeGestureType = ViewGestureType::Swipe;
</span><span class="cx">
</span><span class="cx"> CALayer *rootContentLayer = m_webPageProxy.acceleratedCompositingRootLayer();
</span><span class="lines">@@ -626,6 +628,7 @@
</span><span class="cx">
</span><span class="cx"> if (cancelled) {
</span><span class="cx"> removeSwipeSnapshot();
</span><ins>+ m_webPageProxy.navigationGestureDidEnd(false, *targetItem);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -639,6 +642,7 @@
</span><span class="cx"> // like we normally would when going back or forward, because we are
</span><span class="cx"> // displaying the destination item's snapshot.
</span><span class="cx"> ViewSnapshotStore::shared().disableSnapshotting();
</span><ins>+ m_webPageProxy.navigationGestureDidEnd(true, *targetItem);
</ins><span class="cx"> m_webPageProxy.goToBackForwardItem(targetItem);
</span><span class="cx"> ViewSnapshotStore::shared().enableSnapshotting();
</span><span class="cx">
</span><span class="lines">@@ -685,6 +689,8 @@
</span><span class="cx"> m_currentSwipeLiveLayers.clear();
</span><span class="cx">
</span><span class="cx"> m_activeGestureType = ViewGestureType::None;
</span><ins>+
+ m_webPageProxy.navigationGestureSnapshotWasRemoved();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ViewGestureController::endActiveGesture()
</span></span></pre>
</div>
</div>
</body>
</html>