diff --git a/components/style/properties/computed_value_flags.rs b/components/style/properties/computed_value_flags.rs index 4ddc9a1f42a..931aef00020 100644 --- a/components/style/properties/computed_value_flags.rs +++ b/components/style/properties/computed_value_flags.rs @@ -56,13 +56,10 @@ bitflags! { /// Whether the child explicitly inherits any reset property. const INHERITS_RESET_STYLE = 1 << 8; - /// A flag to mark a style which is a visited style. - const IS_STYLE_IF_VISITED = 1 << 9; - /// 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 << 9; } } @@ -70,7 +67,6 @@ impl ComputedValueFlags { /// Flags that are unconditionally propagated to descendants. #[inline] fn inherited_flags() -> Self { - ComputedValueFlags::IS_STYLE_IF_VISITED | ComputedValueFlags::IS_RELEVANT_LINK_VISITED | ComputedValueFlags::CAN_BE_FRAGMENTED | ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE | diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 66e256a242a..64cde6fe793 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2692,11 +2692,6 @@ impl ComputedValues { self.get_box().clone_display().is_contents() } - /// Whether we're a visited style. - pub fn is_style_if_visited(&self) -> bool { - self.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED) - } - /// Gets a reference to the rule node. Panic if no rule node exists. pub fn rules(&self) -> &StrongRuleNode { self.rules.as_ref().unwrap() @@ -3225,7 +3220,6 @@ impl<'a> StyleBuilder<'a> { parent_style: Option<<&'a ComputedValues>, parent_style_ignoring_first_line: Option<<&'a ComputedValues>, pseudo: Option<<&'a PseudoElement>, - cascade_mode: CascadeMode, rules: Option, custom_properties: Option>, ) -> Self { @@ -3248,10 +3242,7 @@ impl<'a> StyleBuilder<'a> { reset_style }; - let mut flags = inherited_style.flags.inherited(); - if matches!(cascade_mode, CascadeMode::Visited { .. }) { - flags.insert(ComputedValueFlags::IS_STYLE_IF_VISITED); - } + let flags = inherited_style.flags.inherited(); StyleBuilder { device, @@ -3275,11 +3266,6 @@ impl<'a> StyleBuilder<'a> { } } - /// Whether we're a visited style. - pub fn is_style_if_visited(&self) -> bool { - self.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED) - } - /// NOTE(emilio): This is done so we can compute relative units with respect /// to the parent style, but all the early properties / writing-mode / etc /// are already set to the right ones on the kid. @@ -3420,11 +3406,6 @@ impl<'a> StyleBuilder<'a> { // produced by this builder. This assumes that the caller doesn't need // to adjust or process visited style, so we can just build visited // style here for simplicity. - // - // FIXME(emilio): This doesn't set the IS_STYLE_IF_VISITED flag - // correctly, though right now it doesn't matter. - // - // We can probably kill that flag now. let visited_style = parent.and_then(|parent| { parent.visited_style().map(|style| { Self::for_inheritance( @@ -3439,7 +3420,6 @@ impl<'a> StyleBuilder<'a> { parent, parent, pseudo, - CascadeMode::Unvisited { visited_rules: None }, /* rules = */ None, parent.and_then(|p| p.custom_properties().cloned()), ); @@ -3851,7 +3831,6 @@ where parent_style, parent_style_ignoring_first_line, pseudo, - cascade_mode, Some(rules.clone()), custom_properties, ), @@ -4012,7 +3991,11 @@ where font_metrics_provider, CascadeMode::Visited { writing_mode }, quirks_mode, - rule_cache, + // The rule cache doesn't care about caching :visited + // styles, we cache the unvisited style instead. We still do + // need to set the caching dependencies properly if present + // though, so the cache conditions need to match. + /* rule_cache = */ None, &mut *context.rule_cache_conditions.borrow_mut(), element, )); diff --git a/components/style/rule_cache.rs b/components/style/rule_cache.rs index 214b104b5a0..1bd65775e3a 100644 --- a/components/style/rule_cache.rs +++ b/components/style/rule_cache.rs @@ -124,11 +124,6 @@ impl RuleCache { guards: &StylesheetGuards, builder_with_early_props: &StyleBuilder, ) -> Option<&ComputedValues> { - if builder_with_early_props.is_style_if_visited() { - // FIXME(emilio): We can probably do better, does it matter much? - return None; - } - // A pseudo-element with property restrictions can result in different // computed values if it's also used for a non-pseudo. if builder_with_early_props @@ -166,11 +161,6 @@ impl RuleCache { return false; } - if style.is_style_if_visited() { - // FIXME(emilio): We can probably do better, does it matter much? - return false; - } - // A pseudo-element with property restrictions can result in different // computed values if it's also used for a non-pseudo. if pseudo.and_then(|p| p.property_restriction()).is_some() { diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index 5a65429a550..704c875a932 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -684,11 +684,6 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { ) where E: TElement, { - debug_assert!( - !self.style.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED), - "Adjusting visited styles is wasted work" - ); - if cfg!(debug_assertions) { if element .and_then(|e| e.implemented_pseudo_element())