From 288d392ecdcb575e284deb9dec4e181d0bf8173c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 7 Aug 2017 05:15:37 -0500 Subject: [PATCH] servo: Merge #17991 - style: Avoid branching on the origin for each selector when inserting in the cascade data (from emilio:dumb-branches); r=heycam This is on top of #17990, and it's intended to help with bug 1386045. Source-Repo: https://github.com/servo/servo Source-Revision: 806540cabdbca1799dd14bb1c67bd0c86b21f6a7 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 618224ec519ee0cb985d6e345c0ea1dedad3f5e8 --- servo/components/style/stylist.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/servo/components/style/stylist.rs b/servo/components/style/stylist.rs index 636f0646ce57..f0b2dcc462c0 100644 --- a/servo/components/style/stylist.rs +++ b/servo/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(),