Title: [175992] trunk/Source
Revision
175992
Author
[email protected]
Date
2014-11-11 16:59:54 -0800 (Tue, 11 Nov 2014)

Log Message

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.

* WebCore.exp.in:
Add an export.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175991 => 175992)


--- trunk/Source/WebCore/ChangeLog	2014-11-12 00:46:41 UTC (rev 175991)
+++ trunk/Source/WebCore/ChangeLog	2014-11-12 00:59:54 UTC (rev 175992)
@@ -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-11  Eric Carlson  <[email protected]>
 
         [iOS] video is sometimes allowed to play from the background

Modified: trunk/Source/WebCore/WebCore.exp.in (175991 => 175992)


--- trunk/Source/WebCore/WebCore.exp.in	2014-11-12 00:46:41 UTC (rev 175991)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-11-12 00:59:54 UTC (rev 175992)
@@ -125,6 +125,7 @@
 __ZN7WebCore10TimeRangesC1Edd
 __ZN7WebCore10deleteFileERKN3WTF6StringE
 __ZN7WebCore10fileExistsERKN3WTF6StringE
+__ZN7WebCore10protocolIsERKN3WTF6StringEPKc
 __ZN7WebCore10setCookiesEPNS_8DocumentERKNS_3URLERKN3WTF6StringE
 __ZN7WebCore11BitmapImage13getCGImageRefEv
 __ZN7WebCore11BitmapImageC1EP7CGImagePNS_13ImageObserverE

Modified: trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h (175991 => 175992)


--- trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h	2014-11-12 00:46:41 UTC (rev 175991)
+++ trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h	2014-11-12 00:59:54 UTC (rev 175992)
@@ -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: trunk/Source/WebKit2/ChangeLog (175991 => 175992)


--- trunk/Source/WebKit2/ChangeLog	2014-11-12 00:46:41 UTC (rev 175991)
+++ trunk/Source/WebKit2/ChangeLog	2014-11-12 00:59:54 UTC (rev 175992)
@@ -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-11  Conrad Shultz  <[email protected]>
 
         Clients should be notified when a page preview finishes

Modified: trunk/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h (175991 => 175992)


--- trunk/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h	2014-11-12 00:46:41 UTC (rev 175991)
+++ trunk/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h	2014-11-12 00:59:54 UTC (rev 175992)
@@ -41,7 +41,8 @@
     kWKActionMenuEditableText,
     kWKActionMenuEditableTextWithSuggestions,
     kWKActionMenuWhitespaceInEditableArea,
-    kWKActionMenuVideo
+    kWKActionMenuVideo,
+    kWKActionMenuMailtoLink
 };
 typedef uint32_t _WKActionMenuType;
 

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (175991 => 175992)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-12 00:46:41 UTC (rev 175991)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-12 00:59:54 UTC (rev 175992)
@@ -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