mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
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:
parent
1ad9463558
commit
6318969269
3 changed files with 58 additions and 29 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue