stylo: Add support for calcs in base size calculation

This tracks an offset along with the ratio for the keyword font size
data. The offset gets used when a calc is involved whilst inheriting
font-size (it is the computed value of that calc ignoring em/percentage
portions, which go into the ratio). If the family or language changes,
the new font size can be computed by taking the keyword's size in the context
of that family/language, multiplying it by the ratio, and adding the
offset.
This commit is contained in:
Manish Goregaokar 2017-09-09 01:10:50 -07:00 committed by Manish Goregaokar
parent 1ad9463558
commit 6318969269
3 changed files with 58 additions and 29 deletions

View file

@ -113,6 +113,12 @@ impl CalcLengthOrPercentage {
#[inline]
pub fn length(&self) -> Au {
debug_assert!(self.percentage.is_none());
self.length_component()
}
/// Returns the length component of this `calc()`
#[inline]
pub fn length_component(&self) -> Au {
self.clamping_mode.clamp(self.length)
}