⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 175992 in webkit


Ignore:
Timestamp:
Nov 11, 2014, 4:59:54 PM (12 years ago)
Author:
timothy_horton@apple.com
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.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r175981 r175992  
     12014-11-11  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add support for mailto: link action menus
     4        https://bugs.webkit.org/show_bug.cgi?id=138641
     5        <rdar://problem/18741567>
     6
     7        Reviewed by Beth Dakin.
     8
     9        * WebCore.exp.in:
     10        Add an export.
     11
     12        * platform/spi/mac/DataDetectorsSPI.h:
     13        Add some DataDetectors SPI.
     14
    1152014-11-11  Eric Carlson  <eric.carlson@apple.com>
    216
  • trunk/Source/WebCore/WebCore.exp.in

    r175972 r175992  
    126126__ZN7WebCore10deleteFileERKN3WTF6StringE
    127127__ZN7WebCore10fileExistsERKN3WTF6StringE
     128__ZN7WebCore10protocolIsERKN3WTF6StringEPKc
    128129__ZN7WebCore10setCookiesEPNS_8DocumentERKNS_3URLERKN3WTF6StringE
    129130__ZN7WebCore11BitmapImage13getCGImageRefEv
  • trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h

    r175964 r175992  
    7676+ (DDActionsManager *)sharedManager;
    7777- (NSArray *)menuItemsForResult:(DDResultRef)result actionContext:(DDActionContext *)context;
     78- (NSArray *)menuItemsForTargetURL:(NSString *)targetURL actionContext:(DDActionContext *)context;
    7879- (void)requestBubbleClosureUnanchorOnFailure:(BOOL)unanchorOnFailure;
    7980
  • trunk/Source/WebKit2/ChangeLog

    r175985 r175992  
     12014-11-11  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add support for mailto: link action menus
     4        https://bugs.webkit.org/show_bug.cgi?id=138641
     5        <rdar://problem/18741567>
     6
     7        Reviewed by Beth Dakin.
     8
     9        * Shared/API/c/WKActionMenuTypes.h:
     10        Add a new type for mailto links.
     11
     12        * UIProcess/mac/WKActionMenuController.mm:
     13        (-[WKActionMenuController _defaultMenuItemsForMailtoLink]):
     14        Build a DDActionContext and grab menu items for our mailto link.
     15
     16        (-[WKActionMenuController _defaultMenuItems]):
     17        Get menu items from _defaultMenuItemsForMailtoLink if needed.
     18
    1192014-11-11  Conrad Shultz  <conrad_shultz@apple.com>
    220
  • trunk/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h

    r175779 r175992  
    4242    kWKActionMenuEditableTextWithSuggestions,
    4343    kWKActionMenuWhitespaceInEditableArea,
    44     kWKActionMenuVideo
     44    kWKActionMenuVideo,
     45    kWKActionMenuMailtoLink
    4546};
    4647typedef uint32_t _WKActionMenuType;
  • trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm

    r175985 r175992  
    658658}
    659659
     660#pragma mark Mailto Link actions
     661
     662- (NSArray *)_defaultMenuItemsForMailtoLink
     663{
     664    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
     665
     666    RetainPtr<DDActionContext> actionContext = [[getDDActionContextClass() alloc] init];
     667    [actionContext setForActionMenuContent:YES];
     668    [actionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:hitTestResult->elementBoundingBox() toView:nil]]];
     669    return [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:actionContext.get()];
     670}
     671
    660672#pragma mark NSMenuDelegate implementation
    661673
     
    845857
    846858    String absoluteLinkURL = hitTestResult->absoluteLinkURL();
    847     if (!absoluteLinkURL.isEmpty() && WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
    848         _type = kWKActionMenuLink;
    849         return [self _defaultMenuItemsForLink];
     859    if (!absoluteLinkURL.isEmpty()) {
     860        if (WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
     861            _type = kWKActionMenuLink;
     862            return [self _defaultMenuItemsForLink];
     863        }
     864
     865        if (protocolIs(absoluteLinkURL, "mailto")) {
     866            _type = kWKActionMenuMailtoLink;
     867            return [self _defaultMenuItemsForMailtoLink];
     868        }
    850869    }
    851870
Note: See TracChangeset for help on using the changeset viewer.