Unable to commit previews in Mobile Safari
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2016 19:33:22 +0000 (19:33 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Mar 2016 19:33:22 +0000 (19:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155450
-and corresponding-
rdar://problem/25135529

Reviewed by Tim Horton.

_uiDelegateProvidedPreviewingViewController was being consulted before
invoking the old SPI, which was always wrong. It should have been consulted
before calling the new API! But also, it doesn’t seem to be necessary at all
since [WKContentView _previewItemController:commitPreview:] is only invoked
when a custom view controller has been provided.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _registerPreview]):
(-[WKContentView _unregisterPreview]):
(-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
(-[WKContentView _presentedViewControllerForPreviewItemController:]):
(-[WKContentView _previewItemController:commitPreview:]):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

index 2052de6..055cf76 100644 (file)
@@ -1,3 +1,26 @@
+2016-03-14  Beth Dakin  <bdakin@apple.com>
+
+        Unable to commit previews in Mobile Safari
+        https://bugs.webkit.org/show_bug.cgi?id=155450
+        -and corresponding-
+        rdar://problem/25135529
+
+        Reviewed by Tim Horton.
+
+        _uiDelegateProvidedPreviewingViewController was being consulted before 
+        invoking the old SPI, which was always wrong. It should have been consulted 
+        before calling the new API! But also, it doesn’t seem to be necessary at all 
+        since [WKContentView _previewItemController:commitPreview:] is only invoked 
+        when a custom view controller has been provided.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _registerPreview]):
+        (-[WKContentView _unregisterPreview]):
+        (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
+        (-[WKContentView _presentedViewControllerForPreviewItemController:]):
+        (-[WKContentView _previewItemController:commitPreview:]):
+
 2016-03-14  Brent Fulgham  <bfulgham@apple.com>
 
         PingHandle delete's itself but pointer is still used by handleDataURL
index d778cbb..74a6a1a 100644 (file)
@@ -123,7 +123,6 @@ struct WKAutoCorrectionData {
     RetainPtr<UIGestureRecognizer> _previewSecondaryGestureRecognizer;
 #if HAVE(LINK_PREVIEW)
     RetainPtr<UIPreviewItemController> _previewItemController;
-    BOOL _uiDelegateProvidedPreviewingViewController;
 #endif
 
     std::unique_ptr<WebKit::SmartMagnificationController> _smartMagnificationController;
index 28a6522..977a971 100644 (file)
@@ -3779,7 +3779,6 @@ static bool isAssistableInputType(InputType type)
     _previewGestureRecognizer = _previewItemController.get().presentationGestureRecognizer;
     if ([_previewItemController respondsToSelector:@selector(presentationSecondaryGestureRecognizer)])
         _previewSecondaryGestureRecognizer = _previewItemController.get().presentationSecondaryGestureRecognizer;
-    _uiDelegateProvidedPreviewingViewController = NO;
 }
 
 - (void)_unregisterPreview
@@ -3788,7 +3787,6 @@ static bool isAssistableInputType(InputType type)
     _previewGestureRecognizer = nil;
     _previewSecondaryGestureRecognizer = nil;
     _previewItemController = nil;
-    _uiDelegateProvidedPreviewingViewController = NO;
 }
 
 - (BOOL)_interactionShouldBeginFromPreviewItemController:(UIPreviewItemController *)controller forPosition:(CGPoint)position
@@ -3954,10 +3952,8 @@ static NSString *previewIdentifierForElementAction(_WKElementAction *action)
                 [previewActions addObject:previewAction];
             }
             auto previewElementInfo = adoptNS([[WKPreviewElementInfo alloc] _initWithLinkURL:targetURL]);
-            if (UIViewController *controller = [uiDelegate webView:_webView previewingViewControllerForElement:previewElementInfo.get() defaultActions:previewActions.get()]) {
-                _uiDelegateProvidedPreviewingViewController = YES;
+            if (UIViewController *controller = [uiDelegate webView:_webView previewingViewControllerForElement:previewElementInfo.get() defaultActions:previewActions.get()])
                 return controller;
-            }
         }
 
         if ([uiDelegate respondsToSelector:@selector(_webView:previewViewControllerForURL:defaultActions:elementInfo:)])
@@ -4002,7 +3998,7 @@ static NSString *previewIdentifierForElementAction(_WKElementAction *action)
         return;
     }
 
-    if (_uiDelegateProvidedPreviewingViewController && [uiDelegate respondsToSelector:@selector(_webView:commitPreviewedViewController:)]) {
+    if ([uiDelegate respondsToSelector:@selector(_webView:commitPreviewedViewController:)]) {
         [uiDelegate _webView:_webView commitPreviewedViewController:viewController];
         return;
     }