Bug 183048 - The WebContent process should not use NSScreen in the screenDepth implementation.
Summary: The WebContent process should not use NSScreen in the screenDepth implementat...
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: 182747
  Show dependency treegraph
 
Reported: 2018-02-22 11:26 PST by Per Arne Vollan
Modified: 2018-02-22 16:17 PST (History)
5 users (show)

See Also:


Attachments
Patch (4.42 KB, patch)
2018-02-22 11:48 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (5.54 KB, patch)
2018-02-22 12:17 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (6.73 KB, patch)
2018-02-22 12:51 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (6.85 KB, patch)
2018-02-22 12:58 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 2018-02-22 11:26:57 PST
NSScreen method calls should be done in the UIProcess, since these calls will communicate with the WindowServer.
Comment 1 Radar WebKit Bug Importer 2018-02-22 11:27:57 PST
<rdar://problem/37795231>
Comment 2 Per Arne Vollan 2018-02-22 11:48:13 PST
Created attachment 334461 [details]
Patch
Comment 3 Per Arne Vollan 2018-02-22 12:17:21 PST
Created attachment 334464 [details]
Patch
Comment 4 Brent Fulgham 2018-02-22 12:20:43 PST
Comment on attachment 334464 [details]
Patch

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

This patch looks good, but I think it would be better if you got rid of the duplicated code. Can you please revise that?

> Source/WebCore/platform/mac/PlatformScreenMac.mm:140
> +        return screenProperties().get(iter->key).screenDepth;

This snippet of logic is also in 'screenRect' and 'screenAvailableRect', (and perhaps others?). Can you encapsulate it in a common function that returns the appropriate screenProperties, then each of these methods can just return the member we are interested in?

Also: Should we ASSERT if the depth is zero, just in case the IPC didn't happen for some reason?
Comment 5 Per Arne Vollan 2018-02-22 12:51:51 PST
Created attachment 334469 [details]
Patch
Comment 6 Per Arne Vollan 2018-02-22 12:58:00 PST
Created attachment 334470 [details]
Patch
Comment 7 Brent Fulgham 2018-02-22 13:22:24 PST
Comment on attachment 334470 [details]
Patch

Looks great! r=me.
Comment 8 Per Arne Vollan 2018-02-22 13:51:27 PST
Comment on attachment 334470 [details]
Patch

Thanks for reviewing!
Comment 9 WebKit Commit Bot 2018-02-22 16:17:43 PST
Comment on attachment 334470 [details]
Patch

Clearing flags on attachment: 334470

Committed r228940: <https://trac.webkit.org/changeset/228940>
Comment 10 WebKit Commit Bot 2018-02-22 16:17:44 PST
All reviewed patches have been landed.  Closing bug.