Closed Bug 1396045 Opened 4 years ago Closed 4 years ago

stylo: Round down when dealing with relative units

Categories

(Core :: CSS Parsing and Computation, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: manishearth, Assigned: manishearth)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

./layout/reftests/pixel-rounding/viewport-units-rounding-1.html

Gecko rounds viewport units downwards in case someone does something like five adjacent elements of width 20vw and it overflows. We should do the same.
Priority: -- → P2
See Also: → 989802
Comment on attachment 8903811 [details]
Bug 1396045 - stylo: Update app_units ;

https://reviewboard.mozilla.org/r/175566/#review180666
Attachment #8903811 - Flags: review?(emilio) → review+
Comment on attachment 8903812 [details]
Bug 1396045 - stylo: Round down when computing viewport units;

https://reviewboard.mozilla.org/r/175568/#review180668

r=me, assuming it's tested.

::: servo/components/style/values/specified/length.rs:216
(Diff revision 1)
>              ViewportPercentageLength::Vmin(length) =>
> -                length * to_unit!(cmp::min(viewport_size.width, viewport_size.height)),
> +                (length, cmp::min(viewport_size.width, viewport_size.height)),
>              ViewportPercentageLength::Vmax(length) =>
> -                length * to_unit!(cmp::max(viewport_size.width, viewport_size.height)),
> +                (length, cmp::max(viewport_size.width, viewport_size.height)),
>          };
> -        Au::from_f32_px(value)
> +        

trailing whitespace.
Attachment #8903812 - Flags: review?(emilio) → review+
This makes viewport-units-rounding-2.html fail, but only by a tiny bit :|
The failure was due to rounding instead of truncating. Fixed.
The test is still fuzzy because of differing rounding between stylo and gecko, but this isn't the important rounding (it used to fail because the divs would overflow the container)
Pushed by manishearth@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/4247bc5eed01
stylo: Round down when computing viewport units; r=emilio
https://hg.mozilla.org/mozilla-central/rev/4247bc5eed01
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.