[GTK] Page blinks after navigation swipe if it triggered PSON
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Jun 2019 17:13:25 +0000 (17:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Jun 2019 17:13:25 +0000 (17:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198996

Patch by Alexander Mikhaylenko <exalm7659@gmail.com> on 2019-06-19
Reviewed by Michael Catanzaro.

Disconnect and then reconnect ViewGestureController during process swap
instead of destroying and re-creating it.

* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::PageClientImpl::processWillSwap): Added.
(WebKit::PageClientImpl::PageClientImpl::processDidExit): Implemented.
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseWillSwapWebProcess): Added.
Disconnect ViewGestureController if it exists.
(webkitWebViewBaseDidExitWebProcess): Added.
Destroy ViewGestureController.
(webkitWebViewBaseDidRelaunchWebProcess):
Reconnect the ViewGestureController if it exists.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
Source/WebKit/UIProcess/API/gtk/PageClientImpl.h
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h

index c4d5b71..564d899 100644 (file)
@@ -1,3 +1,26 @@
+2019-06-19  Alexander Mikhaylenko  <exalm7659@gmail.com>
+
+        [GTK] Page blinks after navigation swipe if it triggered PSON
+        https://bugs.webkit.org/show_bug.cgi?id=198996
+
+        Reviewed by Michael Catanzaro.
+
+        Disconnect and then reconnect ViewGestureController during process swap
+        instead of destroying and re-creating it.
+
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::PageClientImpl::processWillSwap): Added.
+        (WebKit::PageClientImpl::PageClientImpl::processDidExit): Implemented.
+        * UIProcess/API/gtk/PageClientImpl.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseWillSwapWebProcess): Added.
+        Disconnect ViewGestureController if it exists.
+        (webkitWebViewBaseDidExitWebProcess): Added.
+        Destroy ViewGestureController.
+        (webkitWebViewBaseDidRelaunchWebProcess):
+        Reconnect the ViewGestureController if it exists.
+        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
+
 2019-06-19  Takashi Komori  <Takashi.Komori@sony.com>
 
         [Curl] CurlRequestScheduler doesn't terminate worker thread in a certain situation.
index 4979df3..d7f9f99 100644 (file)
@@ -118,9 +118,14 @@ bool PageClientImpl::isViewInWindow()
     return webkitWebViewBaseIsInWindow(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
 }
 
+void PageClientImpl::PageClientImpl::processWillSwap()
+{
+    webkitWebViewBaseWillSwapWebProcess(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
+}
+
 void PageClientImpl::PageClientImpl::processDidExit()
 {
-    notImplemented();
+    webkitWebViewBaseDidExitWebProcess(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
 }
 
 void PageClientImpl::didRelaunchProcess()
index 6abb2d5..9af1e84 100644 (file)
@@ -69,6 +69,7 @@ private:
     bool isViewFocused() override;
     bool isViewVisible() override;
     bool isViewInWindow() override;
+    void processWillSwap() override;
     void processDidExit() override;
     void didRelaunchProcess() override;
     void pageClosed() override;
index 25b937d..77e0414 100644 (file)
@@ -1700,14 +1700,32 @@ bool webkitWebViewBaseMakeGLContextCurrent(WebKitWebViewBase* webkitWebViewBase)
     return webkitWebViewBase->priv->acceleratedBackingStore->makeContextCurrent();
 }
 
+void webkitWebViewBaseWillSwapWebProcess(WebKitWebViewBase* webkitWebViewBase)
+{
+    WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
+
+    if (priv->viewGestureController)
+        priv->viewGestureController->disconnectFromProcess();
+}
+
+void webkitWebViewBaseDidExitWebProcess(WebKitWebViewBase* webkitWebViewBase)
+{
+    webkitWebViewBase->priv->viewGestureController = nullptr;
+}
+
 void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase* webkitWebViewBase)
 {
     // Queue a resize to ensure the new DrawingAreaProxy is resized.
     gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase));
 
     WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
-    priv->viewGestureController = std::make_unique<WebKit::ViewGestureController>(*priv->pageProxy);
-    priv->viewGestureController->setSwipeGestureEnabled(priv->isBackForwardNavigationGestureEnabled);
+
+    if (priv->viewGestureController)
+        priv->viewGestureController->connectToProcess();
+    else {
+        priv->viewGestureController = std::make_unique<WebKit::ViewGestureController>(*priv->pageProxy);
+        priv->viewGestureController->setSwipeGestureEnabled(priv->isBackForwardNavigationGestureEnabled);
+    }
 }
 
 void webkitWebViewBasePageClosed(WebKitWebViewBase* webkitWebViewBase)
index c00e07d..d1a6f02 100644 (file)
@@ -71,6 +71,8 @@ void webkitWebViewBaseEnterAcceleratedCompositingMode(WebKitWebViewBase*, const
 void webkitWebViewBaseUpdateAcceleratedCompositingMode(WebKitWebViewBase*, const WebKit::LayerTreeContext&);
 void webkitWebViewBaseExitAcceleratedCompositingMode(WebKitWebViewBase*);
 bool webkitWebViewBaseMakeGLContextCurrent(WebKitWebViewBase*);
+void webkitWebViewBaseWillSwapWebProcess(WebKitWebViewBase*);
+void webkitWebViewBaseDidExitWebProcess(WebKitWebViewBase*);
 void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase*);
 void webkitWebViewBasePageClosed(WebKitWebViewBase*);