Changeset 246531 in webkit
- Timestamp:
- Jun 17, 2019 7:33:50 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246530 r246531 1 2019-06-17 Tim Horton <timothy_horton@apple.com> 2 3 Expose DataDetectors context generation on WKContentViewInteraction 4 https://bugs.webkit.org/show_bug.cgi?id=198950 5 <rdar://problem/51116021> 6 7 Reviewed by Andy Estes. 8 9 * UIProcess/ios/WKActionSheetAssistant.h: 10 * UIProcess/ios/WKActionSheetAssistant.mm: 11 (-[WKActionSheetAssistant currentPositionInformation]): 12 (-[WKActionSheetAssistant showDataDetectorsSheet]): 13 * UIProcess/ios/WKContentViewInteraction.h: 14 * UIProcess/ios/WKContentViewInteraction.mm: 15 (-[WKContentView dataDetectionContextForPositionInformation:]): 16 (-[WKContentView dataDetectionContextForActionSheetAssistant:]): 17 For use by other clients, add -dataDetectionContextForPositionInformation: 18 and make -dataDetectionContextForActionSheetAssistant: use it. 19 Also, pull the code to augment the context with surrounding text out of 20 from WKActionSheetAssistant. 21 1 22 2019-06-17 Sihui Liu <sihui_liu@apple.com> 2 23 -
trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h
r246224 r246531 83 83 - (void)interactionDidStartWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)information; 84 84 - (NSArray *)currentAvailableActionTitles; 85 - (Optional<WebKit::InteractionInformationAtPosition>)currentPositionInformation; 85 86 @end 86 87 -
trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
r246224 r246531 326 326 } 327 327 328 - (Optional<WebKit::InteractionInformationAtPosition>)currentPositionInformation 329 { 330 return _positionInformation; 331 } 332 328 333 - (void)_createSheetWithElementActions:(NSArray *)actions defaultTitle:(NSString *)defaultTitle showLinkTitle:(BOOL)showLinkTitle 329 334 { … … 647 652 NSDictionary *context = nil; 648 653 NSString *textAtSelection = nil; 649 RetainPtr<NSMutableDictionary> extendedContext;650 654 651 655 if ([_delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:)]) … … 653 657 if ([_delegate respondsToSelector:@selector(selectedTextForActionSheetAssistant:)]) 654 658 textAtSelection = [_delegate selectedTextForActionSheetAssistant:self]; 655 if (!_positionInformation->textBefore.isEmpty() || !_positionInformation->textAfter.isEmpty()) {656 extendedContext = adoptNS([@{657 getkDataDetectorsLeadingText() : _positionInformation->textBefore,658 getkDataDetectorsTrailingText() : _positionInformation->textAfter,659 } mutableCopy]);660 661 if (context)662 [extendedContext addEntriesFromDictionary:context];663 context = extendedContext.get();664 }665 659 666 660 if ([controller respondsToSelector:@selector(shouldImmediatelyLaunchDefaultActionForURL:)] && [controller shouldImmediatelyLaunchDefaultActionForURL:targetURL]) { -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r246347 r246531 471 471 - (WKFormInputSession *)_formInputSession; 472 472 - (void)_didChangeWebViewEditability; 473 - (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation; 473 474 474 475 - (void)willFinishIgnoringCalloutBarFadeAfterPerformingAction; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r246425 r246531 6140 6140 } 6141 6141 6142 - (NSDictionary *)dataDetectionContextFor ActionSheetAssistant:(WKActionSheetAssistant *)assistant6143 { 6144 NSDictionary *context = nil;6142 - (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation 6143 { 6144 RetainPtr<NSMutableDictionary> context; 6145 6145 id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]); 6146 6146 if ([uiDelegate respondsToSelector:@selector(_dataDetectionContextForWebView:)]) 6147 context = [uiDelegate _dataDetectionContextForWebView:_webView]; 6148 return context; 6147 context = adoptNS([[uiDelegate _dataDetectionContextForWebView:_webView] mutableCopy]); 6148 6149 if (!context) 6150 context = adoptNS([[NSMutableDictionary alloc] init]); 6151 6152 if (!positionInformation.textBefore.isEmpty()) 6153 context.get()[getkDataDetectorsLeadingText()] = positionInformation.textBefore; 6154 if (!positionInformation.textAfter.isEmpty()) 6155 context.get()[getkDataDetectorsTrailingText()] = positionInformation.textAfter; 6156 6157 return context.autorelease(); 6158 } 6159 6160 - (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant 6161 { 6162 return [self dataDetectionContextForPositionInformation:assistant.currentPositionInformation.valueOr(_positionInformation)]; 6149 6163 } 6150 6164
Note: See TracChangeset
for help on using the changeset viewer.