mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Rework how precomputed pseudo stuff works, to avoid malloc/free churn.
This showed up in a few profiles, and was an easy improvement. MozReview-Commit-ID: HVqATaSB2Ak Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
48b7e6d27c
commit
64a96ce21c
3 changed files with 50 additions and 67 deletions
|
@ -201,29 +201,6 @@ impl SelectorMap<Rule> {
|
|||
|block| (block.specificity, block.source_order()));
|
||||
}
|
||||
|
||||
/// Append to `rule_list` all universal Rules (rules with selector `*|*`) in
|
||||
/// `self` sorted by specificity and source order.
|
||||
pub fn get_universal_rules(&self,
|
||||
cascade_level: CascadeLevel)
|
||||
-> Vec<ApplicableDeclarationBlock> {
|
||||
debug_assert!(!cascade_level.is_important());
|
||||
if self.is_empty() {
|
||||
return vec![];
|
||||
}
|
||||
|
||||
let mut rules_list = vec![];
|
||||
for rule in self.other.iter() {
|
||||
if rule.selector.is_universal() {
|
||||
rules_list.push(rule.to_applicable_declaration_block(cascade_level))
|
||||
}
|
||||
}
|
||||
|
||||
sort_by_key(&mut rules_list,
|
||||
|block| (block.specificity, block.source_order()));
|
||||
|
||||
rules_list
|
||||
}
|
||||
|
||||
/// Adds rules in `rules` that match `element` to the `matching_rules` list.
|
||||
fn get_matching_rules<E, V, F>(element: &E,
|
||||
rules: &[Rule],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue