- From: Greggman via GitHub <sysbot+gh@w3.org>
- Date: Thu, 09 Jan 2025 21:30:59 +0000
- To: public-css-archive@w3.org
You want device pixels so you can be pixel perfect. The user pinches to zoom (testing on M1 Mac). `ResizeObserver` does not actually return device pixels even though it's named `devicePixelContentBox`. Multiplying that value by `visualViewport.scale` doesn't solve the problem. Here's a repo of the issue: https://greggman.github.io/doodles/test/devicepixelcontentbox-with-visualviewport-scale/dpr-zoom-test-with-visualviewport.html If the calculation is perfect then you should see solid stripes, orange and cyan. If the calculation is not perfect then you'll see a gradient of color (orange to dark orange), cyan to dark cyan). If you turn on image-rendering: pixelated then you'll see some line is doubled because the calculation is not perfect. Here's a video: Unfortunately, compression artifacts might not make it clear things are not correct. But, you can run the test yourself. Open the test above on a Mac. See, by default, the colors are solid. Pinch to zoom on the trackpad. See the colors stop being solid (because `devicePixelContentBox * visualViewport.scale` does not return the actual number of device pixels so the page can't correctly render a perfect match for the device) https://github.com/user-attachments/assets/6ff5b48d-2842-47f4-a64f-f9f41a871a70 Note that in the video, switching to `ceil` or `round` looks better but if you look closely you'll see the color on the right is not the same as the color on the left. This is more easy to see if you do it live. In any case, given the value is called `devicePixelContentBox` it seems like it should actually return "device pixels" and not some other value. Can we update to spec to say it should take `visualViewport.scale` into account and do whatever is necessary to return the actual "device pixels"? -- GitHub Notification of comment by greggman Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11412#issuecomment-2581283955 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 9 January 2025 21:31:01 UTC