Skip to content

Commit

Permalink
style: Move precomputed pseudo handling to its own match arm.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Aug 8, 2017
1 parent 64a96ce commit 121e2d5
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions components/style/stylist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,34 +464,33 @@ impl Stylist {
self.num_selectors += 1;

let map = match selector.pseudo_element() {
None => &mut origin_cascade_data.element_map,
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()
));

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;
} else {
origin_cascade_data
.pseudos_map
.entry(pseudo.canonical())
.or_insert_with(SelectorMap::new)
}

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,
Some(pseudo) => {
origin_cascade_data
.pseudos_map
.entry(pseudo.canonical())
.or_insert_with(SelectorMap::new)
}
};

Expand Down

0 comments on commit 121e2d5

Please sign in to comment.