mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Make font-size: larger/smaller work with the base size stuff
This commit is contained in:
parent
e23c8f1f3c
commit
e4d39b5476
4 changed files with 14 additions and 6 deletions
|
@ -741,6 +741,10 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
}
|
||||
% endif
|
||||
|
||||
/// This is the ratio applied for font-size: larger
|
||||
/// and smaller by both Firefox and Chrome
|
||||
const LARGER_FONT_SIZE_RATIO: f32 = 1.2;
|
||||
|
||||
impl SpecifiedValue {
|
||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size
|
||||
pub fn from_html_size(size: u8) -> Self {
|
||||
|
@ -768,6 +772,10 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
return Some(em)
|
||||
}
|
||||
}
|
||||
} else if let SpecifiedValue::Larger = *self {
|
||||
return Some(LARGER_FONT_SIZE_RATIO)
|
||||
} else if let SpecifiedValue::Smaller = *self {
|
||||
return Some(1. / LARGER_FONT_SIZE_RATIO)
|
||||
}
|
||||
None
|
||||
}
|
||||
|
@ -799,11 +807,11 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
key.to_computed_value(context).scale_by(fraction)
|
||||
}
|
||||
SpecifiedValue::Smaller => {
|
||||
FontRelativeLength::Em(0.85)
|
||||
FontRelativeLength::Em(1. / LARGER_FONT_SIZE_RATIO)
|
||||
.to_computed_value(context, base_size)
|
||||
}
|
||||
SpecifiedValue::Larger => {
|
||||
FontRelativeLength::Em(1.2)
|
||||
FontRelativeLength::Em(LARGER_FONT_SIZE_RATIO)
|
||||
.to_computed_value(context, base_size)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue