Add a function that returns new rules by removing transition level rule.

This will be used for after-change-style of CSS Transition.
This commit is contained in:
Hiroyuki Ikezoe 2017-03-24 09:54:36 +09:00
parent 4c4b01954c
commit 959f1c8360

View file

@ -239,6 +239,16 @@ impl RuleTree {
// necessary.
Some(self.insert_ordered_rules_from(current, children.into_iter().rev()))
}
/// Returns new rule nodes without Transitions level rule.
pub fn remove_transition_rule_if_applicable(&self, path: &StrongRuleNode) -> StrongRuleNode {
// Return a clone if there is no transition level.
if path.cascade_level() != CascadeLevel::Transitions {
return path.clone();
}
path.parent().unwrap().clone()
}
}
/// The number of RuleNodes added to the free list before we will consider