mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
bdbe8fde42
commit
42abdb99c4
2 changed files with 18 additions and 13 deletions
|
@ -57,19 +57,24 @@ bitflags! {
|
|||
/// Whether the child explicitly inherits any reset property.
|
||||
const INHERITS_RESET_STYLE = 1 << 8;
|
||||
|
||||
/// Whether any value on our style is font-metric-dependent.
|
||||
const DEPENDS_ON_FONT_METRICS = 1 << 9;
|
||||
/// Whether any value on our style is font-metric-dependent on our
|
||||
/// primary font.
|
||||
const DEPENDS_ON_SELF_FONT_METRICS = 1 << 9;
|
||||
|
||||
/// Whether any value on our style is font-metric-dependent on the
|
||||
/// primary font of our parent.
|
||||
const DEPENDS_ON_INHERITED_FONT_METRICS = 1 << 10;
|
||||
|
||||
/// Whether the style or any of the ancestors has a multicol style.
|
||||
///
|
||||
/// Only used in Servo.
|
||||
const CAN_BE_FRAGMENTED = 1 << 10;
|
||||
const CAN_BE_FRAGMENTED = 1 << 11;
|
||||
|
||||
/// Whether this style is the style of the document element.
|
||||
const IS_ROOT_ELEMENT_STYLE = 1 << 11;
|
||||
const IS_ROOT_ELEMENT_STYLE = 1 << 12;
|
||||
|
||||
/// Whether this element is inside an `opacity: 0` subtree.
|
||||
const IS_IN_OPACITY_ZERO_SUBTREE = 1 << 12;
|
||||
const IS_IN_OPACITY_ZERO_SUBTREE = 1 << 13;
|
||||
|
||||
/// Whether there are author-specified rules for border-* properties
|
||||
/// (except border-image-*), background-color, or background-image.
|
||||
|
@ -77,13 +82,13 @@ bitflags! {
|
|||
/// TODO(emilio): Maybe do include border-image, see:
|
||||
///
|
||||
/// https://github.com/w3c/csswg-drafts/issues/4777#issuecomment-604424845
|
||||
const HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND = 1 << 13;
|
||||
const HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND = 1 << 14;
|
||||
|
||||
/// Whether there are author-specified rules for padding-* properties.
|
||||
///
|
||||
/// FIXME(emilio): Try to merge this with BORDER_BACKGROUND, see
|
||||
/// https://github.com/w3c/csswg-drafts/issues/4777
|
||||
const HAS_AUTHOR_SPECIFIED_PADDING = 1 << 14;
|
||||
const HAS_AUTHOR_SPECIFIED_PADDING = 1 << 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue