mirror of
https://github.com/servo/servo.git
synced 2025-06-21 23:59:00 +01:00
style: Fix rem computation on the root element.
Bug: 1375930 Reviewed-By: heycam MozReview-Commit-ID: DK98SS1w5nO
This commit is contained in:
parent
946c9aede1
commit
6f57a9b4ba
1 changed files with 13 additions and 2 deletions
|
@ -112,7 +112,6 @@ impl FontRelativeLength {
|
|||
|
||||
let reference_font_size = base_size.resolve(context);
|
||||
|
||||
let root_font_size = context.device.root_font_size();
|
||||
match *self {
|
||||
FontRelativeLength::Em(length) => reference_font_size.scale_by(length),
|
||||
FontRelativeLength::Ex(length) => {
|
||||
|
@ -149,7 +148,19 @@ impl FontRelativeLength {
|
|||
}
|
||||
}
|
||||
}
|
||||
FontRelativeLength::Rem(length) => root_font_size.scale_by(length)
|
||||
FontRelativeLength::Rem(length) => {
|
||||
// https://drafts.csswg.org/css-values/#rem:
|
||||
//
|
||||
// When specified on the font-size property of the root
|
||||
// element, the rem units refer to the property’s initial
|
||||
// value.
|
||||
//
|
||||
if context.is_root_element {
|
||||
reference_font_size.scale_by(length)
|
||||
} else {
|
||||
context.device.root_font_size().scale_by(length)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue