style: Note :lang() as being sensitive to attributes. draft
authorCameron McCormack <cam@mcc.id.au>
Wed, 07 Jun 2017 12:27:26 +0800
changeset 590053 5cf1fcdac4b48f3353556e2db78d4f7ca5b7961f
parent 590052 399587140a87400c8ef6b3660bbc8909ca9ceaad
child 590054 52e8159c108b0ff240cfb0886bd00a757bca4222
push id62581
push userbmo:cam@mcc.id.au
push dateWed, 07 Jun 2017 05:05:00 +0000
milestone55.0a1
style: Note :lang() as being sensitive to attributes. MozReview-Commit-ID: 8bxlLCPc8tS
servo/components/style/gecko/selector_parser.rs
servo/components/style/servo/selector_parser.rs
--- a/servo/components/style/gecko/selector_parser.rs
+++ b/servo/components/style/gecko/selector_parser.rs
@@ -210,17 +210,18 @@ impl NonTSPseudoClass {
         apply_non_ts_list!(pseudo_class_geckotype)
     }
 
     /// Returns true if the evaluation of the pseudo-class depends on the
     /// element's attributes.
     pub fn is_attr_based(&self) -> bool {
         matches!(*self,
                  NonTSPseudoClass::MozTableBorderNonzero |
-                 NonTSPseudoClass::MozBrowserFrame)
+                 NonTSPseudoClass::MozBrowserFrame |
+                 NonTSPseudoClass::Lang(..))
     }
 }
 
 /// The dummy struct we use to implement our selector parsing.
 #[derive(Clone, Debug, PartialEq, Eq)]
 pub struct SelectorImpl;
 
 impl ::selectors::SelectorImpl for SelectorImpl {
--- a/servo/components/style/servo/selector_parser.rs
+++ b/servo/components/style/servo/selector_parser.rs
@@ -271,17 +271,17 @@ impl NonTSPseudoClass {
     /// Returns true if the given pseudoclass should trigger style sharing cache revalidation.
     pub fn needs_cache_revalidation(&self) -> bool {
         self.state_flag().is_empty()
     }
 
     /// Returns true if the evaluation of the pseudo-class depends on the
     /// element's attributes.
     pub fn is_attr_based(&self) -> bool {
-        false
+        matches!(*this, NonTSPseudoClass::Lang(..))
     }
 }
 
 /// The abstract struct we implement the selector parser implementation on top
 /// of.
 #[derive(Clone, Debug, PartialEq)]
 #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
 pub struct SelectorImpl;