Changeset 261478 in webkit


Ignore:
Timestamp:
May 11, 2020, 7:59:28 AM (5 years ago)
Author:
Wenson Hsieh
Message:

Unreviewed, fix the watchOS build after r261457

Put -[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:] behind a USE(UICONTEXTMENU)
compiler guard; currently, it is declared everywhere, but only implemented if ENABLE(DATA_DETECTION) &&
USE(UICONTEXTMENU). However, WKContentView only invokes it behind code that is guarded by USE(UICONTEXTMENU).

  • UIProcess/ios/WKActionSheetAssistant.h:
  • UIProcess/ios/WKActionSheetAssistant.mm:

(-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]):

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r261473 r261478  
     12020-05-11  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Unreviewed, fix the watchOS build after r261457
     4
     5        Put -[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:] behind a USE(UICONTEXTMENU)
     6        compiler guard; currently, it is declared everywhere, but only implemented if ENABLE(DATA_DETECTION) &&
     7        USE(UICONTEXTMENU). However, WKContentView only invokes it behind code that is guarded by USE(UICONTEXTMENU).
     8
     9        * UIProcess/ios/WKActionSheetAssistant.h:
     10        * UIProcess/ios/WKActionSheetAssistant.mm:
     11        (-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]):
     12
    1132020-05-11  Philippe Normand  <pnormand@igalia.com>
    214
  • trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h

    r261457 r261478  
    9191- (void)interactionDidStartWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)information;
    9292- (NSArray *)currentAvailableActionTitles;
     93#if USE(UICONTEXTMENU)
    9394- (NSArray<UIMenuElement *> *)suggestedActionsForContextMenuWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation;
     95#endif
    9496@end
    9597
  • trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm

    r261457 r261478  
    721721}
    722722
    723 #if USE(UICONTEXTMENU) && ENABLE(DATA_DETECTION)
     723#if USE(UICONTEXTMENU)
     724
     725static NSArray<UIMenuElement *> *menuElementsFromDefaultActions(RetainPtr<NSArray> defaultElementActions, RetainPtr<_WKActivatedElementInfo> elementInfo)
     726{
     727    if (![defaultElementActions count])
     728        return nil;
     729
     730    auto actions = [NSMutableArray arrayWithCapacity:[defaultElementActions count]];
     731    for (_WKElementAction *elementAction in defaultElementActions.get())
     732        [actions addObject:[elementAction uiActionForElementInfo:elementInfo.get()]];
     733
     734    return actions;
     735}
     736
     737- (NSArray<UIMenuElement *> *)suggestedActionsForContextMenuWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
     738{
     739    auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:positionInformation userInfo:nil]);
     740    RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = positionInformation.isLink ? [self defaultActionsForLinkSheet:elementInfo.get()] : [self defaultActionsForImageSheet:elementInfo.get()];
     741    return menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
     742}
     743
     744#if ENABLE(DATA_DETECTION)
     745
    724746- (UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction configurationForMenuAtLocation:(CGPoint)location
    725747{
     
    778800}
    779801
    780 static NSArray<UIMenuElement *> *menuElementsFromDefaultActions(RetainPtr<NSArray> defaultElementActions, RetainPtr<_WKActivatedElementInfo> elementInfo)
    781 {
    782     if (![defaultElementActions count])
    783         return nil;
    784 
    785     auto actions = [NSMutableArray arrayWithCapacity:[defaultElementActions count]];
    786     for (_WKElementAction *elementAction in defaultElementActions.get())
    787         [actions addObject:[elementAction uiActionForElementInfo:elementInfo.get()]];
    788 
    789     return actions;
    790 }
    791 
    792802- (NSArray<UIMenuElement *> *)_contextMenuInteraction:(UIContextMenuInteraction *)interaction overrideSuggestedActionsForConfiguration:(UIContextMenuConfiguration *)configuration
    793803{
     
    797807}
    798808
    799 - (NSArray<UIMenuElement *> *)suggestedActionsForContextMenuWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)positionInformation
    800 {
    801     auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:positionInformation userInfo:nil]);
    802     RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = positionInformation.isLink ? [self defaultActionsForLinkSheet:elementInfo.get()] : [self defaultActionsForImageSheet:elementInfo.get()];
    803     return menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
    804 
    805 }
    806 
    807 #endif
     809#endif // ENABLE(DATA_DETECTION)
     810
     811#endif // USE(UICONTEXTMENU)
    808812
    809813- (void)cleanupSheet
Note: See TracChangeset for help on using the changeset viewer.