style: Remove get_animation_rule_by_cascade.

It's pretty useless.
This commit is contained in:
Emilio Cobos Álvarez 2018-02-24 21:00:42 +01:00
parent 8d34aacb3b
commit c5bfc81b74
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 15 additions and 36 deletions

View file

@ -19,7 +19,6 @@ use media_queries::Device;
use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock}; use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
#[cfg(feature = "gecko")] use properties::LonghandId; #[cfg(feature = "gecko")] use properties::LonghandId;
#[cfg(feature = "gecko")] use properties::animated_properties::AnimationValue; #[cfg(feature = "gecko")] use properties::animated_properties::AnimationValue;
use rule_tree::CascadeLevel;
use selector_parser::{AttrValue, PseudoClassStringArg, PseudoElement, SelectorImpl}; use selector_parser::{AttrValue, PseudoClassStringArg, PseudoElement, SelectorImpl};
use selectors::Element as SelectorsElement; use selectors::Element as SelectorsElement;
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode}; use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
@ -443,13 +442,6 @@ pub trait TElement
None None
} }
/// Get this element's animation rule by the cascade level.
fn get_animation_rule_by_cascade(&self,
_cascade_level: CascadeLevel)
-> Option<Arc<Locked<PropertyDeclarationBlock>>> {
None
}
/// Get the combined animation and transition rules. /// Get the combined animation and transition rules.
fn get_animation_rules(&self) -> AnimationRules { fn get_animation_rules(&self) -> AnimationRules {
if !self.may_have_animations() { if !self.may_have_animations() {

View file

@ -1084,17 +1084,6 @@ impl<'le> TElement for GeckoElement<'le> {
} }
} }
fn get_animation_rule_by_cascade(
&self,
cascade_level: ServoCascadeLevel,
) -> Option<Arc<Locked<PropertyDeclarationBlock>>> {
match cascade_level {
ServoCascadeLevel::Animations => self.get_animation_rule(),
ServoCascadeLevel::Transitions => self.get_transition_rule(),
_ => panic!("Unsupported cascade level for getting the animation rule")
}
}
fn get_animation_rule( fn get_animation_rule(
&self, &self,
) -> Option<Arc<Locked<PropertyDeclarationBlock>>> { ) -> Option<Arc<Locked<PropertyDeclarationBlock>>> {

View file

@ -764,29 +764,27 @@ pub trait MatchMethods : TElement {
debug_assert!(context.shared.traversal_flags.for_animation_only()); debug_assert!(context.shared.traversal_flags.for_animation_only());
if replacements.contains(RestyleHint::RESTYLE_SMIL) { if replacements.contains(RestyleHint::RESTYLE_SMIL) {
replace_rule_node(CascadeLevel::SMILOverride, replace_rule_node(
self.get_smil_override(), CascadeLevel::SMILOverride,
primary_rules); self.get_smil_override(),
primary_rules,
);
} }
let replace_rule_node_for_animation = |level: CascadeLevel,
primary_rules: &mut StrongRuleNode| {
let animation_rule = self.get_animation_rule_by_cascade(level);
replace_rule_node(level,
animation_rule.as_ref().map(|a| a.borrow_arc()),
primary_rules);
};
// Apply Transition rules and Animation rules if the corresponding restyle hint
// is contained.
if replacements.contains(RestyleHint::RESTYLE_CSS_TRANSITIONS) { if replacements.contains(RestyleHint::RESTYLE_CSS_TRANSITIONS) {
replace_rule_node_for_animation(CascadeLevel::Transitions, replace_rule_node(
primary_rules); CascadeLevel::Transitions,
self.get_transition_rule().as_ref().map(|a| a.borrow_arc()),
primary_rules,
);
} }
if replacements.contains(RestyleHint::RESTYLE_CSS_ANIMATIONS) { if replacements.contains(RestyleHint::RESTYLE_CSS_ANIMATIONS) {
replace_rule_node_for_animation(CascadeLevel::Animations, replace_rule_node(
primary_rules); CascadeLevel::Animations,
self.get_animation_rule().as_ref().map(|a| a.borrow_arc()),
primary_rules,
);
} }
} }