[GTK] Back/forward gesture snapshot always times out
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Apr 2019 19:08:18 +0000 (19:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Apr 2019 19:08:18 +0000 (19:08 +0000)
commite9b8cfd342b684c1ca643bc6c4de9f32c925cda7
treebb2c2a14917cea35fb76baaf5f496bee458ce4ee
parent045323b997a1dc73e67861872a6488031b1d573f
[GTK] Back/forward gesture snapshot always times out
https://bugs.webkit.org/show_bug.cgi?id=197233

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

Delaying web process launch caused a regression where we create ViewGestureController when the
web process doesn't yet exist. The controller immediately tries to connect to it and fails,
and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
snapshot always stays until timeout after performing the gesture.

To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
and immediately apply it when creating the controller.

Since there is now a point where controller is null, make webkitWebViewBaseViewGestureController()
return null and add null checks everywhere.

* UIProcess/API/glib/WebKitWebView.cpp:
(enableBackForwardNavigationGesturesChanged):
Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Add a null check.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseDraw): Ditto.
(webkitWebViewBaseScrollEvent): Ditto.
(webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
for the case ViewGestureController doesn't exist yet.
(webkitWebViewBaseViewGestureController): Return a pointer instead of reference.
(webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
(webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
immediately call setSwipeGestureEnabled() with the stored value.
(webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Add a null check.
(webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):Ditto.
(webkitWebViewBaseDidFinishLoadForMainFrame): Ditto.
(webkitWebViewBaseDidFailLoadForMainFrame): Ditto.
(webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Ditto.
(webkitWebViewBaseDidRestoreScrollPosition): Ditto.
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244744 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h