From 4abe8002e9c33a633c27c3c0485bd1d2b632c1c8 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 19 Sep 2017 15:04:14 -0700 Subject: [PATCH] Bug 1401317 - Make second pass sharing sensitive to DISABLE_STYLE_SHARING_CACHE. r=emilio MozReview-Commit-ID: 8U0xekMHGg8 --- components/style/sharing/mod.rs | 5 +++++ components/style/style_resolver.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index 83ad650c5e2..72214d79f90 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -745,11 +745,16 @@ impl StyleSharingCache { /// Attempts to find an element in the cache with the given primary rule node and parent. pub fn lookup_by_rules( &mut self, + shared_context: &SharedStyleContext, inherited: &ComputedValues, rules: &StrongRuleNode, visited_rules: Option<&StrongRuleNode>, target: E, ) -> Option { + if shared_context.options.disable_style_sharing_cache { + return None; + } + self.cache_mut().lookup(|candidate| { debug_assert_ne!(candidate.element, target); if !candidate.parent_style_identity().eq(inherited) { diff --git a/components/style/style_resolver.rs b/components/style/style_resolver.rs index 41b7ed86237..ee66b56a1d9 100644 --- a/components/style/style_resolver.rs +++ b/components/style/style_resolver.rs @@ -195,6 +195,7 @@ where if may_reuse { let cached = self.context.thread_local.sharing_cache.lookup_by_rules( + self.context.shared, parent_style.unwrap(), inputs.rules.as_ref().unwrap(), inputs.visited_rules.as_ref(),