Bug 236627 - Implement additional Reveal methods.
Summary: Implement additional Reveal methods.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Megan Gardner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-14 18:26 PST by Megan Gardner
Modified: 2022-02-15 16:51 PST (History)
5 users (show)

See Also:


Attachments
Patch (22.88 KB, patch)
2022-02-14 18:46 PST, Megan Gardner
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (22.87 KB, patch)
2022-02-14 18:50 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (23.92 KB, patch)
2022-02-14 19:51 PST, Megan Gardner
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (24.07 KB, patch)
2022-02-14 20:20 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch for landing (24.05 KB, patch)
2022-02-15 09:18 PST, Megan Gardner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Megan Gardner 2022-02-14 18:26:59 PST
Implement additional Reveeal methods.
Comment 1 Megan Gardner 2022-02-14 18:46:50 PST
Created attachment 451977 [details]
Patch
Comment 2 Megan Gardner 2022-02-14 18:50:40 PST
Created attachment 451978 [details]
Patch
Comment 3 Megan Gardner 2022-02-14 19:51:52 PST
Created attachment 451986 [details]
Patch
Comment 4 Megan Gardner 2022-02-14 20:20:35 PST
Created attachment 451988 [details]
Patch
Comment 5 Tim Horton 2022-02-14 23:17:29 PST
Comment on attachment 451988 [details]
Patch

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

> Source/WebCore/editing/cocoa/DictionaryLookup.mm:430
> -    if (!canCreateRevealItems() || !PAL::getRVPresenterClass())
> +    if (!canCreateRevealItems() || !PAL::getRVPresenterClass() || !PAL::isRevealFrameworkAvailable())

I think you want to put the Reveal framework short circuit /before/ you go looking up RVPresenter, because RVPresenter's softlink macro has a RELEASE_ASSERT in it.

> Source/WebCore/page/cocoa/EventHandlerCocoa.mm:54
> +    return VisibleSelection();

Perhaps `{ }` like above?

> Source/WebCore/page/cocoa/EventHandlerCocoa.mm:61
> +#endif // PLATFORM(IOS_FAMILY)

Comment seems to disagree with the condition.

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:7560
> +    _page->prepareSelectionForContextMenuWithLocationInView(WebCore::roundedIntPoint(locationInView), [prepareSelectionForContextMenuHandler = makeBlockPtr(completionHandler)](bool shouldPresentMenu, const WebKit::RevealItem& item) {

`prepareSelectionForContextMenuHandler` seems like a slightly confusing name for the captured completion handler, since it's not "handling" `prepareSelectionForContextMenu`, but rather the completion callback. If you search for `makeBlockPtr(completionHandler)` you'll see much prior art, ranging from folks who literally use `completionHandler = makeBlockPtr(completionHandler)`, shadowing the name, to folks who use slightly adjusted names like `completionBlock` or `protectedCompletionHandler` or etc. etc.

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2347
> +RetainPtr<RVItem> WebPage::rvItemForCurrentSelection()

I know it's not new in this patch, but since you're renaming it, can we expand "rv" to "reveal"? (Also I kind of wonder if it should just return a RevealItem, but this is fine).

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2386
> +    eventHander.selectClosestContextualWordOrLinkFromHitTestResult(result, WebCore::DontAppendTrailingWhitespace);
>      
> -    completionHandler(RevealItem(WTFMove(item)));
> +    completionHandler(true, RevealItem(rvItemForCurrentSelection()));

This all worked out handily!
Comment 6 Tim Horton 2022-02-15 00:23:52 PST
Comment on attachment 451988 [details]
Patch

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

> Source/WebCore/ChangeLog:3
> +        Implement additional Reveeal methods.

"Reveeal"
Comment 7 Megan Gardner 2022-02-15 09:18:42 PST
Created attachment 452033 [details]
Patch for landing
Comment 8 EWS 2022-02-15 10:07:03 PST
Committed r289818 (247279@main): <https://commits.webkit.org/247279@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 452033 [details].
Comment 9 Radar WebKit Bug Importer 2022-02-15 10:08:19 PST
<rdar://problem/88972256>