[csswg-drafts] [cssom-view] Should CSS pixels * devicePixelRatio match OS pixels or screen pixels? (#6314)

jakearchibald has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Should CSS pixels * devicePixelRatio match OS pixels or screen pixels?  ==
On my 2016 MacBook pro's screen, `screen.width * devicePixelRatio` is 3360, but the screen resolution width is 2880.

On my attached 4k monitor, `screen.width * devicePixelRatio` is 6016, but the screen resolution width is 3840.

This is because OSX doesn't handle devicePixelRatios > 1 but < 2, so the OS renders at a much larger resolution than the screen, and scales down. Other operating systems have a similar issue.

Right now, things like `screen.width` and `devicePixelRatio` represent OS pixels rather than screen pixels.

This discrepancy means websites will create canvases bigger than necessary, and browsers will download images larger than necessary.

Is this something that could be fixed? @smfr is the 'real' devicePixelRatio exposed in OSX?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6314 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 26 May 2021 14:01:07 UTC