style: Fix font loading invalidation to account for metrics coming from the parent style.

We were only looking at the given frame's style, which is not
sufficient for this case.

Differential Revision: https://phabricator.services.mozilla.com/D96237
This commit is contained in:
Emilio Cobos Álvarez 2020-11-06 22:30:28 +00:00
parent bdbe8fde42
commit 42abdb99c4
2 changed files with 18 additions and 13 deletions

View file

@ -161,6 +161,10 @@ impl FontRelativeLength {
}
let reference_font_size = base_size.resolve(context);
let font_metrics_flag = match base_size {
FontBaseSize::CurrentStyle => ComputedValueFlags::DEPENDS_ON_SELF_FONT_METRICS,
FontBaseSize::InheritedStyle => ComputedValueFlags::DEPENDS_ON_INHERITED_FONT_METRICS,
};
match *self {
FontRelativeLength::Em(length) => {
if context.for_non_inherited_property.is_some() {
@ -178,9 +182,7 @@ impl FontRelativeLength {
if context.for_non_inherited_property.is_some() {
context.rule_cache_conditions.borrow_mut().set_uncacheable();
}
context
.builder
.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS);
context.builder.add_flags(font_metrics_flag);
// The x-height is an intrinsically horizontal metric.
let metrics =
query_font_metrics(context, base_size, FontMetricsOrientation::Horizontal);
@ -199,9 +201,7 @@ impl FontRelativeLength {
if context.for_non_inherited_property.is_some() {
context.rule_cache_conditions.borrow_mut().set_uncacheable();
}
context
.builder
.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS);
context.builder.add_flags(font_metrics_flag);
// https://drafts.csswg.org/css-values/#ch:
//
// Equal to the used advance measure of the “0” (ZERO,