mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Deduplicate declarations when inserting each one, not at the end of parsing.
This will reduce the amount of re-allocations and copies. It will be further optimized with a bit map.
This commit is contained in:
parent
4b4a873c3e
commit
460fd6eba8
3 changed files with 40 additions and 74 deletions
|
@ -362,10 +362,10 @@ impl<'a> QualifiedRuleParser for KeyframeListParser<'a> {
|
|||
context: self.context,
|
||||
};
|
||||
let mut iter = DeclarationListParser::new(input, parser);
|
||||
let mut declarations = Vec::new();
|
||||
let mut block = PropertyDeclarationBlock::new();
|
||||
while let Some(declaration) = iter.next() {
|
||||
match declaration {
|
||||
Ok(parsed) => parsed.expand(|d| declarations.push((d, Importance::Normal))),
|
||||
Ok(parsed) => parsed.expand(|d| block.push(d, Importance::Normal)),
|
||||
Err(range) => {
|
||||
let pos = range.start;
|
||||
let message = format!("Unsupported keyframe property declaration: '{}'",
|
||||
|
@ -377,10 +377,7 @@ impl<'a> QualifiedRuleParser for KeyframeListParser<'a> {
|
|||
}
|
||||
Ok(Arc::new(RwLock::new(Keyframe {
|
||||
selector: prelude,
|
||||
block: Arc::new(RwLock::new(PropertyDeclarationBlock {
|
||||
declarations: declarations,
|
||||
important_count: 0,
|
||||
})),
|
||||
block: Arc::new(RwLock::new(block)),
|
||||
})))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue