Title: [189274] trunk
Revision
189274
Author
[email protected]
Date
2015-09-02 22:51:22 -0700 (Wed, 02 Sep 2015)

Log Message

Add a modern API way to know that the navigation gesture snapshot was removed, for WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=148693

Reviewed by Anders Carlsson.

* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::didRemoveNavigationGestureSnapshot):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/API/C/WKPageNavigationClient.h:
* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::navigationGestureSnapshotWasRemoved):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::navigationGestureDidEnd):
(WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/CoordinatedGraphics/WebView.h:
Add a callback for WKTR when the swipe snapshot is removed.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (189273 => 189274)


--- trunk/Source/WebKit2/ChangeLog	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/ChangeLog	2015-09-03 05:51:22 UTC (rev 189274)
@@ -1,3 +1,36 @@
+2015-09-02  Tim Horton  <[email protected]>
+
+        Add a modern API way to know that the navigation gesture snapshot was removed, for WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=148693
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/APINavigationClient.h:
+        (API::NavigationClient::didRemoveNavigationGestureSnapshot):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageNavigationClient):
+        * UIProcess/API/C/WKPageNavigationClient.h:
+        * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
+        * UIProcess/Cocoa/NavigationState.h:
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::setNavigationDelegate):
+        (WebKit::NavigationState::navigationGestureSnapshotWasRemoved):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::navigationGestureDidEnd):
+        (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
+        * UIProcess/API/gtk/PageClientImpl.h:
+        * UIProcess/CoordinatedGraphics/WebView.h:
+        Add a callback for WKTR when the swipe snapshot is removed.
+
 2015-09-02  Andreas Kling  <[email protected]>
 
         ScrollbarThemes should be returned by reference.

Modified: trunk/Source/WebKit2/UIProcess/API/APINavigationClient.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/API/APINavigationClient.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/API/APINavigationClient.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -111,6 +111,7 @@
     virtual void didBeginNavigationGesture(WebKit::WebPageProxy&) { }
     virtual void willEndNavigationGesture(WebKit::WebPageProxy&, bool willNavigate, WebKit::WebBackForwardListItem&) { }
     virtual void didEndNavigationGesture(WebKit::WebPageProxy&, bool willNavigate, WebKit::WebBackForwardListItem&) { }
+    virtual void didRemoveNavigationGestureSnapshot(WebKit::WebPageProxy&) { }
 };
 
 } // namespace API

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-09-03 05:51:22 UTC (rev 189274)
@@ -2123,6 +2123,13 @@
                 return;
             m_client.willEndNavigationGesture(toAPI(&page), willNavigate ? toAPI(&item) : nullptr, m_client.base.clientInfo);
         }
+
+        virtual void didRemoveNavigationGestureSnapshot(WebPageProxy& page) override
+        {
+            if (!m_client.didRemoveNavigationGestureSnapshot)
+                return;
+            m_client.didRemoveNavigationGestureSnapshot(toAPI(&page), m_client.base.clientInfo);
+        }
         
 #if ENABLE(NETSCAPE_PLUGIN_API)
         virtual PluginModuleLoadPolicy decidePolicyForPluginLoad(WebPageProxy& page, PluginModuleLoadPolicy currentPluginLoadPolicy, API::Dictionary* pluginInformation, String& unavailabilityDescription) override

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -75,6 +75,9 @@
 
 typedef void (*WKPageNavigationDidEndNavigationGesture)(WKPageRef page, WKBackForwardListItemRef backForwardListItem, const void* clientInfo);
 
+typedef void (*WKPageNavigationDidRemoveNavigationGestureSnapshot)(WKPageRef page, const void* clientInfo);
+
+
 typedef struct WKPageNavigationClientBase {
     int version;
     const void* clientInfo;
@@ -105,6 +108,7 @@
     WKPageNavigationDidBeginNavigationGesture didBeginNavigationGesture;
     WKPageNavigationWillEndNavigationGesture willEndNavigationGesture;
     WKPageNavigationDidEndNavigationGesture didEndNavigationGesture;
+    WKPageNavigationDidRemoveNavigationGestureSnapshot didRemoveNavigationGestureSnapshot;
 } WKPageNavigationClientV0;
 
 #ifdef __cplusplus

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -60,6 +60,7 @@
 // Only called if how the gesture will end (with or without navigation) is known before it ends.
 - (void)_webViewWillEndNavigationGesture:(WKWebView *)webView withNavigationToBackForwardListItem:(WKBackForwardListItem *)item;
 - (void)_webView:(WKWebView *)webView willSnapshotBackForwardListItem:(WKBackForwardListItem *)item;
