From 959f1c8360733a02d9615d5337aaa7f63469c433 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Fri, 24 Mar 2017 09:54:36 +0900 Subject: [PATCH] Add a function that returns new rules by removing transition level rule. This will be used for after-change-style of CSS Transition. --- components/style/rule_tree/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 54cf785e458..f9c92fa3c25 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -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