Bug 238714 - [macOS] Add helper methods to install and uninstall VKCImageAnalysisOverlayView
Summary: [macOS] Add helper methods to install and uninstall VKCImageAnalysisOverlayView
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-03 10:40 PDT by Wenson Hsieh
Modified: 2022-04-04 15:08 PDT (History)
6 users (show)

See Also:


Attachments
For EWS (16.28 KB, patch)
2022-04-03 12:00 PDT, Wenson Hsieh
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Fix Big Sur build (16.36 KB, patch)
2022-04-03 12:52 PDT, Wenson Hsieh
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Fix Big Sur build (16.45 KB, patch)
2022-04-03 13:00 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
For landing (16.47 KB, patch)
2022-04-04 12:56 PDT, Wenson Hsieh
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2022-04-03 10:40:21 PDT
.
Comment 1 Wenson Hsieh 2022-04-03 12:00:46 PDT Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2022-04-03 12:52:44 PDT Comment hidden (obsolete)
Comment 3 Wenson Hsieh 2022-04-03 13:00:22 PDT
Created attachment 456511 [details]
Fix Big Sur build
Comment 4 Tim Horton 2022-04-04 10:33:13 PDT
Comment on attachment 456511 [details]
Fix Big Sur build

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

> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:1172
> +        return CGRectMake(0, 0, 1, 1);

Why does this have a non-zero size?

> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:5960
> +bool WebViewImpl::shouldAvoidUpdatingCursorAtPoint(NSPoint locationInView) const

Not totally sure this mechanism is a good idea, e.g. if you cmd-tab to a window with a web view and then don't update the cursor. Can you instead just force the cursor you want to be set?
Comment 5 Wenson Hsieh 2022-04-04 12:18:41 PDT
(In reply to Tim Horton from comment #4)
> Comment on attachment 456511 [details]
> Fix Big Sur build
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=456511&action=review
> 
> > Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:1172
> > +        return CGRectMake(0, 0, 1, 1);
> 
> Why does this have a non-zero size?

So I just decided to fall back to the default value here (i.e., as if the delegate were unimplemented), which is the unit rect (0, 0, 1, 1). The return value of this delegate method is a normalized rect relative to the bounds of the WKWebView.

> 
> > Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:5960
> > +bool WebViewImpl::shouldAvoidUpdatingCursorAtPoint(NSPoint locationInView) const
> 
> Not totally sure this mechanism is a good idea, e.g. if you cmd-tab to a
> window with a web view and then don't update the cursor. Can you instead
> just force the cursor you want to be set?

That's a good point! I'll see if I can change this...
Comment 6 Wenson Hsieh 2022-04-04 12:42:34 PDT
(In reply to Wenson Hsieh from comment #5)
> (In reply to Tim Horton from comment #4)
> > Comment on attachment 456511 [details]
> > Fix Big Sur build
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=456511&action=review
> > 
> > > Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:1172
> > > +        return CGRectMake(0, 0, 1, 1);
> > 
> > Why does this have a non-zero size?
> 
> So I just decided to fall back to the default value here (i.e., as if the
> delegate were unimplemented), which is the unit rect (0, 0, 1, 1). The
> return value of this delegate method is a normalized rect relative to the
> bounds of the WKWebView.
> 
> > 
> > > Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:5960
> > > +bool WebViewImpl::shouldAvoidUpdatingCursorAtPoint(NSPoint locationInView) const
> > 
> > Not totally sure this mechanism is a good idea, e.g. if you cmd-tab to a
> > window with a web view and then don't update the cursor. Can you instead
> > just force the cursor you want to be set?
> 
> That's a good point! I'll see if I can change this...

Chatted with Tim on Slack about this; the overall approach seems okay since we're not avoiding cursor updates — just letting the native VisionKit views set the cursor on our behalf. I'll rename this method to something like, `imageAnalysisOverlayViewHasCursorAtPoint()`, to make this interaction clear.
Comment 7 Wenson Hsieh 2022-04-04 12:56:46 PDT
Created attachment 456611 [details]
For landing
Comment 8 EWS 2022-04-04 14:17:16 PDT
Committed r292316 (249209@main): <https://commits.webkit.org/249209@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 456611 [details].
Comment 9 Radar WebKit Bug Importer 2022-04-04 14:18:18 PDT
<rdar://problem/91260885>