diff --git a/components/style/context.rs b/components/style/context.rs index 85dcd2a20fa..5ed3f06c6bc 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -206,7 +206,7 @@ impl CascadeInputs { pub fn new_from_style(style: &ComputedValues) -> Self { CascadeInputs { rules: style.rules.clone(), - visited_rules: style.get_visited_style().and_then(|v| v.rules.clone()), + visited_rules: style.visited_style().and_then(|v| v.rules.clone()), } } } diff --git a/components/style/matching.rs b/components/style/matching.rs index bacd79977d0..895fbe74320 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -126,7 +126,7 @@ trait PrivateMatchMethods: TElement { let inputs = CascadeInputs { rules: Some(without_transition_rules), - visited_rules: primary_style.get_visited_style().and_then(|s| s.rules.clone()), + visited_rules: primary_style.visited_rules().cloned() }; // Actually `PseudoElementResolution` doesn't really matter. diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index f61ebdef79a..a322abbf3fb 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2100,16 +2100,16 @@ impl ComputedValues { self.visited_style.is_some() } - /// Gets a reference to the visited style, if any. - pub fn get_visited_style(&self) -> Option<<&ComputedValues> { - self.visited_style.as_ref().map(|x| &**x) - } - /// Gets a reference to the rule node. Panic if no rule node exists. pub fn rules(&self) -> &StrongRuleNode { self.rules.as_ref().unwrap() } + /// Returns the visited style, if any. + pub fn visited_style(&self) -> Option<<&ComputedValues> { + self.visited_style.as_ref().map(|s| &**s) + } + /// Returns the visited rules, if applicable. pub fn visited_rules(&self) -> Option<<&StrongRuleNode> { self.visited_style.as_ref().and_then(|s| s.rules.as_ref()) diff --git a/components/style/style_resolver.rs b/components/style/style_resolver.rs index 8c026a28d83..30d97f5f240 100644 --- a/components/style/style_resolver.rs +++ b/components/style/style_resolver.rs @@ -293,7 +293,7 @@ where pseudo: Option<&PseudoElement>, ) -> ResolvedStyle { let mut style_if_visited = None; - if parent_style.map_or(false, |s| s.get_visited_style().is_some()) || + if parent_style.map_or(false, |s| s.visited_style().is_some()) || inputs.visited_rules.is_some() { style_if_visited = Some(self.cascade_style( inputs.visited_rules.as_ref().or(inputs.rules.as_ref()), @@ -384,7 +384,7 @@ where }; let mut visited_rules = None; - if originating_element_style.style().get_visited_style().is_some() { + if originating_element_style.style().visited_style().is_some() { visited_rules = self.match_pseudo( originating_element_style.style(), pseudo, @@ -567,7 +567,7 @@ where // visitedness of the relevant link should influence style. if pseudo.is_some() || !self.element.is_link() { parent_style = parent_style.map(|s| { - s.get_visited_style().unwrap_or(s) + s.visited_style().unwrap_or(s) }); } cascade_flags.insert(VISITED_DEPENDENT_ONLY); diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 47dfcad1aa5..98be2a39f4b 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -893,7 +893,7 @@ impl Stylist { ) -> Arc { // We need to compute visited values if we have visited rules or if our // parent has visited values. - let visited_values = if inputs.visited_rules.is_some() || parent_style.get_visited_style().is_some() { + let visited_values = if inputs.visited_rules.is_some() || parent_style.visited_style().is_some() { // Slightly annoying: we know that inputs has either rules or // visited rules, but we can't do inputs.rules() up front because // maybe it just has visited rules, so can't unwrap_or. @@ -913,11 +913,11 @@ impl Stylist { // We want to use the visited bits (if any) from our parent // style as our parent. inherited_style = - parent_style.get_visited_style().unwrap_or(parent_style); + parent_style.visited_style().unwrap_or(parent_style); inherited_style_ignoring_first_line = - parent_style_ignoring_first_line.get_visited_style().unwrap_or(parent_style_ignoring_first_line); + parent_style_ignoring_first_line.visited_style().unwrap_or(parent_style_ignoring_first_line); layout_parent_style_for_visited = - layout_parent_style.get_visited_style().unwrap_or(layout_parent_style); + layout_parent_style.visited_style().unwrap_or(layout_parent_style); } Some(properties::cascade(