+- (void)_webViewDidRemoveNavigationGestureSnapshot:(WKWebView *)webView;
 
 #if TARGET_OS_IPHONE
 - (void)_webView:(WKWebView *)webView didStartLoadForQuickLookDocumentInMainFrameWithFileName:(NSString *)fileName uti:(NSString *)uti;

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2015-09-03 05:51:22 UTC (rev 189274)
@@ -402,6 +402,10 @@
 {
 }
 
+void PageClientImpl::didRemoveNavigationGestureSnapshot()
+{
+}
+
 void PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame()
 {
 }

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -123,6 +123,7 @@
     virtual void navigationGestureDidEnd(bool, WebBackForwardListItem&) override;
     virtual void navigationGestureDidEnd() override;
     virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
+    virtual void didRemoveNavigationGestureSnapshot() override;
 
     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
     virtual void didFinishLoadForMainFrame() override;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -72,6 +72,7 @@
     void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&);
     void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&);
     void willRecordNavigationSnapshot(WebBackForwardListItem&);
+    void navigationGestureSnapshotWasRemoved();
 
     void didFirstPaint();
 
@@ -172,6 +173,7 @@
         bool webViewWillEndNavigationGestureWithNavigationToBackForwardListItem : 1;
         bool webViewDidEndNavigationGestureWithNavigationToBackForwardListItem : 1;
         bool webViewWillSnapshotBackForwardListItem : 1;
+        bool webViewNavigationGestureSnapshotWasRemoved : 1;
 #if USE(QUICK_LOOK)
         bool webViewDidStartLoadForQuickLookDocumentInMainFrame : 1;
         bool webViewDidFinishLoadForQuickLookDocumentInMainFrame : 1;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2015-09-03 05:51:22 UTC (rev 189274)
@@ -155,6 +155,7 @@
     m_navigationDelegateMethods.webViewWillEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewWillEndNavigationGesture:withNavigationToBackForwardListItem:)];
     m_navigationDelegateMethods.webViewDidEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewDidEndNavigationGesture:withNavigationToBackForwardListItem:)];
     m_navigationDelegateMethods.webViewWillSnapshotBackForwardListItem = [delegate respondsToSelector:@selector(_webView:willSnapshotBackForwardListItem:)];
+    m_navigationDelegateMethods.webViewNavigationGestureSnapshotWasRemoved = [delegate respondsToSelector:@selector(_webViewDidRemoveNavigationGestureSnapshot:)];
 #if USE(QUICK_LOOK)
     m_navigationDelegateMethods.webViewDidStartLoadForQuickLookDocumentInMainFrame = [delegate respondsToSelector:@selector(_webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:)];
     m_navigationDelegateMethods.webViewDidFinishLoadForQuickLookDocumentInMainFrame = [delegate respondsToSelector:@selector(_webView:didFinishLoadForQuickLookDocumentInMainFrame:)];
@@ -224,6 +225,18 @@
     [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webView:m_webView willSnapshotBackForwardListItem:wrapper(item)];
 }
 
+void NavigationState::navigationGestureSnapshotWasRemoved()
+{
+    if (!m_navigationDelegateMethods.webViewNavigationGestureSnapshotWasRemoved)
+        return;
+
+    auto navigationDelegate = m_navigationDelegate.get();
+    if (!navigationDelegate)
+        return;
+
+    [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewDidRemoveNavigationGestureSnapshot:m_webView];
+}
+
 void NavigationState::didFirstPaint()
 {
     if (!m_navigationDelegateMethods.webViewRenderingProgressDidChange)

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -200,11 +200,12 @@
     virtual void beganEnterFullScreen(const WebCore::IntRect&, const WebCore::IntRect&) override { }
     virtual void beganExitFullScreen(const WebCore::IntRect&, const WebCore::IntRect&) override { }
 #endif
-    virtual void navigationGestureDidBegin() override { };
-    virtual void navigationGestureWillEnd(bool, WebBackForwardListItem&) override { };
-    virtual void navigationGestureDidEnd(bool, WebBackForwardListItem&) override { };
-    virtual void navigationGestureDidEnd() override { };
-    virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override { };
+    virtual void navigationGestureDidBegin() override { }
+    virtual void navigationGestureWillEnd(bool, WebBackForwardListItem&) override { }
+    virtual void navigationGestureDidEnd(bool, WebBackForwardListItem&) override { }
+    virtual void navigationGestureDidEnd() override { }
+    virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override { }
+    virtual void didRemoveNavigationGestureSnapshot() override { }
 
     virtual void didChangeBackgroundColor() override { }
     virtual void didFailLoadForMainFrame() override { }

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -321,6 +321,7 @@
     virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) = 0;
     virtual void navigationGestureDidEnd() = 0;
     virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) = 0;
