Changeset 290103 in webkit


Ignore:
Timestamp:
Feb 17, 2022, 6:31:16 PM (4 years ago)
Author:
Kate Cheney
Message:

Refactor share menu item presentation
https://bugs.webkit.org/show_bug.cgi?id=236806
<rdar://problem/88858606>

Reviewed by Aditya Keerthi.

Source/WebCore:

  • page/ContextMenuController.cpp:

(WebCore::ContextMenuController::populate):

Source/WebCore/PAL:

  • pal/spi/mac/NSSharingServicePickerSPI.h:

Source/WebKit:

  • UIProcess/mac/WebContextMenuProxyMac.mm:

(WebKit::WebContextMenuProxyMac::setupServicesMenu):
(WebKit::WebContextMenuProxyMac::getShareMenuItem):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r290098 r290103  
     12022-02-17  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        Refactor share menu item presentation
     4        https://bugs.webkit.org/show_bug.cgi?id=236806
     5        <rdar://problem/88858606>
     6
     7        Reviewed by Aditya Keerthi.
     8
     9        * page/ContextMenuController.cpp:
     10        (WebCore::ContextMenuController::populate):
     11
    1122022-02-17  Aditya Keerthi  <akeerthi@apple.com>
    213
  • trunk/Source/WebCore/PAL/ChangeLog

    r290076 r290103  
     12022-02-17  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        Refactor share menu item presentation
     4        https://bugs.webkit.org/show_bug.cgi?id=236806
     5        <rdar://problem/88858606>
     6
     7        Reviewed by Aditya Keerthi.
     8
     9        * pal/spi/mac/NSSharingServicePickerSPI.h:
     10
    1112022-02-17  Jer Noble  <jer.noble@apple.com>
    212
  • trunk/Source/WebCore/PAL/pal/spi/mac/NSSharingServicePickerSPI.h

    r261921 r290103  
    2828#import <AppKit/NSSharingService_Private.h>
    2929
     30@interface NSSharingServicePicker (Staging_r88855017)
     31- (NSMenuItem *)standardShareMenuItem;
     32@end
     33
    3034#else
    3135
     
    4145@interface NSSharingServicePicker (Private)
    4246@property NSSharingServicePickerStyle style;
     47- (NSMenuItem *)standardShareMenuItem;
    4348- (NSMenu *)menu;
    4449- (void)getMenuWithCompletion:(void(^)(NSMenu *))completion;
  • trunk/Source/WebCore/page/ContextMenuController.cpp

    r289851 r290103  
    841841    ContextMenuItem ShareMenuItem;
    842842#else
    843     ContextMenuItem ShareMenuItem(SubmenuType, ContextMenuItemTagShareMenu, emptyString());
     843    ContextMenuItem ShareMenuItem(ActionType, ContextMenuItemTagShareMenu, emptyString());
    844844#endif
    845845
  • trunk/Source/WebKit/ChangeLog

    r290098 r290103  
     12022-02-17  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        Refactor share menu item presentation
     4        https://bugs.webkit.org/show_bug.cgi?id=236806
     5        <rdar://problem/88858606>
     6
     7        Reviewed by Aditya Keerthi.
     8
     9        * UIProcess/mac/WebContextMenuProxyMac.mm:
     10        (WebKit::WebContextMenuProxyMac::setupServicesMenu):
     11        (WebKit::WebContextMenuProxyMac::getShareMenuItem):
     12
    1132022-02-17  Aditya Keerthi  <akeerthi@apple.com>
    214
  • trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm

    r289908 r290103  
    259259    [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setAttachmentID:m_context.controlledImageAttachmentID()];
    260260
    261     m_menu = adoptNS([[picker menu] copy]);
     261    if ([picker respondsToSelector:@selector(standardShareMenuItem)])
     262        m_menu = adoptNS([[[picker standardShareMenuItem] menu] copy]);
     263    else
     264        m_menu = adoptNS([[picker menu] copy]);
    262265
    263266    if (!hasControlledImage)
     
    406409    }
    407410
     411    auto sharingServicePicker = adoptNS([[NSSharingServicePicker alloc] initWithItems:items.get()]);
     412    if ([sharingServicePicker respondsToSelector:@selector(standardShareMenuItem)]) {
     413        NSMenuItem *shareMenuItem = [sharingServicePicker standardShareMenuItem];
     414        shareMenuItem.identifier = _WKMenuItemIdentifierShareMenu;
     415        completionHandler(shareMenuItem);
     416        return;
     417    }
     418
    408419    getStandardShareMenuItem(items.get(), makeBlockPtr([completionHandler = WTFMove(completionHandler), protectedThis = Ref { *this }, this](NSMenuItem *item) mutable {
    409420        if (!item) {
Note: See TracChangeset for help on using the changeset viewer.