Add navigation gesture callbacks to WKPageNavigationClient
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Aug 2015 18:37:50 +0000 (18:37 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Aug 2015 18:37:50 +0000 (18:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148568
<rdar://problem/22371346>

Reviewed by Anders Carlsson.

* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::didBeginNavigationGesture):
(API::NavigationClient::willEndNavigationGesture):
(API::NavigationClient::didEndNavigationGesture):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/API/C/WKPageNavigationClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::navigationGestureDidBegin):
(WebKit::WebPageProxy::navigationGestureWillEnd):
(WebKit::WebPageProxy::navigationGestureDidEnd):

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):
Add some zeroes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189109 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/APINavigationClient.h
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp

index 6f34ed4..d72d314 100644 (file)
@@ -1,5 +1,25 @@
 2015-08-28  Timothy Horton  <timothy_horton@apple.com>
 
+        Add navigation gesture callbacks to WKPageNavigationClient
+        https://bugs.webkit.org/show_bug.cgi?id=148568
+        <rdar://problem/22371346>
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/APINavigationClient.h:
+        (API::NavigationClient::didBeginNavigationGesture):
+        (API::NavigationClient::willEndNavigationGesture):
+        (API::NavigationClient::didEndNavigationGesture):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageNavigationClient):
+        * UIProcess/API/C/WKPageNavigationClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::navigationGestureDidBegin):
+        (WebKit::WebPageProxy::navigationGestureWillEnd):
+        (WebKit::WebPageProxy::navigationGestureDidEnd):
+
+2015-08-28  Timothy Horton  <timothy_horton@apple.com>
+
         Get rid of the DynamicSizeWithMinimumViewSize layout mode
         https://bugs.webkit.org/show_bug.cgi?id=148554
 
index 41253c6..643f87b 100644 (file)
@@ -107,6 +107,10 @@ public:
         return currentPluginLoadPolicy;
     }
 #endif
+
+    virtual void didBeginNavigationGesture(WebKit::WebPageProxy&) { }
+    virtual void willEndNavigationGesture(WebKit::WebPageProxy&, bool willNavigate, WebKit::WebBackForwardListItem&) { }
+    virtual void didEndNavigationGesture(WebKit::WebPageProxy&, bool willNavigate, WebKit::WebBackForwardListItem&) { }
 };
 
 } // namespace API
index 49862f8..83bdc30 100644 (file)
@@ -2102,6 +2102,27 @@ void WKPageSetPageNavigationClient(WKPageRef pageRef, const WKPageNavigationClie
                 return nullptr;
             return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(&page), m_client.base.clientInfo)));
         }
+
+        virtual void didBeginNavigationGesture(WebPageProxy& page) override
+        {
+            if (!m_client.didBeginNavigationGesture)
+                return;
+            m_client.didBeginNavigationGesture(toAPI(&page), m_client.base.clientInfo);
+        }
+
+        virtual void didEndNavigationGesture(WebPageProxy& page, bool willNavigate, WebKit::WebBackForwardListItem& item) override
+        {
+            if (!m_client.didEndNavigationGesture)
+                return;
+            m_client.didEndNavigationGesture(toAPI(&page), willNavigate ? toAPI(&item) : nullptr, m_client.base.clientInfo);
+        }
+
+        virtual void willEndNavigationGesture(WebPageProxy& page, bool willNavigate, WebKit::WebBackForwardListItem& item) override
+        {
+            if (!m_client.willEndNavigationGesture)
+                return;
+            m_client.willEndNavigationGesture(toAPI(&page), willNavigate ? toAPI(&item) : nullptr, m_client.base.clientInfo);
+        }
         
 #if ENABLE(NETSCAPE_PLUGIN_API)
         virtual PluginModuleLoadPolicy decidePolicyForPluginLoad(WebPageProxy& page, PluginModuleLoadPolicy currentPluginLoadPolicy, API::Dictionary* pluginInformation, String& unavailabilityDescription) override
