Title: [176058] branches/safari-600.3-branch/Source

Diff

Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (176057 => 176058)


--- branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-11-13 02:11:23 UTC (rev 176057)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-11-13 02:30:54 UTC (rev 176058)
@@ -1,3 +1,17 @@
+2014-11-11  Tim Horton  <[email protected]>
+
+        Add support for mailto: link action menus
+        https://bugs.webkit.org/show_bug.cgi?id=138641
+        <rdar://problem/18741567>
+
+        Reviewed by Beth Dakin.
+
+        * WebCore.exp.in:
+        Add an export.
+
+        * platform/spi/mac/DataDetectorsSPI.h:
+        Add some DataDetectors SPI.
+
 2014-11-12  Matthew Hanson  <[email protected]>
 
         Merge r175964. <rdar://problem/18867627>

Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (176057 => 176058)


--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in	2014-11-13 02:11:23 UTC (rev 176057)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in	2014-11-13 02:30:54 UTC (rev 176058)
@@ -123,6 +123,7 @@
 __ZN7WebCore10TimeRangesC1Edd
 __ZN7WebCore10deleteFileERKN3WTF6StringE
 __ZN7WebCore10fileExistsERKN3WTF6StringE
+__ZN7WebCore10protocolIsERKN3WTF6StringEPKc
 __ZN7WebCore10setCookiesEPNS_8DocumentERKNS_3URLERKN3WTF6StringE
 __ZN7WebCore10toDocumentEN3JSC7JSValueE
 __ZN7WebCore11BitmapImage13getCGImageRefEv

Modified: branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h (176057 => 176058)


--- branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h	2014-11-13 02:11:23 UTC (rev 176057)
+++ branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h	2014-11-13 02:30:54 UTC (rev 176058)
@@ -75,6 +75,7 @@
 
 + (DDActionsManager *)sharedManager;
 - (NSArray *)menuItemsForResult:(DDResultRef)result actionContext:(DDActionContext *)context;
+- (NSArray *)menuItemsForTargetURL:(NSString *)targetURL actionContext:(DDActionContext *)context;
 - (void)requestBubbleClosureUnanchorOnFailure:(BOOL)unanchorOnFailure;
 
 @end

Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176057 => 176058)


--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-13 02:11:23 UTC (rev 176057)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-13 02:30:54 UTC (rev 176058)
@@ -1,3 +1,21 @@
+2014-11-11  Tim Horton  <[email protected]>
+
+        Add support for mailto: link action menus
+        https://bugs.webkit.org/show_bug.cgi?id=138641
+        <rdar://problem/18741567>
+
+        Reviewed by Beth Dakin.
+
+        * Shared/API/c/WKActionMenuTypes.h:
+        Add a new type for mailto links.
+
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController _defaultMenuItemsForMailtoLink]):
+        Build a DDActionContext and grab menu items for our mailto link.
+
+        (-[WKActionMenuController _defaultMenuItems]):
+        Get menu items from _defaultMenuItemsForMailtoLink if needed.
+
 2014-11-12  Matthew Hanson  <[email protected]>
 
         Merge r175985. <rdar://problem/18947400>

Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h (176057 => 176058)


--- branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h	2014-11-13 02:11:23 UTC (rev 176057)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h	2014-11-13 02:30:54 UTC (rev 176058)
@@ -41,7 +41,8 @@
     kWKActionMenuEditableText,
     kWKActionMenuEditableTextWithSuggestions,
     kWKActionMenuWhitespaceInEditableArea,
-    kWKActionMenuVideo
+    kWKActionMenuVideo,
+    kWKActionMenuMailtoLink
 };
 typedef uint32_t _WKActionMenuType;
 

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176057 => 176058)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-13 02:11:23 UTC (rev 176057)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-13 02:30:54 UTC (rev 176058)
@@ -657,6 +657,18 @@
     return @[ [NSMenuItem separatorItem], [NSMenuItem separatorItem], pasteItem.get() ];
 }
 
+#pragma mark Mailto Link actions
+
+- (NSArray *)_defaultMenuItemsForMailtoLink
+{
+    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
+
+    RetainPtr<DDActionContext> actionContext = [[getDDActionContextClass() alloc] init];
+    [actionContext setForActionMenuContent:YES];
+    [actionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:hitTestResult->elementBoundingBox() toView:nil]]];
+    return [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:actionContext.get()];
+}
+
 #pragma mark NSMenuDelegate implementation
 
 - (void)menuNeedsUpdate:(NSMenu *)menu
@@ -844,9 +856,16 @@
     }
 
     String absoluteLinkURL = hitTestResult->absoluteLinkURL();
-    if (!absoluteLinkURL.isEmpty() && WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
-       _type = kWKActionMenuLink;
-       return [self _defaultMenuItemsForLink];
+    if (!absoluteLinkURL.isEmpty()) {
+        if (WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
+            _type = kWKActionMenuLink;
+            return [self _defaultMenuItemsForLink];
+        }
+
+        if (protocolIs(absoluteLinkURL, "mailto")) {
+            _type = kWKActionMenuMailtoLink;
+            return [self _defaultMenuItemsForMailtoLink];
+        }
     }
 
     if (!hitTestResult->absoluteMediaURL().isEmpty()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to