Title: [258684] trunk/Source
Revision
258684
Author
[email protected]
Date
2020-03-19 01:14:12 -0700 (Thu, 19 Mar 2020)

Log 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:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (258683 => 258684)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-03-19 07:04:17 UTC (rev 258683)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-03-19 08:14:12 UTC (rev 258684)
@@ -1,3 +1,12 @@
+2020-03-19  Megan Gardner  <[email protected]>
+
+        Correctly set up context for Data Detectors
+        https://bugs.webkit.org/show_bug.cgi?id=209258
+
+        Reviewed by Tim Horton.
+
+        * pal/spi/ios/DataDetectorsUISPI.h:
+
 2020-03-18  Peng Liu  <[email protected]>
 
         The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP

Modified: trunk/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h (258683 => 258684)


--- trunk/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h	2020-03-19 07:04:17 UTC (rev 258683)
+++ trunk/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h	2020-03-19 08:14:12 UTC (rev 258684)
@@ -52,6 +52,7 @@
 #if HAVE(LINK_PREVIEW) && USE(UICONTEXTMENU)
 @class UIContextMenuConfiguration;
 @interface DDContextMenuAction
++ (NSDictionary *)updateContext:(NSDictionary *)context withSourceRect:(CGRect)sourceRect;
 + (UIContextMenuConfiguration *)contextMenuConfigurationForURL:(NSURL *)URL identifier:(NSString *)identifier selectedText:(NSString *)selectedText results:(NSArray *) results inView: (UIView *) view context:(NSDictionary *)context menuIdentifier:(NSString *)menuIdentifier;
 + (UIContextMenuConfiguration *)contextMenuConfigurationWithResult:(DDResultRef)result inView:(UIView *)view context:(NSDictionary *)context menuIdentifier:(NSString *)menuIdentifier;
 + (UIContextMenuConfiguration *)contextMenuConfigurationWithURL:(NSURL *)URL inView:(UIView *)view context:(NSDictionary *)context menuIdentifier:(NSString *)menuIdentifier;

Modified: trunk/Source/WebKit/ChangeLog (258683 => 258684)


--- trunk/Source/WebKit/ChangeLog	2020-03-19 07:04:17 UTC (rev 258683)
+++ trunk/Source/WebKit/ChangeLog	2020-03-19 08:14:12 UTC (rev 258684)
@@ -1,3 +1,19 @@
+2020-03-19  Megan Gardner  <[email protected]>
+
+        Correctly set up context for Data Detectors
+        https://bugs.webkit.org/show_bug.cgi?id=209258
+        <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:]):
+
 2020-03-18  Simon Fraser  <[email protected]>
 
         eventSender.monitorWheelEvents() is very fragile

Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (258683 => 258684)


--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2020-03-19 07:04:17 UTC (rev 258683)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2020-03-19 08:14:12 UTC (rev 258684)
@@ -733,10 +733,19 @@
     NSDictionary *newContext = nil;
     DDResultRef ddResult = [controller resultForURL:_positionInformation->url identifier:_positionInformation->dataDetectorIdentifier selectedText:textAtSelection results:_positionInformation->dataDetectorResults.get() context:context extendedContext:&newContext];
 
+
+    CGRect sourceRect;
+    if (_positionInformation->isLink)
+        sourceRect = _positionInformation->linkIndicator.textBoundingRectInRootViewCoordinates;
+    else
+        sourceRect = _positionInformation->bounds;
+
     auto ddContextMenuActionClass = getDDContextMenuActionClass();
+    auto finalContext = [ddContextMenuActionClass updateContext:newContext withSourceRect:sourceRect];
+
     if (ddResult)
-        return [ddContextMenuActionClass contextMenuConfigurationWithResult:ddResult inView:_view.getAutoreleased() context:context menuIdentifier:nil];
-    return [ddContextMenuActionClass contextMenuConfigurationWithURL:_positionInformation->url inView:_view.getAutoreleased() context:context menuIdentifier:nil];
+        return [ddContextMenuActionClass contextMenuConfigurationWithResult:ddResult inView:_view.getAutoreleased() context:finalContext menuIdentifier:nil];
+    return [ddContextMenuActionClass contextMenuConfigurationWithURL:_positionInformation->url inView:_view.getAutoreleased() context:finalContext menuIdentifier:nil];
 }
 
 - (UITargetedPreview *)contextMenuInteraction:(UIContextMenuInteraction *)interaction previewForHighlightingMenuWithConfiguration:(UIContextMenuConfiguration *)configuration

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (258683 => 258684)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-03-19 07:04:17 UTC (rev 258683)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-03-19 08:14:12 UTC (rev 258684)
@@ -6750,10 +6750,10 @@
         sourceRect = positionInformation.bounds;
 
     CGRect frameInContainerViewCoordinates = [self convertRect:sourceRect toView:self.containerForContextMenuHintPreviews];
-    context.get()[getkDataDetectorsSourceRectKey()] = [NSValue valueWithCGRect:frameInContainerViewCoordinates];
+    return [getDDContextMenuActionClass() updateContext:context.get() withSourceRect:frameInContainerViewCoordinates];
+#else
+    return context.autorelease();
 #endif
-    
-    return context.autorelease();
 }
 
 - (NSDictionary *)dataDetectionContextForActionSheetAssistant:(WKActionSheetAssistant *)assistant
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to