aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-08-07 05:15:37 -0500
committerGitHub <noreply@github.com>2017-08-07 05:15:37 -0500
commit806540cabdbca1799dd14bb1c67bd0c86b21f6a7 (patch)
treefdcfd8ed426afcbcc6e72a487e099d5e82f019c1
parentcc1aab35ea11415d8c5fb3e33c745434b8a5ec2d (diff)
parent7ee4b3f881dcb11238c0400a2c02d5d19be87b4c (diff)
downloadservo-806540cabdbca1799dd14bb1c67bd0c86b21f6a7.tar.gz
servo-806540cabdbca1799dd14bb1c67bd0c86b21f6a7.zip
Auto merge of #17991 - emilio:dumb-branches, r=heycam
style: Avoid branching on the origin for each selector when inserting in the cascade data. This is on top of #17990, and it's intended to help with bug 1386045. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17991) <!-- Reviewable:end -->
-rw-r--r--components/style/stylist.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index 636f0646ce5..f0b2dcc462c 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -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) => {
@@ -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(),