diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 4a5f213d976..3c7c8a722f1 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -132,11 +132,13 @@ impl FontRelativeLength { match *self { FontRelativeLength::Em(length) => { - if matches!(base_size, FontBaseSize::CurrentStyle) { - context.rule_cache_conditions.borrow_mut() - .set_font_size_dependency( - reference_font_size.into() - ); + if context.for_non_inherited_property.is_some() { + if matches!(base_size, FontBaseSize::CurrentStyle) { + context.rule_cache_conditions.borrow_mut() + .set_font_size_dependency( + reference_font_size.into() + ); + } } (reference_font_size, length) },