style: Simplify calc expressions earlier.

This simplifies a bit the code, and guarantees that all calc()s have percentages
and lengths.

I also wanted to remove unclamped_length() / specified_percentage() (for the
same reason as the above patch), but they're needed for animations for now. When
I implement min() / max() for <length-percentage> they'll be fixed.

Differential Revision: https://phabricator.services.mozilla.com/D60194
This commit is contained in:
Emilio Cobos Álvarez 2020-01-23 09:18:39 +00:00
parent 5237d4fac8
commit 16e5331950
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
7 changed files with 67 additions and 140 deletions

View file

@ -97,7 +97,7 @@ impl ToComputedValue for LineHeight {
let computed_calc =
calc.to_computed_value_zoomed(context, FontBaseSize::CurrentStyle);
let base = context.style().get_font().clone_font_size().size();
computed_calc.percentage_relative_to(base)
computed_calc.resolve(base)
},
};
GenericLineHeight::Length(result.into())