+    virtual void didRemoveNavigationGestureSnapshot() = 0;
 
     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() = 0;
     virtual void didFinishLoadForMainFrame() = 0;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-09-03 05:51:22 UTC (rev 189274)
@@ -5897,6 +5897,7 @@
     PageClientProtector protector(m_pageClient);
 
     m_pageClient.navigationGestureDidEnd(willNavigate, item);
+
     if (m_navigationClient)
         m_navigationClient->didEndNavigationGesture(*this, willNavigate, item);
     else
@@ -5920,6 +5921,11 @@
 void WebPageProxy::navigationGestureSnapshotWasRemoved()
 {
     m_isShowingNavigationGestureSnapshot = false;
+
+    m_pageClient.didRemoveNavigationGestureSnapshot();
+
+    if (m_navigationClient)
+        m_navigationClient->didRemoveNavigationGestureSnapshot(*this);
 }
 
 void WebPageProxy::isPlayingMediaDidChange(MediaProducer::MediaStateFlags state, uint64_t sourceElementID)

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -176,6 +176,7 @@
     virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
     virtual void navigationGestureDidEnd() override;
     virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
+    virtual void didRemoveNavigationGestureSnapshot() override;
 
     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
     virtual void didFinishLoadForMainFrame() override;

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-09-03 05:51:22 UTC (rev 189274)
@@ -704,6 +704,11 @@
     NavigationState::fromWebPage(*m_webView->_page).willRecordNavigationSnapshot(item);
 }
 
+void PageClientImpl::didRemoveNavigationGestureSnapshot()
+{
+    NavigationState::fromWebPage(*m_webView->_page).navigationGestureSnapshotWasRemoved();
+}
+
 void PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame()
 {
 }

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-09-03 05:51:22 UTC (rev 189274)
@@ -188,6 +188,7 @@
     virtual void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
     virtual void navigationGestureDidEnd() override;
     virtual void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
+    virtual void didRemoveNavigationGestureSnapshot() override;
 
     NSView *activeView() const;
     NSWindow *activeWindow() const;

Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (189273 => 189274)


--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-09-03 05:51:22 UTC (rev 189274)
@@ -765,6 +765,14 @@
 #endif
 }
 
+void PageClientImpl::didRemoveNavigationGestureSnapshot()
+{
+#if WK_API_ENABLED
+    if (m_webView)
+        NavigationState::fromWebPage(*m_webView->_page).navigationGestureSnapshotWasRemoved();
+#endif
+}
+
 void PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame()
 {
     [m_wkView _didFirstVisuallyNonEmptyLayoutForMainFrame];

Modified: trunk/Tools/ChangeLog (189273 => 189274)


--- trunk/Tools/ChangeLog	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Tools/ChangeLog	2015-09-03 05:51:22 UTC (rev 189274)
@@ -1,3 +1,14 @@
+2015-09-02  Tim Horton  <[email protected]>
+
+        Add a modern API way to know that the navigation gesture snapshot was removed, for WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=148693
+
+        Reviewed by Anders Carlsson.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::createWebViewWithOptions):
+
 2015-09-02  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r188548): Some tests crash after r188548 because injected bundle messages are received after the test finishes

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (189273 => 189274)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2015-09-03 03:19:18 UTC (rev 189273)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2015-09-03 05:51:22 UTC (rev 189274)
@@ -295,6 +295,7 @@
         0, // didBeginNavigationGesture
         0, // willEndNavigationGesture
         0, // didEndNavigationGesture
+        0, // didRemoveNavigationGestureSnapshot
     };
     WKPageSetPageNavigationClient(newPage, &pageNavigationClient.base);
 
@@ -539,6 +540,7 @@
         0, // didBeginNavigationGesture
         0, // willEndNavigationGesture
         0, // didEndNavigationGesture
+        0, // didRemoveNavigationGestureSnapshot
     };
     WKPageSetPageNavigationClient(m_mainWebView->page(), &pageNavigationClient.base);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to