W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2019

Re: [csswg-drafts] [resize-observer] device-pixel-border-box size (#3554)

From: Ken Russell via GitHub <sysbot+gh@w3.org>
Date: Tue, 26 Feb 2019 19:59:26 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-467590169-1551211165-sysbot+gh@w3.org>
The problem of not being able to know exactly how many device pixels a given Canvas covers exists in all browsers, not just Chromium. All browsers' layout engines and compositors do some sort of rounding or snapping, and all of them do it subtly differently. For this reason it is not possible to create pixel-accurate canvas content. There are some longstanding bugs filed against WebGL on this topic:

https://github.com/KhronosGroup/WebGL/issues/2460
https://github.com/KhronosGroup/WebGL/issues/587

In the past the WebGL WG discussed adding properties to the canvas exposing this information, but doing so is sub-optimal. If the surrounding elements of the canvas changed, layout needs to occur in order to compute the values of these properties, so fetching them would induce a synchronous layout, and could induce infinite loops in applications. @grorg pointed this out years ago and there was no good solution.

ResizeObserver is a great innovation and a great place to put these additional observable properties. It allows the application to respond asynchronously, and 100% correctly, to resizing of the canvas.
@atotic prototyped these new observable properties in Chromium and the results were excellent - they finally allowed perfectly pixel-accurate canvas content to be drawn.

Could we please reconsider adding device-pixel-border-box as an observable property? If refinements are needed we're happy to collaborate on them. Thanks.

-- 
GitHub Notification of comment by kenrussell
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3554#issuecomment-467590169 using your GitHub account
Received on Tuesday, 26 February 2019 19:59:27 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:44 UTC