diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index 5a9b955b1c8..be8d0def121 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -93,9 +93,10 @@ impl PseudoElement { EAGER_PSEUDOS[i].clone() } - /// Whether the current pseudo element is animatable. + /// Whether animations for the current pseudo element are stored in the + /// parent element. #[inline] - pub fn is_animatable(&self) -> bool { + pub fn animations_stored_in_parent(&self) -> bool { matches!(*self, Self::Before | Self::After | Self::Marker) } diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index c41d2ff1e85..27f3eefe62e 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1390,15 +1390,14 @@ impl<'le> TElement for GeckoElement<'le> { #[inline] fn may_have_animations(&self) -> bool { if let Some(pseudo) = self.implemented_pseudo_element() { - if !pseudo.is_animatable() { - return false; + if pseudo.animations_stored_in_parent() { + // FIXME(emilio): When would the parent of a ::before / ::after + // pseudo-element be null? + return self.parent_element().map_or(false, |p| { + p.as_node() + .get_bool_flag(nsINode_BooleanFlag::ElementHasAnimations) + }); } - // FIXME(emilio): When would the parent of a ::before / ::after - // pseudo-element be null? - return self.parent_element().map_or(false, |p| { - p.as_node() - .get_bool_flag(nsINode_BooleanFlag::ElementHasAnimations) - }); } self.as_node() .get_bool_flag(nsINode_BooleanFlag::ElementHasAnimations)