REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 23:38:19 +0000 (23:38 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 23:38:19 +0000 (23:38 +0000)
​https://bugs.webkit.org/show_bug.cgi?id=138960
<rdar://problem/19056715>

Reviewed by Anders Carlsson.

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _defaultMenuItemsForDataDetectedText]):
(-[WKActionMenuController _defaultMenuItemsForMailtoLink]): Deleted.
* WebView/WebActionMenuController.mm:
(-[WebActionMenuController _defaultMenuItemsForMailtoLink]):
(-[WebActionMenuController _defaultMenuItemsForDataDetectedText]):
Use DataDetectors SPI instead of an explicit blacklist.

* platform/spi/mac/DataDetectorsSPI.h:
Add some DataDetectors SPI.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/spi/mac/DataDetectorsSPI.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebActionMenuController.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WKActionMenuController.mm

index 860685988b97093542eb6251949f5075c6e4a1a7..13ff20cb698861b343f1252a049ac561cbf2f99f 100644 (file)
@@ -1,3 +1,14 @@
+2014-11-21  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able
+        ​https://bugs.webkit.org/show_bug.cgi?id=138960
+        <rdar://problem/19056715>
+
+        Reviewed by Anders Carlsson.
+
+        * platform/spi/mac/DataDetectorsSPI.h:
+        Add some DataDetectors SPI.
+
 2014-11-21  Jer Noble  <jer.noble@apple.com>
 
         [Mac] Random crashes inside media libraries when creating then destroying media quickly.
index c7dceb8c1db988bd141aaf25a5a5d5b7e33fe722..285c7f9101bffc77f85b820b802ecd2a11d2071c 100644 (file)
@@ -67,7 +67,7 @@ SOFT_LINK_CLASS(DataDetectors, DDActionContext)
 @property NSRect highlightFrame;
 @property (retain) NSArray *allResults;
 @property (retain) __attribute__((NSObject)) DDResultRef mainResult;
-@property (assign) BOOL forActionMenuContent;
+@property (assign) BOOL altMode;
 
 - (DDActionContext *)contextForView:(NSView *)view altMode:(BOOL)altMode interactionStartedHandler:(void (^)(void))interactionStartedHandler interactionChangedHandler:(void (^)(void))interactionChangedHandler interactionStoppedHandler:(void (^)(void))interactionStoppedHandler;
 
@@ -86,5 +86,6 @@ SOFT_LINK_CLASS(DataDetectors, DDActionsManager)
 + (BOOL)shouldUseActionsWithContext:(DDActionContext *)context;
 + (void)didUseActions;
 
+- (BOOL)hasActionsForResult:(DDResultRef)result actionContext:(DDActionContext *)actionContext;
 
 @end
index f201e01f424bb22e36c58a73f6e525327caf8aee..7b89ff2241391aa1411b648773961c6b1983a9f9 100644 (file)
@@ -1,3 +1,16 @@
+2014-11-21  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able
+        ​https://bugs.webkit.org/show_bug.cgi?id=138960
+        <rdar://problem/19056715>
+
+        Reviewed by Anders Carlsson.
+
+        * WebView/WebActionMenuController.mm:
+        (-[WebActionMenuController _defaultMenuItemsForMailtoLink]):
+        (-[WebActionMenuController _defaultMenuItemsForDataDetectedText]):
+        Use DataDetectors SPI instead of an explicit blacklist.
+
 2014-11-21  Tim Horton  <timothy_horton@apple.com>
 
         REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able
index 63cad4ee974c0dd82798dec2c529459b44405db9..3fb34d773bce9c9f421ade356a63d9dedd569878 100644 (file)
@@ -309,7 +309,7 @@ static IntRect elementBoundingBoxInWindowCoordinatesFromNode(Node* node)
         return @[ ];
 
     RetainPtr<DDActionContext> actionContext = [[getDDActionContextClass() alloc] init];
-    [actionContext setForActionMenuContent:YES];
+    [actionContext setAltMode:YES];
 
     // FIXME: Should this show a yellow highlight?
     [actionContext setHighlightFrame:elementBoundingBoxInWindowCoordinatesFromNode(node)];
@@ -572,12 +572,11 @@ static NSString *pathToPhotoOnDisk(NSString *suggestedFilename)
     if (!actionContext || !detectedDataRange)
         return @[ ];
 
-    // Blacklist contact results, because they don't have useful menus. If we
-    // bail here, before setting up _currentActionContext, we'll still allow fallthrough
-    // to ordinary text actions, avoiding mysterious failure when a contact is detected.
-    if (CFEqual(DDResultGetType([actionContext mainResult]), CFSTR("Contact")))
-        return @[ ];
-
+    [actionContext setAltMode:YES];
+    if ([[getDDActionsManagerClass() sharedManager] respondsToSelector:@selector(hasActionsForResult:actionContext:)]) {
+        if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:[actionContext mainResult] actionContext:actionContext.get()])
+            return @[ ];
+    }
 
     // FIXME: We should hide/show the yellow highlight here.
     _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
index 06ad70daa0bafe265fd29d7dcfb7251dc0000be1..2e6444ffa4fdc6d7dc7619d8490aa007a3267061 100644 (file)
@@ -1,3 +1,16 @@
+2014-11-21  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able
+        ​https://bugs.webkit.org/show_bug.cgi?id=138960
+        <rdar://problem/19056715>
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]):
+        (-[WKActionMenuController _defaultMenuItemsForMailtoLink]): Deleted.
+        Use DataDetectors SPI instead of an explicit blacklist.
+
 2014-11-21  Tim Horton  <timothy_horton@apple.com>
 
         Crashes while encoding a TextIndicator with no contentImageWithHighlight
index 1192280d48cbd38ca1785bac21f459d5ed6fbb7d..64cb4e0f4acb2f9c522fa5828675797623f18cde 100644 (file)
@@ -635,11 +635,11 @@ static NSString *pathToPhotoOnDisk(NSString *suggestedFilename)
     if (!actionContext)
         return @[ ];
 
-    // Blacklist contact results, because they don't have useful menus. If we
-    // bail here, before setting up _currentActionContext, we'll still allow fallthrough
-    // to ordinary text actions, avoiding mysterious failure when a contact is detected.
-    if (CFEqual(DDResultGetType(actionContext.mainResult), CFSTR("Contact")))
-        return @[ ];
+    actionContext.altMode = YES;
+    if ([[getDDActionsManagerClass() sharedManager] respondsToSelector:@selector(hasActionsForResult:actionContext:)]) {
+        if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:actionContext.mainResult actionContext:actionContext])
+            return @[ ];
+    }
 
     // Ref our WebPageProxy for use in the blocks below.
     RefPtr<WebPageProxy> page = _page;
@@ -755,7 +755,7 @@ static NSString *pathToPhotoOnDisk(NSString *suggestedFilename)
 
     // FIXME: Should this show a yellow highlight?
     RetainPtr<DDActionContext> actionContext = [[getDDActionContextClass() alloc] init];
-    [actionContext setForActionMenuContent:YES];
+    [actionContext setAltMode:YES];
     [actionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:hitTestResult->elementBoundingBox() toView:nil]]];
     return [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:actionContext.get()];
 }