mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Store variable references with a boxed slice rather than a PrecomputedHashSet.
Once we've parsed the variable references, there is no need to keep an entire HashSet object around, as all we do is iterate over the values. Differential Revision: https://phabricator.services.mozilla.com/D11735
This commit is contained in:
parent
41d2f7f3a2
commit
1576dd4c5b
1 changed files with 8 additions and 3 deletions
|
@ -109,7 +109,7 @@ pub struct VariableValue {
|
||||||
references_environment: bool,
|
references_environment: bool,
|
||||||
|
|
||||||
/// Custom property names in var() functions.
|
/// Custom property names in var() functions.
|
||||||
references: PrecomputedHashSet<Name>,
|
references: Box<[Name]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToCss for SpecifiedValue {
|
impl ToCss for SpecifiedValue {
|
||||||
|
@ -278,7 +278,7 @@ impl VariableValue {
|
||||||
css: String::new(),
|
css: String::new(),
|
||||||
last_token_type: TokenSerializationType::nothing(),
|
last_token_type: TokenSerializationType::nothing(),
|
||||||
first_token_type: TokenSerializationType::nothing(),
|
first_token_type: TokenSerializationType::nothing(),
|
||||||
references: PrecomputedHashSet::default(),
|
references: Default::default(),
|
||||||
references_environment: false,
|
references_environment: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,11 +335,16 @@ impl VariableValue {
|
||||||
let (first_token_type, css, last_token_type) =
|
let (first_token_type, css, last_token_type) =
|
||||||
parse_self_contained_declaration_value(input, Some(&mut references))?;
|
parse_self_contained_declaration_value(input, Some(&mut references))?;
|
||||||
|
|
||||||
|
let custom_property_references = references.custom_property_references
|
||||||
|
.into_iter()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_boxed_slice();
|
||||||
|
|
||||||
Ok(Arc::new(VariableValue {
|
Ok(Arc::new(VariableValue {
|
||||||
css: css.into_owned(),
|
css: css.into_owned(),
|
||||||
first_token_type,
|
first_token_type,
|
||||||
last_token_type,
|
last_token_type,
|
||||||
references: references.custom_property_references,
|
references: custom_property_references,
|
||||||
references_environment: references.references_environment,
|
references_environment: references.references_environment,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue