Repository navigation
[css-text-decor-4] Clarified constraints for thickness length and percentage #7283 - #7284
Conversation
…tage The current sentence could be interpreted as performing a `floor` on the actual calculated value, while it is actually rounded to the nearest integer, with a minimum value of one. Equivalent to: `x = min(1, round(x))`
dbaron
left a comment
There was a problem hiding this comment.
I'm a little worried that putting the key bit about flooring in the single word "positive" might hide it from many readers. I think it's still worth having two separate clauses to mention the round-to-nearest-device-pixel behavior and the minimum-of-one-device-pixel behavior.
Also, you should put "Fixes #7283" in the commit message so that the issue is linked.
I defer to David about the best way to phrase spec language for clarity, so I'm okay with switching back to the two-clause approach. Re: mentioning "device pixels". The Chrome implementation doesn't generally have access to pixel snapping at this place in the pipeline. As an example, would spec language referring to pixel snapping here require that we re-snap every frame when under a scale transform animation? |
|
How does this sound?
|
We still need to say something about what units the numbers have. There's no default here. Are you suggesting that what's really relevant here is raster pixels, which are usually but not always device pixels? |
|
@dbaron, after playing with this a bit, I think I have a better understanding of what device pixels means. When loading the following example on a highdpi (dsf=2) monitor, the blue and green lines have the same thickness (in Chrome Canary and Firefox), but the red line is thicker. This is because Chrome/Firefox draw the blue and green lines at (1.1 css pixels * dsf (2)) = 2 device pixels, whereas the red line draws at round(1.4 css pixels * dsf (2)) = 3 device pixels. Is this dsf behavior what is meant by device pixels? If so, I agree that referring to device pixels makes sense. We would not want to round to css pixels (e.g., (round(1.4 css pixels) * dsf (2)) = 2 device pixels for the red line) because that would limit the granularity of the decoration thickness on highdpi monitors. |
|
@progers Yes, that's the core of the reason to refer to device pixels rather than some other length unit like CSS pixels. However, as you point out in #7284 (comment) , I think this isn't quite right. I've filed #7287 to improve the situation, but I think given current terminology it's probably good enough to continue to refer to device pixels here (as the existing spec text already does). |
|
Thank you for the suggestions! |
The current sentence could be interpreted as performing a
flooron the actual calculated value, while it is actually rounded to the nearest integer, with a minimum value of one.Equivalent to:
x = min(1, round(x))Fixes #7283