Skip to content

Commit

Permalink
style: Avoid branching on the origin for each selector when inserting…
Browse files Browse the repository at this point in the history
… in the cascade data.

This is on top of servo#17990, and it's intended to help with bug 1386045.
  • Loading branch information
emilio committed Aug 7, 2017
1 parent cc1aab3 commit 7ee4b3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/style/stylist.rs
Expand Up @@ -458,6 +458,10 @@ impl Stylist {
self.effective_media_query_results.saw_effective(stylesheet);

let origin = stylesheet.origin(guard);

let origin_cascade_data =
self.cascade_data.borrow_mut_for_origin(&origin);

for rule in stylesheet.effective_rules(&self.device, guard) {
match *rule {
CssRule::Style(ref locked) => {
Expand All @@ -469,8 +473,7 @@ impl Stylist {
let hashes =
AncestorHashes::new(&selector, self.quirks_mode);

self.cascade_data
.borrow_mut_for_origin(&origin)
origin_cascade_data
.borrow_mut_for_pseudo_or_insert(selector.pseudo_element())
.insert(
Rule::new(selector.clone(),
Expand Down

0 comments on commit 7ee4b3f

Please sign in to comment.