Bug 1346663 - Add a function that returns new rules by removing transition level rule. r?emilio
This will be used for after-change-style of CSS Transition.
MozReview-Commit-ID: 8voi4hDTAMP
--- a/servo/components/style/rule_tree/mod.rs
+++ b/servo/components/style/rule_tree/mod.rs
@@ -234,16 +234,27 @@ impl RuleTree {
}
}
}
// Now the rule is in the relevant place, push the children as
// necessary.
Some(self.insert_ordered_rules_from(current, children.into_iter().rev()))
}
+
+ /// Returns new rule nodes without Transitions level rule.
+ /// Note: this funciton supposes that rule nodes have been already ordered.
+ pub fn remove_transition_rule(&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
/// doing a GC when calling maybe_gc(). (The value is copied from Gecko,
/// where it likely did not result from a rigorous performance analysis.)
const RULE_TREE_GC_INTERVAL: usize = 300;
/// The cascade level these rules are relevant at, as per[1].