layout: Resolve word_spacing ahead of time.

It's not possible anymore, in the presence of min() / max(), to split a
<length-percentage> value into a <length> and a <percentage> component.

Tweak word_spacing to do what Gecko does (resolving it in advance).
This commit is contained in:
Emilio Cobos Álvarez 2020-02-10 16:50:57 +01:00
parent e227715aee
commit f03026b869
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
8 changed files with 45 additions and 24 deletions

View file

@ -434,9 +434,7 @@ impl Shaper {
// We elect to only space the two required code points.
if character == ' ' || character == '\u{a0}' {
// https://drafts.csswg.org/css-text-3/#word-spacing-property
let (length, percent) = options.word_spacing;
advance =
(advance + length) + Au::new((advance.0 as f32 * percent.into_inner()) as i32);
advance += options.word_spacing;
}
advance