Bug 1341372 - Part 2: Support has_css_transitions.

Add one FFI to check if there is any transition in CSSTransitionCollection.
This will be used to check if we need to update transition and if we
should compute the after-change style.

MozReview-Commit-ID: 6HpVAtrx6Rc
This commit is contained in:
Boris Chiou 2017-04-17 14:25:10 +08:00
parent 1c1e487491
commit b1476f1f81
4 changed files with 18 additions and 0 deletions

View file

@ -468,6 +468,10 @@ impl<'le> TElement for ServoLayoutElement<'le> {
fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool { fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool {
panic!("this should be only called on gecko"); 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> { impl<'le> PartialEq for ServoLayoutElement<'le> {

View file

@ -472,6 +472,9 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
/// Returns true if the element has a CSS animation. /// Returns true if the element has a CSS animation.
fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool; 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. /// Returns true if the element has animation restyle hints.
fn has_animation_restyle_hints(&self) -> bool { fn has_animation_restyle_hints(&self) -> bool {
let data = match self.borrow_data() { let data = match self.borrow_data() {

View file

@ -34,6 +34,7 @@ use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::bindings::Gecko_ClassOrClassList; use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_ElementHasAnimations; use gecko_bindings::bindings::Gecko_ElementHasAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations; use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
use gecko_bindings::bindings::Gecko_GetAnimationRule; use gecko_bindings::bindings::Gecko_GetAnimationRule;
use gecko_bindings::bindings::Gecko_GetExtraContentStyleDeclarations; use gecko_bindings::bindings::Gecko_GetExtraContentStyleDeclarations;
use gecko_bindings::bindings::Gecko_GetHTMLPresentationAttrDeclarationBlock; 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); let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo);
unsafe { Gecko_ElementHasCSSAnimations(self.0, atom_ptr) } 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> { impl<'le> PartialEq for GeckoElement<'le> {

View file

@ -648,6 +648,11 @@ extern "C" {
aPseudoTagOrNull: *mut nsIAtom) aPseudoTagOrNull: *mut nsIAtom)
-> bool; -> bool;
} }
extern "C" {
pub fn Gecko_ElementHasCSSTransitions(aElement: RawGeckoElementBorrowed,
aPseudoTagOrNull: *mut nsIAtom)
-> bool;
}
extern "C" { extern "C" {
pub fn Gecko_GetProgressFromComputedTiming(aComputedTiming: pub fn Gecko_GetProgressFromComputedTiming(aComputedTiming:
RawGeckoComputedTimingBorrowed) RawGeckoComputedTimingBorrowed)