mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Split get_animation_rules into get_animation_rule and get_transition_rule.
If an element has only CSS animations we don't need to get transition rule, and vice versa. This will be used when we implement eRestyle_CSSAnimations and eRestyle_CSSTransitions.
This commit is contained in:
parent
88c69206eb
commit
ba18c14b91
2 changed files with 25 additions and 5 deletions
|
@ -259,6 +259,18 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre
|
|||
AnimationRules(None, None)
|
||||
}
|
||||
|
||||
/// Get this element's animation rule.
|
||||
fn get_animation_rule(&self, _pseudo: Option<&PseudoElement>)
|
||||
-> Option<Arc<RwLock<PropertyDeclarationBlock>>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Get this element's transition rule.
|
||||
fn get_transition_rule(&self, _pseudo: Option<&PseudoElement>)
|
||||
-> Option<Arc<RwLock<PropertyDeclarationBlock>>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Get this element's state, for non-tree-structural pseudos.
|
||||
fn get_state(&self) -> ElementState;
|
||||
|
||||
|
|
|
@ -416,12 +416,20 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
|
||||
fn get_animation_rules(&self, pseudo: Option<&PseudoElement>) -> AnimationRules {
|
||||
AnimationRules(self.get_animation_rule(pseudo),
|
||||
self.get_transition_rule(pseudo))
|
||||
}
|
||||
|
||||
fn get_animation_rule(&self, pseudo: Option<&PseudoElement>)
|
||||
-> Option<Arc<RwLock<PropertyDeclarationBlock>>> {
|
||||
let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo);
|
||||
unsafe {
|
||||
AnimationRules(
|
||||
Gecko_GetAnimationRule(self.0, atom_ptr, CascadeLevel::Animations).into_arc_opt(),
|
||||
Gecko_GetAnimationRule(self.0, atom_ptr, CascadeLevel::Transitions).into_arc_opt())
|
||||
}
|
||||
unsafe { Gecko_GetAnimationRule(self.0, atom_ptr, CascadeLevel::Animations).into_arc_opt() }
|
||||
}
|
||||
|
||||
fn get_transition_rule(&self, pseudo: Option<&PseudoElement>)
|
||||
-> Option<Arc<RwLock<PropertyDeclarationBlock>>> {
|
||||
let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo);
|
||||
unsafe { Gecko_GetAnimationRule(self.0, atom_ptr, CascadeLevel::Transitions).into_arc_opt() }
|
||||
}
|
||||
|
||||
fn get_state(&self) -> ElementState {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue