aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/gecko/selector_parser.rs6
-rw-r--r--components/style/servo/selector_parser.rs5
-rw-r--r--components/style/stylist.rs4
3 files changed, 12 insertions, 3 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs
index b87824fc33f..4add99e36e8 100644
--- a/components/style/gecko/selector_parser.rs
+++ b/components/style/gecko/selector_parser.rs
@@ -342,6 +342,12 @@ impl NonTSPseudoClass {
apply_non_ts_list!(pseudo_class_state)
}
+ /// Returns true if the given pseudoclass should trigger style sharing cache revalidation.
+ pub fn needs_cache_revalidation(&self) -> bool {
+ self.state_flag().is_empty() &&
+ !matches!(*self, NonTSPseudoClass::MozAny(_))
+ }
+
/// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType.
pub fn to_gecko_pseudoclasstype(&self) -> Option<CSSPseudoClassType> {
macro_rules! gecko_type {
diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs
index e0277b31480..0335b249cb1 100644
--- a/components/style/servo/selector_parser.rs
+++ b/components/style/servo/selector_parser.rs
@@ -235,6 +235,11 @@ impl NonTSPseudoClass {
ServoNonZeroBorder => ElementState::empty(),
}
}
+
+ /// Returns true if the given pseudoclass should trigger style sharing cache revalidation.
+ pub fn needs_cache_revalidation(&self) -> bool {
+ self.state_flag().is_empty()
+ }
}
/// The abstract struct we implement the selector parser implementation on top
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index 62f1795f25c..a990dc253b9 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -953,9 +953,7 @@ impl SelectorVisitor for RevalidationVisitor {
Component::OnlyOfType => {
false
},
- // FIXME(emilio): This sets the "revalidation" flag for :any, which is
- // probably expensive given we use it a lot in UA sheets.
- Component::NonTSPseudoClass(ref p) if p.state_flag().is_empty() => {
+ Component::NonTSPseudoClass(ref p) if p.needs_cache_revalidation() => {
false
},
_ => {