diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index f9198c3ca5c..425805142c9 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -253,9 +253,10 @@ impl ops::DerefMut for ComputedValues { } impl ComputedValuesInner { - /// Whether we're a visited style. - pub fn is_style_if_visited(&self) -> bool { - self.flags.contains(IS_STYLE_IF_VISITED) + /// Clone the visited style. Used for inheriting parent styles in + /// StyleBuilder::for_inheritance. + pub fn clone_visited_style(&self) -> Option> { + self.visited_style.as_ref().map(|x| x.clone_arc()) } #[inline] @@ -291,37 +292,11 @@ impl ComputedValuesInner { } % endfor - /// Gets a reference to the rule node. Panic if no rule node exists. - pub fn rules(&self) -> &StrongRuleNode { - self.rules.as_ref().unwrap() - } - - /// Whether there is a visited style. - pub fn has_visited_style(&self) -> bool { - 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 the raw visited style. Useful for memory reporting. pub fn get_raw_visited_style(&self) -> &Option> { &self.visited_style } - /// Gets a reference to the visited style. Panic if no visited style exists. - pub fn visited_style(&self) -> &ComputedValues { - self.get_visited_style().unwrap() - } - - /// Clone the visited style. Used for inheriting parent styles in - /// StyleBuilder::for_inheritance. - pub fn clone_visited_style(&self) -> Option> { - self.visited_style.as_ref().map(|x| x.clone_arc()) - } - #[allow(non_snake_case)] pub fn has_moz_binding(&self) -> bool { !self.get_box().gecko.mBinding.mPtr.mRawPtr.is_null() diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 4345aecdfa9..eda93910730 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2090,6 +2090,26 @@ pub struct ComputedValues { } impl ComputedValues { + /// Whether we're a visited style. + pub fn is_style_if_visited(&self) -> bool { + self.flags.contains(IS_STYLE_IF_VISITED) + } + + /// Whether there is a visited style. + pub fn has_visited_style(&self) -> bool { + 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 rules, if applicable. pub fn visited_rules(&self) -> Option<<&StrongRuleNode> { self.visited_style.as_ref().and_then(|s| s.rules.as_ref()) @@ -2216,20 +2236,9 @@ impl ComputedValuesInner { self.rules.as_ref().unwrap() } - /// Whether there is a visited style. - pub fn has_visited_style(&self) -> bool { - 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 visited style. Panic if no visited style exists. - pub fn visited_style(&self) -> &ComputedValues { - self.get_visited_style().unwrap() - } + /// Whether this style has a -moz-binding value. This is always false for + /// Servo for obvious reasons. + pub fn has_moz_binding(&self) -> bool { false } /// Clone the visited style. Used for inheriting parent styles in /// StyleBuilder::for_inheritance. @@ -2237,15 +2246,6 @@ impl ComputedValuesInner { self.visited_style.clone() } - /// Whether this style has a -moz-binding value. This is always false for - /// Servo for obvious reasons. - pub fn has_moz_binding(&self) -> bool { false } - - /// Whether we're a visited style. - pub fn is_style_if_visited(&self) -> bool { - self.flags.contains(IS_STYLE_IF_VISITED) - } - /// Returns whether this style's display value is equal to contents. /// /// Since this isn't supported in Servo, this is always false for Servo.