Simplify our setup for font metric queries from style

This is a backport of https://phabricator.services.mozilla.com/D157589,
by Emilio Cobos Álvarez, plus some additions so that Servo compiles,
and some parts from https://phabricator.services.mozilla.com/D144455.

Should have no change in behavior.
This commit is contained in:
Oriol Brufau 2023-05-10 03:34:29 +02:00
parent feaa66b597
commit ab2ba273e3
21 changed files with 172 additions and 322 deletions

View file

@ -7,7 +7,6 @@
use crate::context::QuirksMode;
use crate::custom_properties::CustomPropertiesBuilder;
use crate::dom::TElement;
use crate::font_metrics::FontMetricsProvider;
use crate::logical_geometry::WritingMode;
use crate::media_queries::Device;
use crate::properties::{
@ -82,7 +81,6 @@ pub fn cascade<E>(
parent_style_ignoring_first_line: Option<&ComputedValues>,
layout_parent_style: Option<&ComputedValues>,
visited_rules: Option<&StrongRuleNode>,
font_metrics_provider: &dyn FontMetricsProvider,
quirks_mode: QuirksMode,
rule_cache: Option<&RuleCache>,
rule_cache_conditions: &mut RuleCacheConditions,
@ -99,7 +97,6 @@ where
parent_style,
parent_style_ignoring_first_line,
layout_parent_style,
font_metrics_provider,
CascadeMode::Unvisited { visited_rules },
quirks_mode,
rule_cache,
@ -197,7 +194,6 @@ fn cascade_rules<E>(
parent_style: Option<&ComputedValues>,
parent_style_ignoring_first_line: Option<&ComputedValues>,
layout_parent_style: Option<&ComputedValues>,
font_metrics_provider: &dyn FontMetricsProvider,
cascade_mode: CascadeMode,
quirks_mode: QuirksMode,
rule_cache: Option<&RuleCache>,
@ -220,7 +216,6 @@ where
parent_style,
parent_style_ignoring_first_line,
layout_parent_style,
font_metrics_provider,
cascade_mode,
quirks_mode,
rule_cache,
@ -256,7 +251,6 @@ pub fn apply_declarations<'a, E, I>(
parent_style: Option<&ComputedValues>,
parent_style_ignoring_first_line: Option<&ComputedValues>,
layout_parent_style: Option<&ComputedValues>,
font_metrics_provider: &dyn FontMetricsProvider,
cascade_mode: CascadeMode,
quirks_mode: QuirksMode,
rule_cache: Option<&RuleCache>,
@ -317,7 +311,6 @@ where
in_media_query: false,
for_smil_animation: false,
for_non_inherited_property: None,
font_metrics_provider,
quirks_mode,
rule_cache_conditions: RefCell::new(rule_cache_conditions),
};
@ -762,7 +755,6 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
visited_parent!(parent_style),
visited_parent!(parent_style_ignoring_first_line),
visited_parent!(layout_parent_style),
self.context.font_metrics_provider,
CascadeMode::Visited { writing_mode },
self.context.quirks_mode,
// The rule cache doesn't care about caching :visited