Bug 209258

Summary: Correctly set up context for Data Detectors
Product: WebKit Reporter: Megan Gardner <megan_gardner>
Component: New BugsAssignee: Megan Gardner <megan_gardner>
Status: RESOLVED FIXED    
Severity: Normal CC: thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Megan Gardner 2020-03-18 17:01:48 PDT
Correctly set up context for Data Detectors
Comment 1 Megan Gardner 2020-03-18 17:15:51 PDT
Created attachment 393922 [details]
Patch
Comment 2 Tim Horton 2020-03-18 17:17:40 PDT
Comment on attachment 393922 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393922&action=review

> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:744
> +    [ddContextMenuActionClass updateContext:context withSourceRect:sourceRect];

You need to use the return value of this method, it doesn't/can't mutate the one passed in

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:6754
> +    [ddContextMenuActionClass updateContext:context.get() withSourceRect:frameInContainerViewCoordinates];

You need to use the return value of this method, it doesn't/can't mutate the one passed in
Comment 3 Megan Gardner 2020-03-18 18:06:06 PDT
Created attachment 393926 [details]
Patch
Comment 4 Tim Horton 2020-03-18 18:15:35 PDT
Comment on attachment 393926 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393926&action=review

> Source/WebKit/ChangeLog:5
> +

where's the rdar

> Source/WebKit/ChangeLog:8
> +        Not passing in a nil context, and running the formatter as requested by Data Detectors team.

This is an odd sentence fragment.

I would write something more like:

"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."

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:6752
>      CGRect frameInContainerViewCoordinates = [self convertRect:sourceRect toView:self.containerForContextMenuHintPreviews];

Here, we're converting into the coordinate space of containerForContextMenuHintPreviews. But I think that sometimes this method is used to provide context for different views? Maybe we need to pass in the view whose coordinate space we should use as an argument to this method?

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:6753
> +    auto ddContextMenuActionClass = getDDContextMenuActionClass();

No need for this local, in this case.
Comment 5 Megan Gardner 2020-03-18 18:31:35 PDT
Created attachment 393932 [details]
Patch
Comment 6 EWS 2020-03-19 01:14:16 PDT
Committed r258684: <https://trac.webkit.org/changeset/258684>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 393932 [details].
Comment 7 Radar WebKit Bug Importer 2020-03-19 01:15:15 PDT
<rdar://problem/60623947>
Comment 8 Megan Gardner 2020-03-20 10:02:03 PDT
<rdar://problem/60612327>