lightningcss icon indicating copy to clipboard operation
lightningcss copied to clipboard

z-index rounded

Open damusnet opened this issue 2 years ago • 3 comments

Any z-index value above 999999 seems to get rounded:

image

Despite 2147483647 being the seemingly most common answer for max z-index value:

most browsers limit it to signed 32-bit values (−2147483648 to +2147483647) in practice

damusnet avatar May 03 '22 01:05 damusnet

Similar problems exist with <integer> values in other properties.

input

.foo {
    aspect-ratio: 99999988888;
    column-count: 99999988888;
    counter-increment: my-counter 99999988888;
}

Output

.foo {
  aspect-ratio: 100000000000;
  column-count: 100000000000;
  counter-increment: my-counter 100000000000;
}

yisibl avatar May 11 '22 06:05 yisibl

Appears to be the default behavior in rust-cssparser when serializing number tokens. Any property we don't explicitly parse, or when the value is a raw token (eg with var() references) relies on that. Might need to file an issue there: https://github.com/servo/rust-cssparser/blob/master/src/serializer.rs

devongovett avatar May 11 '22 13:05 devongovett

That looks like it will need to rely on an upstream solution.

yisibl avatar May 12 '22 03:05 yisibl

Ran into a similar issue today with a number with lots of decimal places being rounded prematurely. I didn't see a dedicated issue on the rust-cssparser repo, but I commented on a related one: https://github.com/servo/rust-cssparser/pull/173#issuecomment-1295312238

Scotchester avatar Oct 28 '22 18:10 Scotchester