Swipe snapshot can get stuck if swiping is disabled while it is visible
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Sep 2018 21:59:33 +0000 (21:59 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Sep 2018 21:59:33 +0000 (21:59 +0000)
commit737eafa766836334aedd7cd91b5bd219ea2d32f4
tree53391fc5e9b7ad12d8b736b4a13c682814fc4ea8
parent8b969bb51e1cd1e0c7d1f11527ea16f34a0fb839
Swipe snapshot can get stuck if swiping is disabled while it is visible
https://bugs.webkit.org/show_bug.cgi?id=189667
<rdar://problem/40367780>

Reviewed by Simon Fraser.

If navigation gestures are disabled while a swipe snapshot is visible,
WKWebView will tear down the ViewGestureController, which means that
the SnapshotRemovalTracker will no longer be around to ever remove
the snapshot.

It's currently very hard to write a test for this because we have
yet to come up with a good mechanism for testing swiping on iOS.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView setAllowsBackForwardNavigationGestures:]):
Instead of tearing down the ViewGestureController when navigation
gestures are disabled, just set a bit on it that disables gestures.

* UIProcess/Cocoa/ViewGestureController.cpp:
(WebKit::ViewGestureController::canSwipeInDirection const):
* UIProcess/Cocoa/ViewGestureController.h:
(WebKit::ViewGestureController::setSwipeGestureEnabled):
(WebKit::ViewGestureController::isSwipeGestureEnabled):
Add a bit to ViewGestureController that makes starting new gestures
always fail, but allows e.g. snapshots from existing swipes to continue
their usual behavior.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp
Source/WebKit/UIProcess/Cocoa/ViewGestureController.h