Title: [246544] trunk/Source/WebKit
Revision
246544
Author
tsav...@apple.com
Date
2019-06-18 09:48:34 -0700 (Tue, 18 Jun 2019)

Log Message

Unreviewed, rolling out r246531.

Broke internal builds.

Reverted changeset:

"Expose DataDetectors context generation on
WKContentViewInteraction"
https://bugs.webkit.org/show_bug.cgi?id=198950
https://trac.webkit.org/changeset/246531

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (246543 => 246544)


--- trunk/Source/WebKit/ChangeLog	2019-06-18 16:44:36 UTC (rev 246543)
+++ trunk/Source/WebKit/ChangeLog	2019-06-18 16:48:34 UTC (rev 246544)
@@ -1,3 +1,16 @@
+2019-06-18  Truitt Savell  <tsav...@apple.com>
+
+        Unreviewed, rolling out r246531.
+
+        Broke internal builds.
+
+        Reverted changeset:
+
+        "Expose DataDetectors context generation on
+        WKContentViewInteraction"
+        https://bugs.webkit.org/show_bug.cgi?id=198950
+        https://trac.webkit.org/changeset/246531
+
 2019-06-18  Simon Fraser  <simon.fra...@apple.com>
 
         Convert macOS to scroll by changing layer boundsOrigin

Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h (246543 => 246544)


--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h	2019-06-18 16:44:36 UTC (rev 246543)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h	2019-06-18 16:48:34 UTC (rev 246544)
@@ -82,7 +82,6 @@
 - (BOOL)isShowingSheet;
 - (void)interactionDidStartWithPositionInformation:(const WebKit::InteractionInformationAtPosition&)information;
 - (NSArray *)currentAvailableActionTitles;
-- (Optional<WebKit::InteractionInformationAtPosition>)currentPositionInformation;
 @end
 
 #endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (246543 => 246544)


--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2019-06-18 16:44:36 UTC (rev 246543)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2019-06-18 16:48:34 UTC (rev 246544)
@@ -325,11 +325,6 @@
     return array;
 }
 
-- (Optional<WebKit::InteractionInformationAtPosition>)currentPositionInformation
-{
-    return _positionInformation;
-}
-
 - (void)_createSheetWithElementActions:(NSArray *)actions defaultTitle:(NSString *)defaultTitle showLinkTitle:(BOOL)showLinkTitle
 {
     auto delegate = _delegate.get();
@@ -651,11 +646,22 @@
     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 = "" defaultActionForURL:targetURL results:nil context:context];

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (246543 => 246544)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-06-18 16:44:36 UTC (rev 246543)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-06-18 16:48:34 UTC (rev 246544)
@@ -470,7 +470,6 @@
 - (void)_accessibilityClearSelection;
 - (WKFormInputSession *)_formInputSession;
 - (void)_didChangeWebViewEditability;
-- (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation;
 
 - (void)willFinishIgnoringCalloutBarFadeAfterPerformingAction;
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (246543 => 246544)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-18 16:44:36 UTC (rev 246543)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-18 16:48:34 UTC (rev 246544)
@@ -6139,29 +6139,15 @@
     _page->stopInteraction();
 }
 
-- (NSDictionary *)dataDetectionContextForPositionInformation:(WebKit::InteractionInformationAtPosition)positionInformation
+- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
 {
-    RetainPtr<NSMutableDictionary> context;
+    NSDictionary *context = nil;
     id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([_webView UIDelegate]);
     if ([uiDelegate respondsToSelector:@selector(_dataDetectionContextForWebView:)])
-        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();
+        context = [uiDelegate _dataDetectionContextForWebView:_webView];
+    return context;
 }
 
-- (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
-{
-    return [self dataDetectionContextForPositionInformation:assistant.currentPositionInformation.valueOr(_positionInformation)];
-}
-
 - (NSString *)selectedTextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
 {
     return [self selectedText];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to