mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Move precomputed pseudo handling to its own match arm.
This commit is contained in:
parent
64a96ce21c
commit
121e2d5837
1 changed files with 25 additions and 26 deletions
|
@ -464,34 +464,33 @@ impl Stylist {
|
||||||
self.num_selectors += 1;
|
self.num_selectors += 1;
|
||||||
|
|
||||||
let map = match selector.pseudo_element() {
|
let map = match selector.pseudo_element() {
|
||||||
|
Some(pseudo) if pseudo.is_precomputed() => {
|
||||||
|
if !selector.is_universal() ||
|
||||||
|
!matches!(origin, Origin::UserAgent) {
|
||||||
|
// ::-moz-tree selectors may appear in
|
||||||
|
// non-UA sheets (even though they never
|
||||||
|
// match).
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.precomputed_pseudo_element_decls
|
||||||
|
.entry(pseudo.canonical())
|
||||||
|
.or_insert_with(Vec::new)
|
||||||
|
.push(ApplicableDeclarationBlock::new(
|
||||||
|
StyleSource::Style(locked.clone()),
|
||||||
|
self.rules_source_order,
|
||||||
|
CascadeLevel::UANormal,
|
||||||
|
selector.specificity()
|
||||||
|
));
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
None => &mut origin_cascade_data.element_map,
|
None => &mut origin_cascade_data.element_map,
|
||||||
Some(pseudo) => {
|
Some(pseudo) => {
|
||||||
if pseudo.is_precomputed() {
|
origin_cascade_data
|
||||||
if !selector.is_universal() ||
|
.pseudos_map
|
||||||
!matches!(origin, Origin::UserAgent) {
|
.entry(pseudo.canonical())
|
||||||
// ::-moz-tree selectors may appear in
|
.or_insert_with(SelectorMap::new)
|
||||||
// non-UA sheets (even though they never
|
|
||||||
// match).
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.precomputed_pseudo_element_decls
|
|
||||||
.entry(pseudo.canonical())
|
|
||||||
.or_insert_with(Vec::new)
|
|
||||||
.push(ApplicableDeclarationBlock::new(
|
|
||||||
StyleSource::Style(locked.clone()),
|
|
||||||
self.rules_source_order,
|
|
||||||
CascadeLevel::UANormal,
|
|
||||||
selector.specificity()
|
|
||||||
));
|
|
||||||
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
origin_cascade_data
|
|
||||||
.pseudos_map
|
|
||||||
.entry(pseudo.canonical())
|
|
||||||
.or_insert_with(SelectorMap::new)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue