ASSERT(gestureRecognizer == _doubleTapGestureRecognizer) in _doubleTapDidFail:
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Mar 2019 22:03:33 +0000 (22:03 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Mar 2019 22:03:33 +0000 (22:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195857
<rdar://problem/48954679>

Reviewed by Wenson Hsieh.

Reset an existing gesture recognizer before creating a new one.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
(-[WKContentView _setDoubleTapGesturesEnabled:]):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index 158c9bb..f50a784 100644 (file)
@@ -1,3 +1,17 @@
+2019-03-16  Dean Jackson  <dino@apple.com>
+
+        ASSERT(gestureRecognizer == _doubleTapGestureRecognizer) in _doubleTapDidFail:
+        https://bugs.webkit.org/show_bug.cgi?id=195857
+        <rdar://problem/48954679>
+
+        Reviewed by Wenson Hsieh.
+
+        Reset an existing gesture recognizer before creating a new one.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
+        (-[WKContentView _setDoubleTapGesturesEnabled:]):
+
 2019-03-16  Jer Noble  <jer.noble@apple.com>
 
         Add a new MediaCapabilitiesExtensionsEnabled setting
index 30b9600..27d48d4 100644 (file)
@@ -646,6 +646,12 @@ static inline bool hasFocusedElement(WebKit::FocusedElementInformation focusedEl
 
 - (void)_createAndConfigureDoubleTapGestureRecognizer
 {
+    if (_doubleTapGestureRecognizer) {
+        [self removeGestureRecognizer:_doubleTapGestureRecognizer.get()];
+        [_doubleTapGestureRecognizer setDelegate:nil];
+        [_doubleTapGestureRecognizer setGestureFailedTarget:nil action:nil];
+    }
+
     _doubleTapGestureRecognizer = adoptNS([[WKSyntheticTapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognized:)]);
     [_doubleTapGestureRecognizer setGestureFailedTarget:self action:@selector(_doubleTapDidFail:)];
     [_doubleTapGestureRecognizer setNumberOfTapsRequired:2];
@@ -3735,8 +3741,6 @@ static void selectionChangedWithTouch(WKContentView *view, const WebCore::IntPoi
     if (enabled && ![_doubleTapGestureRecognizer isEnabled]) {
         // The first tap recognized after re-enabling double tap gestures will not wait for the
         // second tap before committing. To fix this, we use a new double tap gesture recognizer.
-        [self removeGestureRecognizer:_doubleTapGestureRecognizer.get()];
-        [_doubleTapGestureRecognizer setDelegate:nil];
         [self _createAndConfigureDoubleTapGestureRecognizer];
     }