-
Notifications
You must be signed in to change notification settings - Fork 707
Add support for device-pixel-content-box-size #3554 #4476
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for device-pixel-content-box-size #3554 #4476
Conversation
@gregwhitworth - mind taking a first pass review on this? Please bear with me as this is my first spec PR. Thanks! |
Reference browser-specific behavior, rather than implementation specific. Mention that the device pixels are not affected by transforms. Clarify which box contentRect refers to.
before applying any CSS transforms on the element or its ancestors. | ||
This size must contain integer values. | ||
|
||
<p class="note"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a non-normative note specifying a typical way that UAs compute this box?
e.g. "How a UA computes the device pixel box for an element is implementation-dependent. One way could be to multiply the box size and position by the device pixel ratio, then round the resulting (floating-point) size and position of the box to integer values in some way that maximizes quality of rendered output".
resize-observer-1/Overview.bs
Outdated
<p class="note"> | ||
The {{device-pixel-content-box}} can be approximated by multiplying <a>devicePixelRatio</a> by the {{content-box}} size. | ||
However, due to browser-specific subpixel snapping behavior, | ||
authors cannot determine the correct way to round the scaled {{content-box}} size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/the scaled/this scaled/, to make clearer that you're referring to the output of multiplying by devicePixelRatio.
Minutes: #3554 (comment)
Authors need a way to get the content box size in integral physical pixels. This allows for the correct sizing of the backing store of a canvas to match the snapped CSS size and prevents moire patterns that arise when the sizes are mismatched.
Currently authors could use devicePixelRatio and rounding in order to approximate this, but due to implementation differences in pixel snapping, can still get the wrong answer. Additionally, this can be affected by position changes which authors cannot currently hook into in a reasonable manner.