Bug 219635 - [macOS] Change Universal Access zoom in the UI process
Summary: [macOS] Change Universal Access zoom in the UI process
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-12-08 02:32 PST by Per Arne Vollan
Modified: 2020-12-09 05:48 PST (History)
6 users (show)

See Also:


Attachments
Patch (11.47 KB, patch)
2020-12-08 02:45 PST, Per Arne Vollan
darin: review+
Details | Formatted Diff | Diff
Patch (19.52 KB, patch)
2020-12-09 04:30 PST, Per Arne Vollan
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (19.62 KB, patch)
2020-12-09 04:52 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2020-12-08 02:32:35 PST
Currently, the API UAZoomChangeFocus is called in the WebContent process when Universal Access zoom is enabled. To enable us to block the HI service com.apple.hiservices-xpcservice in the WebContent process, this call should be performed in the UI process.
Comment 1 Per Arne Vollan 2020-12-08 02:45:26 PST
Created attachment 415625 [details]
Patch
Comment 2 Darin Adler 2020-12-08 12:10:44 PST
Comment on attachment 415625 [details]
Patch

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

I think we are moving too much of the code from shared between WebKit and WebKitLegacy to have two copies.

> Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:717
> +void WebPageProxy::changeUniversalAccessZoomFocus(const WebCore::IntRect& viewRect, const WebCore::IntRect& selectionRect)

Can we find a way to share this code between WebKit and WebKitLegacy? Maybe put a function in WebCore they both call? It’s annoying to have two copies.

> Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:727
> +    NSRect nsCaretRect = NSMakeRect(selectionRect.x(), selectionRect.y(), selectionRect.width(), selectionRect.height());
> +    NSRect nsViewRect = NSMakeRect(viewRect.x(), viewRect.y(), viewRect.width(), viewRect.height());
> +    nsCaretRect = toUserSpaceForPrimaryScreen(nsCaretRect);
> +    nsViewRect = toUserSpaceForPrimaryScreen(nsViewRect);
> +    CGRect cgCaretRect = NSRectToCGRect(nsCaretRect);
> +    CGRect cgViewRect = NSRectToCGRect(nsViewRect);

I know this is just moved code, but I suggest this alternative way of writing it:

    auto cgCaretRect = NSRectToCGRect(toUserSpaceForPrimaryScreen(selectionRect));
    auto cgViewRect = NSRectToCGRect(toUserSpaceForPrimaryScreen(viewRect));

This should compile and do the same as the code above. If not, I’d like to know why not.

> Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm:1185
> +    NSRect nsCaretRect = NSMakeRect(selectionRect.x(), selectionRect.y(), selectionRect.width(), selectionRect.height());
> +    NSRect nsViewRect = NSMakeRect(viewRect.x(), viewRect.y(), viewRect.width(), viewRect.height());
> +    nsCaretRect = toUserSpaceForPrimaryScreen(nsCaretRect);
> +    nsViewRect = toUserSpaceForPrimaryScreen(nsViewRect);
> +    CGRect cgCaretRect = NSRectToCGRect(nsCaretRect);
> +    CGRect cgViewRect = NSRectToCGRect(nsViewRect);

Ditto.
Comment 3 Per Arne Vollan 2020-12-09 04:30:56 PST
Created attachment 415744 [details]
Patch
Comment 4 Per Arne Vollan 2020-12-09 04:52:44 PST
Created attachment 415745 [details]
Patch
Comment 5 EWS 2020-12-09 05:48:01 PST
Committed r270577: <https://trac.webkit.org/changeset/270577>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 415745 [details].
Comment 6 Radar WebKit Bug Importer 2020-12-09 05:48:16 PST
<rdar://problem/72134245>