Changeset 258684 in webkit


Ignore:
Timestamp:
Mar 19, 2020 1:14:12 AM (4 years ago)
Author:
Megan Gardner
Message:

Correctly set up context for Data Detectors
https://bugs.webkit.org/show_bug.cgi?id=209258
Source/WebCore/PAL:

Reviewed by Tim Horton.

  • pal/spi/ios/DataDetectorsUISPI.h:

Source/WebKit:

<rdar://problem/60612327>

Reviewed by Tim Horton.

Stop passing in a nil context. This is OK now, but won't be in the near future.
Also, call -updateContext:withSourceRect: so that DataDetectors can populate the context appropriately.

  • UIProcess/ios/WKActionSheetAssistant.mm:

(-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView dataDetectionContextForPositionInformation:]):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/PAL/ChangeLog

    r258682 r258684  
     12020-03-19  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Correctly set up context for Data Detectors
     4        https://bugs.webkit.org/show_bug.cgi?id=209258
     5
     6        Reviewed by Tim Horton.
     7
     8        * pal/spi/ios/DataDetectorsUISPI.h:
     9
    1102020-03-18  Peng Liu  <peng.liu6@apple.com>
    211
  • trunk/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h

    r258102 r258684  
    5353@class UIContextMenuConfiguration;
    5454@interface DDContextMenuAction
     55+ (NSDictionary *)updateContext:(NSDictionary *)context withSourceRect:(CGRect)sourceRect;
    5556+ (UIContextMenuConfiguration *)contextMenuConfigurationForURL:(NSURL *)URL identifier:(NSString *)identifier selectedText:(NSString *)selectedText results:(NSArray *) results inView: (UIView *) view context:(NSDictionary *)context menuIdentifier:(NSString *)menuIdentifier;
    5657+ (UIContextMenuConfiguration *)contextMenuConfigurationWithResult:(DDResultRef)result inView:(UIView *)view context:(NSDictionary *)context menuIdentifier:(NSString *)menuIdentifier;
  • trunk/Source/WebKit/ChangeLog

    r258679 r258684  
     12020-03-19  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Correctly set up context for Data Detectors
     4        https://bugs.webkit.org/show_bug.cgi?id=209258
     5        <rdar://problem/60612327>
     6
     7        Reviewed by Tim Horton.
     8
     9        Stop passing in a nil context. This is OK now, but won't be in the near future.
     10        Also, call -updateContext:withSourceRect: so that DataDetectors can populate the context appropriately.
     11
     12        * UIProcess/ios/WKActionSheetAssistant.mm:
     13        (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
     14        * UIProcess/ios/WKContentViewInteraction.mm:
     15        (-[WKContentView dataDetectionContextForPositionInformation:]):
     16
    1172020-03-18  Simon Fraser  <simon.fraser@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm

    r258183 r258684  
    734734    DDResultRef ddResult = [controller resultForURL:_positionInformation->url identifier:_positionInformation->dataDetectorIdentifier selectedText:textAtSelection results:_positionInformation->dataDetectorResults.get() context:context extendedContext:&newContext];
    735735
     736
     737    CGRect sourceRect;
     738    if (_positionInformation->isLink)
     739        sourceRect = _positionInformation->linkIndicator.textBoundingRectInRootViewCoordinates;
     740    else
     741        sourceRect = _positionInformation->bounds;
     742
    736743    auto ddContextMenuActionClass = getDDContextMenuActionClass();
     744    auto finalContext = [ddContextMenuActionClass updateContext:newContext withSourceRect:sourceRect];
     745
    737746    if (ddResult)
    738         return [ddContextMenuActionClass contextMenuConfigurationWithResult:ddResult inView:_view.getAutoreleased() context:context menuIdentifier:nil];
    739     return [ddContextMenuActionClass contextMenuConfigurationWithURL:_positionInformation->url inView:_view.getAutoreleased() context:context menuIdentifier:nil];
     747        return [ddContextMenuActionClass contextMenuConfigurationWithResult:ddResult inView:_view.getAutoreleased() context:finalContext menuIdentifier:nil];
     748    return [ddContextMenuActionClass contextMenuConfigurationWithURL:_positionInformation->url inView:_view.getAutoreleased() context:finalContext menuIdentifier:nil];
    740749}
    741750
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r258659 r258684  
    67516751
    67526752    CGRect frameInContainerViewCoordinates = [self convertRect:sourceRect toView:self.containerForContextMenuHintPreviews];
    6753     context.get()[getkDataDetectorsSourceRectKey()] = [NSValue valueWithCGRect:frameInContainerViewCoordinates];
    6754 #endif
    6755    
     6753    return [getDDContextMenuActionClass() updateContext:context.get() withSourceRect:frameInContainerViewCoordinates];
     6754#else
    67566755    return context.autorelease();
     6756#endif
    67576757}
    67586758
Note: See TracChangeset for help on using the changeset viewer.