diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index e4df1b77ec3..12d830e5fad 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -468,6 +468,10 @@ impl<'le> TElement for ServoLayoutElement<'le> { fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool { panic!("this should be only called on gecko"); } + + fn has_css_transitions(&self, _pseudo: Option<&PseudoElement>) -> bool { + panic!("this should be only called on gecko"); + } } impl<'le> PartialEq for ServoLayoutElement<'le> { diff --git a/components/style/dom.rs b/components/style/dom.rs index 0221160b3e9..f56194fb14b 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -472,6 +472,9 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone + /// Returns true if the element has a CSS animation. fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool; + /// Returns true if the element has a CSS transition. + fn has_css_transitions(&self, _pseudo: Option<&PseudoElement>) -> bool; + /// Returns true if the element has animation restyle hints. fn has_animation_restyle_hints(&self) -> bool { let data = match self.borrow_data() { diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 45dce1d304a..d429c905b71 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -34,6 +34,7 @@ use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags}; use gecko_bindings::bindings::Gecko_ClassOrClassList; use gecko_bindings::bindings::Gecko_ElementHasAnimations; use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations; +use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions; use gecko_bindings::bindings::Gecko_GetAnimationRule; use gecko_bindings::bindings::Gecko_GetExtraContentStyleDeclarations; use gecko_bindings::bindings::Gecko_GetHTMLPresentationAttrDeclarationBlock; @@ -709,6 +710,11 @@ impl<'le> TElement for GeckoElement<'le> { let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo); unsafe { Gecko_ElementHasCSSAnimations(self.0, atom_ptr) } } + + fn has_css_transitions(&self, pseudo: Option<&PseudoElement>) -> bool { + let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo); + unsafe { Gecko_ElementHasCSSTransitions(self.0, atom_ptr) } + } } impl<'le> PartialEq for GeckoElement<'le> { diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 2d66af833c4..bd7b434c5d8 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -648,6 +648,11 @@ extern "C" { aPseudoTagOrNull: *mut nsIAtom) -> bool; } +extern "C" { + pub fn Gecko_ElementHasCSSTransitions(aElement: RawGeckoElementBorrowed, + aPseudoTagOrNull: *mut nsIAtom) + -> bool; +} extern "C" { pub fn Gecko_GetProgressFromComputedTiming(aComputedTiming: RawGeckoComputedTimingBorrowed)