WebKit Bugzilla
Attachment 372315 Details for
Bug 198950
: Expose DataDetectors context generation on WKContentViewInteraction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198950-20190617190548.patch (text/plain), 6.70 KB, created by
Tim Horton
on 2019-06-17 19:05:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2019-06-17 19:05:49 PDT
Size:
6.70 KB
patch
obsolete
>Subversion Revision: 246514 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 3f86b4e1e59d6caa3a3d4488296455f0c306ef45..9db9fd44a7b70494e700b15d7933f972fc0bd177 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,24 @@ >+2019-06-17 Tim Horton <timothy_horton@apple.com> >+ >+ Expose DataDetectors context generation on WKContentViewInteraction >+ https://bugs.webkit.org/show_bug.cgi?id=198950 >+ <rdar://problem/51116021> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/ios/WKActionSheetAssistant.h: >+ * UIProcess/ios/WKActionSheetAssistant.mm: >+ (-[WKActionSheetAssistant currentPositionInformation]): >+ (-[WKActionSheetAssistant showDataDetectorsSheet]): >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView dataDetectionContextForPositionInformation:]): >+ (-[WKContentView dataDetectionContextForActionSheetAssistant:]): >+ For use by other clients, add -dataDetectionContextForPositionInformation: >+ and make -dataDetectionContextForActionSheetAssistant: use it. >+ Also, pull the code to augment the context with surrounding text out of >+ from WKActionSheetAssistant. >+ > 2019-06-17 Jiewen Tan <jiewen_tan@apple.com> > > Move SOAuthorization from WebKitAdditions to WebKit >diff --git a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h >index 17c1f3b5e5c11ed8ed1e4ff687ea8e3a5bf009fb..b04dd105a94768dd90ab9f6db483adac634d94e7 100644 >--- a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h >+++ b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h >@@ -82,6 +82,7 @@ struct InteractionInformationAtPosition; > - (BOOL)isShowingSheet; > - (void)interactionDidStartWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)information; > - (NSArray *)currentAvailableActionTitles; >+- (Optional<WebKit::InteractionInformationAtPosition>)currentPositionInformation; > @end > > #endif // PLATFORM(IOS_FAMILY) >diff --git a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm >index ad0f41b9fa70dd7cdaae876aa7350c2bff21a043..b33a3b601acb6a83b963ef24e8841644bdc9f7e8 100644 >--- a/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm >+++ b/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm >@@ -325,6 +325,11 @@ - (NSArray *)currentAvailableActionTitles > return array; > } > >+- (Optional<WebKit::InteractionInformationAtPosition>)currentPositionInformation >+{ >+ return _positionInformation; >+} >+ > - (void)_createSheetWithElementActions:(NSArray *)actions defaultTitle:(NSString *)defaultTitle showLinkTitle:(BOOL)showLinkTitle > { > auto delegate = _delegate.get(); >@@ -646,22 +651,11 @@ - (void)showDataDetectorsSheet > DDDetectionController *controller = [getDDDetectionControllerClass() sharedController]; > NSDictionary *context = nil; > NSString *textAtSelection = nil; >- RetainPtr<NSMutableDictionary> extendedContext; > > if ([_delegate respondsToSelector:@selector(dataDetectionContextForActionSheetAssistant:)]) > context = [_delegate dataDetectionContextForActionSheetAssistant:self]; > if ([_delegate respondsToSelector:@selector(selectedTextForActionSheetAssistant:)]) > textAtSelection = [_delegate selectedTextForActionSheetAssistant:self]; >- if (!_positionInformation->textBefore.isEmpty() || !_positionInformation->textAfter.isEmpty()) { >- extendedContext = adoptNS([@{ >- getkDataDetectorsLeadingText() : _positionInformation->textBefore, >- getkDataDetectorsTrailingText() : _positionInformation->textAfter, >- } mutableCopy]); >- >- if (context) >- [extendedContext addEntriesFromDictionary:context]; >- context = extendedContext.get(); >- } > > if ([controller respondsToSelector:@selector(shouldImmediatelyLaunchDefaultActionForURL:)] && [controller shouldImmediatelyLaunchDefaultActionForURL:targetURL]) { > auto action = [controller defaultActionForURL:targetURL results:nil context:context]; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index 2718a5400ced1e9de6b566826decf52ff6cba70b..3e57017caaf0dda77bd12909de3a71c5f5e7b191 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -470,6 +470,7 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > - (void)_accessibilityClearSelection; > - (WKFormInputSession *)_formInputSession; > - (void)_didChangeWebViewEditability; >+- (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation; > > - (void)willFinishIgnoringCalloutBarFadeAfterPerformingAction; > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 62b3ae19877aaa18458baa34d8e4ddcd532aea78..83c002540eb0c14d145c8d1f6348f2ce07f3de9b 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -6139,13 +6139,27 @@ - (void)actionSheetAssistantDidStopInteraction:(WKActionSheetAssistant *)assista > _page->stopInteraction(); > } > >-- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant >+- (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation > { >- NSDictionary *context = nil; >+ RetainPtr<NSMutableDictionary> context; > id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]); > if ([uiDelegate respondsToSelector:@selector(_dataDetectionContextForWebView:)]) >- context = [uiDelegate _dataDetectionContextForWebView:_webView]; >- return context; >+ context = adoptNS([[uiDelegate _dataDetectionContextForWebView:_webView] mutableCopy]); >+ >+ if (!context) >+ context = adoptNS([[NSMutableDictionary alloc] init]); >+ >+ if (!positionInformation.textBefore.isEmpty()) >+ context.get()[getkDataDetectorsLeadingText()] = positionInformation.textBefore; >+ if (!positionInformation.textAfter.isEmpty()) >+ context.get()[getkDataDetectorsTrailingText()] = positionInformation.textAfter; >+ >+ return context.autorelease(); >+} >+ >+- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant >+{ >+ return [self dataDetectionContextForPositionInformation:assistant.currentPositionInformation.valueOr(_positionInformation)]; > } > > - (NSString *)selectedTextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
aestes
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198950
:
372314
| 372315