WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
208779
Adopt Context Menus for Data Detectors
https://bugs.webkit.org/show_bug.cgi?id=208779
Summary
Adopt Context Menus for Data Detectors
Megan Gardner
Reported
2020-03-07 16:47:29 PST
Adopt Context Menus for Data Detectors
Attachments
Patch
(8.13 KB, patch)
2020-03-07 16:54 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(8.26 KB, patch)
2020-03-07 17:24 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(9.19 KB, patch)
2020-03-07 20:36 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(8.99 KB, patch)
2020-03-07 22:24 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(10.23 KB, patch)
2020-03-07 22:50 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(10.35 KB, patch)
2020-03-07 22:56 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(10.35 KB, patch)
2020-03-07 23:02 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch
(10.31 KB, patch)
2020-03-07 23:16 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch for landing
(10.30 KB, patch)
2020-03-08 00:17 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Megan Gardner
Comment 1
2020-03-07 16:54:36 PST
Created
attachment 392914
[details]
Patch
Tim Horton
Comment 2
2020-03-07 17:07:03 PST
Comment on
attachment 392914
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=392914&action=review
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h:65 > +- (CGPoint)contextMenuDisplayLocation;
Cocoa tradition is to pass the object that's delegating behavior to the delegate methods. You even realized why, earlier (so that you can have one object be the delegate of multiple instances of the same class). See all of the others above.
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:738 > +- (_UIContextMenuStyle *)_contextMenuInteraction:(UIContextMenuInteraction *)interaction styleForMenuWithConfiguration:(UIContextMenuConfiguration *)configuration
Missing a newline
Megan Gardner
Comment 3
2020-03-07 17:24:33 PST
Created
attachment 392918
[details]
Patch
Tim Horton
Comment 4
2020-03-07 17:43:56 PST
Comment on
attachment 392918
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=392918&action=review
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:691 > + [self ensureContextMenuInteraction];
Seems bad that we make and install it, and then don't present it, which means we won't remove it. I think this needs to be JUST before the -present
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:694 > + if ([delegate respondsToSelector:@selector(contextMenuDisplayLocation)]) { > + [_dataDetectorContextMenuInteraction _presentMenuAtLocation:[delegate contextMenuDisplayLocation]];
You forgot to change the name here
Megan Gardner
Comment 5
2020-03-07 18:40:56 PST
<
rdar://problem/59358079
>
Megan Gardner
Comment 6
2020-03-07 20:36:50 PST
Created
attachment 392935
[details]
Patch
Megan Gardner
Comment 7
2020-03-07 22:24:56 PST
Created
attachment 392937
[details]
Patch
Tim Horton
Comment 8
2020-03-07 22:38:33 PST
Comment on
attachment 392937
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=392937&action=review
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h:65 > +- (CGPoint)contextMenuDisplayLocationForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
Maybe "presentation" or "origin" instead of "display", but I don't really care.
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:719 > +- (UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction configurationForMenuAtLocation:(CGPoint)location
USE(UICONTEXTMENU)?
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:747 > + if ([delegate respondsToSelector:@selector(contextMenuDisplayLocationForActionSheetAssistant:)]) > + center = [delegate contextMenuDisplayLocationForActionSheetAssistant:self]; > + RetainPtr<UIPreviewParameters> unusedPreviewParameters = adoptNS([[UIPreviewParameters alloc] init]); > + RetainPtr<UIPreviewTarget> previewTarget = adoptNS([[UIPreviewTarget alloc] initWithContainer:_view.getAutoreleased() center:center]); > + RetainPtr<UITargetedPreview> preview = adoptNS([[UITargetedPreview alloc] initWithView:_view.getAutoreleased() parameters:unusedPreviewParameters.get() target:previewTarget.get()]);
How ugly is the hint? We probably want to share some of this with the better code in WKContentViewInteraction, but that can be in a follow-up
Wenson Hsieh
Comment 9
2020-03-07 22:39:30 PST
Comment on
attachment 392937
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=392937&action=review
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:645 > + > +- (void)ensureContextMenuInteraction
Generally, -ensure* methods should return the object they’re ensuring (in this case, the _dataDetectorContextMenuInteraction). I think that if you added a return _dataDetectorContextMenuInteraction.get(); at the end here, it would allow you to then do this below: auto delegate = _delegate.get(); if ([delegate respondsToSelector:@selector(contextMenuDisplayLocationForActionSheetAssistant:)]) { [[self ensureContextMenuInteraction] _presentMenuAtLocation:[delegate contextMenuDisplayLocationForActionSheetAssistant:self]]; return; } I believe this would also address Tim’s earlier comment in
https://bugs.webkit.org/show_bug.cgi?id=208779#c4
.
Megan Gardner
Comment 10
2020-03-07 22:50:48 PST
Created
attachment 392938
[details]
Patch
Megan Gardner
Comment 11
2020-03-07 22:56:28 PST
Created
attachment 392939
[details]
Patch
Megan Gardner
Comment 12
2020-03-07 23:02:29 PST
Created
attachment 392940
[details]
Patch
Megan Gardner
Comment 13
2020-03-07 23:16:17 PST
Created
attachment 392941
[details]
Patch
Megan Gardner
Comment 14
2020-03-08 00:17:12 PST
Created
attachment 392944
[details]
Patch for landing
WebKit Commit Bot
Comment 15
2020-03-08 01:00:54 PST
Comment on
attachment 392944
[details]
Patch for landing Clearing flags on attachment: 392944 Committed
r258102
: <
https://trac.webkit.org/changeset/258102
>
WebKit Commit Bot
Comment 16
2020-03-08 01:00:56 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug