Remove pre-[DDActionContext contextForView:...] fallback path
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Nov 2014 01:58:52 +0000 (01:58 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Nov 2014 01:58:52 +0000 (01:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138735
<rdar://problem/18982046>

Reviewed by Simon Fraser.

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController willOpenMenu:withEvent:]):
(-[WKActionMenuController didCloseMenu:withEvent:]):
(-[WKActionMenuController _defaultMenuItemsForDataDetectedText]):
(hasDataDetectorsCompletionAPI): Deleted.
Remove the now-unnecessary fallback path.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WKActionMenuController.mm

index 91f9ba95d7b6e0c65c679920ceb756b985c54cf1..9598e53610b1628453b7f46feb2a467c2b3de128 100644 (file)
@@ -1,3 +1,18 @@
+2014-11-14  Tim Horton  <timothy_horton@apple.com>
+
+        Remove pre-[DDActionContext contextForView:...] fallback path
+        https://bugs.webkit.org/show_bug.cgi?id=138735
+        <rdar://problem/18982046>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController willOpenMenu:withEvent:]):
+        (-[WKActionMenuController didCloseMenu:withEvent:]):
+        (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]):
+        (hasDataDetectorsCompletionAPI): Deleted.
+        Remove the now-unnecessary fallback path.
+
 2014-11-14  Tim Horton  <timothy_horton@apple.com>
 
         Frequent crashes under actionContextForResultAtPoint
index 96ea400db79388e84c936de62b1d13bbe6d392d9..2382749234c5a28f555e4a1da4cf9f1c35eef5a4 100644 (file)
 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit)
 SOFT_LINK_CLASS(ImageKit, IKSlideshow)
 
-static bool hasDataDetectorsCompletionAPI() {
-    static bool hasCompletionAPI;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        hasCompletionAPI = [getDDActionsManagerClass() respondsToSelector:@selector(shouldUseActionsWithContext:)] && [getDDActionsManagerClass() respondsToSelector:@selector(didUseActions)];
-    });
-    return hasCompletionAPI;
-}
-
 using namespace WebCore;
 using namespace WebKit;
 
@@ -201,17 +192,13 @@ using namespace WebKit;
         return;
 
     if (_type == kWKActionMenuDataDetectedItem) {
-        if (_currentActionContext && hasDataDetectorsCompletionAPI()) {
-            if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
-                [menu cancelTracking];
-                return;
-            }
+        if (_currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
+            [menu cancelTracking];
+            return;
         }
-        if (menu.numberOfItems == 1) {
+        if (menu.numberOfItems == 1)
             _page->clearSelection();
-            if (!hasDataDetectorsCompletionAPI())
-                [self _showTextIndicator];
-        } else
+        else
             _page->selectLastActionMenuRange();
         return;
     }
@@ -234,13 +221,8 @@ using namespace WebKit;
         return;
 
     if (_type == kWKActionMenuDataDetectedItem) {
-        if (hasDataDetectorsCompletionAPI()) {
-            if (_currentActionContext)
-                [getDDActionsManagerClass() didUseActions];
-        } else {
-            if (menu.numberOfItems > 1)
-                [self _hideTextIndicator];
-        }
+        if (_currentActionContext)
+            [getDDActionsManagerClass() didUseActions];
     }
 
     if (!_shouldKeepPreviewPopoverOpen)
@@ -588,27 +570,17 @@ static NSString *pathToPhotoOnDisk(NSString *suggestedFilename)
     if (!actionContext)
         return @[ ];
 
-    if (hasDataDetectorsCompletionAPI()) {
-        // Ref our WebPageProxy for use in the blocks below.
-        RefPtr<WebPageProxy> page = _page;
-        _currentActionContext = [actionContext contextForView:_wkView altMode:YES interactionStartedHandler:^() {
-            page->send(Messages::WebPage::DataDetectorsDidPresentUI());
-        } interactionChangedHandler:^() {
-            [self _showTextIndicator];
-            page->send(Messages::WebPage::DataDetectorsDidChangeUI());
-        } interactionStoppedHandler:^() {
-            [self _hideTextIndicator];
-            page->send(Messages::WebPage::DataDetectorsDidHideUI());
-        }];
-    } else {
-        _currentActionContext = actionContext;
-
-        [_currentActionContext setCompletionHandler:^() {
-            [self _hideTextIndicator];
-        }];
-
-        [_currentActionContext setForActionMenuContent:YES];
-    }
+    // Ref our WebPageProxy for use in the blocks below.
+    RefPtr<WebPageProxy> page = _page;
+    _currentActionContext = [actionContext contextForView:_wkView altMode:YES interactionStartedHandler:^() {
+        page->send(Messages::WebPage::DataDetectorsDidPresentUI());
+    } interactionChangedHandler:^() {
+        [self _showTextIndicator];
+        page->send(Messages::WebPage::DataDetectorsDidChangeUI());
+    } interactionStoppedHandler:^() {
+        [self _hideTextIndicator];
+        page->send(Messages::WebPage::DataDetectorsDidHideUI());
+    }];
 
     [_currentActionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:_hitTestResult.detectedDataBoundingBox toView:nil]]];