index cb9b2f5..7178815 100644 (file)
@@ -69,6 +69,12 @@ typedef WKDataRef (*WKPageNavigationCopyWebCryptoMasterKeyCallback)(WKPageRef pa
     
 typedef WKPluginLoadPolicy (*WKPageNavigationDecidePolicyForPluginLoadCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo);
 
+typedef void (*WKPageNavigationDidBeginNavigationGesture)(WKPageRef page, const void* clientInfo);
+
+typedef void (*WKPageNavigationWillEndNavigationGesture)(WKPageRef page, WKBackForwardListItemRef backForwardListItem, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidEndNavigationGesture)(WKPageRef page, WKBackForwardListItemRef backForwardListItem, const void* clientInfo);
+
 typedef struct WKPageNavigationClientBase {
     int version;
     const void* clientInfo;
@@ -95,8 +101,11 @@ typedef struct WKPageNavigationClientV0 {
     WKPageNavigationDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge;
     WKPageNavigationWebProcessDidCrashCallback webProcessDidCrash;
     WKPageNavigationCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey;
-} WKPageNavigationClientV0;
 
+    WKPageNavigationDidBeginNavigationGesture didBeginNavigationGesture;
+    WKPageNavigationWillEndNavigationGesture willEndNavigationGesture;
+    WKPageNavigationDidEndNavigationGesture didEndNavigationGesture;
+} WKPageNavigationClientV0;
 
 #ifdef __cplusplus
 }
index e041d93..68a6d64 100644 (file)
@@ -5873,7 +5873,11 @@ void WebPageProxy::navigationGestureDidBegin()
 
     m_isShowingNavigationGestureSnapshot = true;
     m_pageClient.navigationGestureDidBegin();
-    m_loaderClient->navigationGestureDidBegin(*this);
+
+    if (m_navigationClient)
+        m_navigationClient->didBeginNavigationGesture(*this);
+    else
+        m_loaderClient->navigationGestureDidBegin(*this);
 }
 
 void WebPageProxy::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item)
@@ -5881,7 +5885,11 @@ void WebPageProxy::navigationGestureWillEnd(bool willNavigate, WebBackForwardLis
     PageClientProtector protector(m_pageClient);
 
     m_pageClient.navigationGestureWillEnd(willNavigate, item);
-    m_loaderClient->navigationGestureWillEnd(*this, willNavigate, item);
+
+    if (m_navigationClient)
+        m_navigationClient->willEndNavigationGesture(*this, willNavigate, item);
+    else
+        m_loaderClient->navigationGestureWillEnd(*this, willNavigate, item);
 }
 
 void WebPageProxy::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item)
@@ -5889,7 +5897,10 @@ void WebPageProxy::navigationGestureDidEnd(bool willNavigate, WebBackForwardList
     PageClientProtector protector(m_pageClient);
 
     m_pageClient.navigationGestureDidEnd(willNavigate, item);
-    m_loaderClient->navigationGestureDidEnd(*this, willNavigate, item);
+    if (m_navigationClient)
+        m_navigationClient->didEndNavigationGesture(*this, willNavigate, item);
+    else
+        m_loaderClient->navigationGestureDidEnd(*this, willNavigate, item);
 }
 
 void WebPageProxy::navigationGestureDidEnd()
index 5922b22..81c14db 100644 (file)
@@ -1,3 +1,16 @@
+2015-08-28  Tim Horton  <timothy_horton@apple.com>
+
+        Add navigation gesture callbacks to WKPageNavigationClient
+        https://bugs.webkit.org/show_bug.cgi?id=148568
+        <rdar://problem/22371346>
+
+        Reviewed by Anders Carlsson.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::createWebViewWithOptions):
+        Add some zeroes.
+
 2015-08-28  Alexey Proskuryakov  <ap@apple.com>
 
         [Mac] kill-old-processes should kill more processes
index dda75b9..c822c79 100644 (file)
@@ -291,6 +291,9 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKPageConfiguration
         didReceiveAuthenticationChallenge,
         processDidCrash,
         copyWebCryptoMasterKey,
+        0, // didBeginNavigationGesture
+        0, // willEndNavigationGesture
+        0, // didEndNavigationGesture
     };
     WKPageSetPageNavigationClient(newPage, &pageNavigationClient.base);
 
@@ -532,6 +535,9 @@ void TestController::createWebViewWithOptions(const ViewOptions& options)
         didReceiveAuthenticationChallenge,
         processDidCrash,
         copyWebCryptoMasterKey,
+        0, // didBeginNavigationGesture
+        0, // willEndNavigationGesture
+        0, // didEndNavigationGesture
     };
     WKPageSetPageNavigationClient(m_mainWebView->page(), &pageNavigationClient.base);