From 993cb6eb41a91959e19db862be011a8bb76277f5 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 15 May 2017 14:31:53 -0400 Subject: [PATCH] Don't require style sharing cache invalidation for :dir --- components/style/gecko/selector_parser.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index bed3737db99..e46b8c489f5 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -159,8 +159,12 @@ impl NonTSPseudoClass { /// Returns true if the given pseudoclass should trigger style sharing cache revalidation. pub fn needs_cache_revalidation(&self) -> bool { + // :dir() depends on state only, but doesn't use state_flag because its + // semantics don't quite match. Nevertheless, it doesn't need cache + // revalidation, because we already compare states for elements and + // candidates. self.state_flag().is_empty() && - !matches!(*self, NonTSPseudoClass::MozAny(_)) + !matches!(*self, NonTSPseudoClass::MozAny(_) | NonTSPseudoClass::Dir(_)) } /// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType.