aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/style/rule_tree/bench.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-01-29 02:59:54 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-01-30 23:53:53 +0100
commit314f2ce714e819bfd14da69a44b117cae7222fbd (patch)
treea7de2adb1001506ba8aa6051784dc1d13cfb3b7e /tests/unit/style/rule_tree/bench.rs
parent31ecc9b692f5108d479546af1e455f646e5439bb (diff)
downloadservo-314f2ce714e819bfd14da69a44b117cae7222fbd.tar.gz
servo-314f2ce714e819bfd14da69a44b117cae7222fbd.zip
style: Define a CascadeLevel enum, and make the rule tree operate on it.
We'll use this level to know where to stop replacing nodes in the tree.
Diffstat (limited to 'tests/unit/style/rule_tree/bench.rs')
-rw-r--r--tests/unit/style/rule_tree/bench.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/unit/style/rule_tree/bench.rs b/tests/unit/style/rule_tree/bench.rs
index 2504c6f2893..de68d99b71d 100644
--- a/tests/unit/style/rule_tree/bench.rs
+++ b/tests/unit/style/rule_tree/bench.rs
@@ -11,7 +11,7 @@ use style::error_reporting::ParseErrorReporter;
use style::media_queries::MediaList;
use style::parser::ParserContextExtraData;
use style::properties::{longhands, DeclaredValue, Importance, PropertyDeclaration, PropertyDeclarationBlock};
-use style::rule_tree::{RuleTree, StrongRuleNode, StyleSource};
+use style::rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
use style::stylesheets::{Origin, Stylesheet, CssRule};
use test::{self, Bencher};
@@ -40,7 +40,7 @@ impl<'a> Drop for AutoGCRuleTree<'a> {
}
}
-fn parse_rules(css: &str) -> Vec<(StyleSource, Importance)> {
+fn parse_rules(css: &str) -> Vec<(StyleSource, CascadeLevel)> {
let s = Stylesheet::from_str(css,
ServoUrl::parse("http://localhost").unwrap(),
Origin::Author,
@@ -57,15 +57,15 @@ fn parse_rules(css: &str) -> Vec<(StyleSource, Importance)> {
_ => None,
}
}).cloned().map(StyleSource::Style).map(|s| {
- (s, Importance::Normal)
+ (s, CascadeLevel::UserNormal)
}).collect()
}
-fn test_insertion(rule_tree: &RuleTree, rules: Vec<(StyleSource, Importance)>) -> StrongRuleNode {
+fn test_insertion(rule_tree: &RuleTree, rules: Vec<(StyleSource, CascadeLevel)>) -> StrongRuleNode {
rule_tree.insert_ordered_rules(rules.into_iter())
}
-fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, Importance)]) -> StrongRuleNode {
+fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, CascadeLevel)]) -> StrongRuleNode {
let mut rules = rules.to_vec();
rules.push((StyleSource::Declarations(Arc::new(RwLock::new(PropertyDeclarationBlock {
declarations: vec![
@@ -74,7 +74,7 @@ fn test_insertion_style_attribute(rule_tree: &RuleTree, rules: &[(StyleSource, I
Importance::Normal),
],
important_count: 0,
- }))), Importance::Normal));
+ }))), CascadeLevel::UserNormal));
test_insertion(rule_tree, rules)
}