diff --git a/components/style/element_state.rs b/components/style/element_state.rs index 809f01218b0..d8b4d680377 100644 --- a/components/style/element_state.rs +++ b/components/style/element_state.rs @@ -120,6 +120,18 @@ bitflags! { const IN_LTR_STATE = 1 << 44, /// State that elements that match :dir(rtl) are in. const IN_RTL_STATE = 1 << 45, + /// State that HTML elements that have a "dir" attr are in. + const IN_HAS_DIR_ATTR_STATE = 1 << 46, + /// State that HTML elements with dir="ltr" (or something + /// case-insensitively equal to "ltr") are in. + const IN_HAS_DIR_ATTR_LTR_STATE = 1 << 47, + /// State that HTML elements with dir="rtl" (or something + /// case-insensitively equal to "rtl") are in. + const IN_HAS_DIR_ATTR_RTL_STATE = 1 << 48, + /// State that HTML elements without a valid-valued "dir" attr or + /// any HTML elements (including ) with dir="auto" (or something + /// case-insensitively equal to "auto") are in. + const IN_HAS_DIR_ATTR_LIKE_AUTO_STATE = 1 << 49, /// Non-standard & undocumented. const IN_AUTOFILL_STATE = 1 << 50, /// Non-standard & undocumented. diff --git a/components/style/gecko/generated/structs_debug.rs b/components/style/gecko/generated/structs_debug.rs index 28161278e66..2d509a1da8a 100644 --- a/components/style/gecko/generated/structs_debug.rs +++ b/components/style/gecko/generated/structs_debug.rs @@ -10668,28 +10668,32 @@ pub mod root { mozHandlerBlocked = 59, mozHandlerCrashed = 60, mozMathIncrementScriptLevel = 61, - mozAutofill = 62, - mozAutofillPreview = 63, - required = 64, - optional = 65, - valid = 66, - invalid = 67, - inRange = 68, - outOfRange = 69, - defaultPseudo = 70, - placeholderShown = 71, - mozReadOnly = 72, - mozReadWrite = 73, - mozSubmitInvalid = 74, - mozUIInvalid = 75, - mozUIValid = 76, - mozMeterOptimum = 77, - mozMeterSubOptimum = 78, - mozMeterSubSubOptimum = 79, - mozPlaceholder = 80, - Count = 81, - NotPseudo = 82, - MAX = 83, + mozHasDirAttr = 62, + mozDirAttrLTR = 63, + mozDirAttrRTL = 64, + mozDirAttrLikeAuto = 65, + mozAutofill = 66, + mozAutofillPreview = 67, + required = 68, + optional = 69, + valid = 70, + invalid = 71, + inRange = 72, + outOfRange = 73, + defaultPseudo = 74, + placeholderShown = 75, + mozReadOnly = 76, + mozReadWrite = 77, + mozSubmitInvalid = 78, + mozUIInvalid = 79, + mozUIValid = 80, + mozMeterOptimum = 81, + mozMeterSubOptimum = 82, + mozMeterSubSubOptimum = 83, + mozPlaceholder = 84, + Count = 85, + NotPseudo = 86, + MAX = 87, } #[repr(C)] #[derive(Debug)] @@ -16146,19 +16150,17 @@ pub mod root { NodeIsContent = 17, ElementHasAnimations = 18, NodeHasValidDirAttribute = 19, - NodeHasFixedDir = 20, - NodeHasDirAutoSet = 21, - NodeHasTextNodeDirectionalityMap = 22, - NodeHasDirAuto = 23, - NodeAncestorHasDirAuto = 24, - ElementIsInStyleScope = 25, - ElementIsScopedStyleRoot = 26, - NodeHandlingClick = 27, - NodeHasRelevantHoverRules = 28, - ElementHasWeirdParserInsertionMode = 29, - ParserHasNotified = 30, - MayBeApzAware = 31, - BooleanFlagCount = 32, + NodeHasDirAutoSet = 20, + NodeHasTextNodeDirectionalityMap = 21, + NodeAncestorHasDirAuto = 22, + ElementIsInStyleScope = 23, + ElementIsScopedStyleRoot = 24, + NodeHandlingClick = 25, + NodeHasRelevantHoverRules = 26, + ElementHasWeirdParserInsertionMode = 27, + ParserHasNotified = 28, + MayBeApzAware = 29, + BooleanFlagCount = 30, } #[repr(C)] #[derive(Debug, Copy)] diff --git a/components/style/gecko/generated/structs_release.rs b/components/style/gecko/generated/structs_release.rs index f39368f0dff..e026efef06a 100644 --- a/components/style/gecko/generated/structs_release.rs +++ b/components/style/gecko/generated/structs_release.rs @@ -10401,28 +10401,32 @@ pub mod root { mozHandlerBlocked = 59, mozHandlerCrashed = 60, mozMathIncrementScriptLevel = 61, - mozAutofill = 62, - mozAutofillPreview = 63, - required = 64, - optional = 65, - valid = 66, - invalid = 67, - inRange = 68, - outOfRange = 69, - defaultPseudo = 70, - placeholderShown = 71, - mozReadOnly = 72, - mozReadWrite = 73, - mozSubmitInvalid = 74, - mozUIInvalid = 75, - mozUIValid = 76, - mozMeterOptimum = 77, - mozMeterSubOptimum = 78, - mozMeterSubSubOptimum = 79, - mozPlaceholder = 80, - Count = 81, - NotPseudo = 82, - MAX = 83, + mozHasDirAttr = 62, + mozDirAttrLTR = 63, + mozDirAttrRTL = 64, + mozDirAttrLikeAuto = 65, + mozAutofill = 66, + mozAutofillPreview = 67, + required = 68, + optional = 69, + valid = 70, + invalid = 71, + inRange = 72, + outOfRange = 73, + defaultPseudo = 74, + placeholderShown = 75, + mozReadOnly = 76, + mozReadWrite = 77, + mozSubmitInvalid = 78, + mozUIInvalid = 79, + mozUIValid = 80, + mozMeterOptimum = 81, + mozMeterSubOptimum = 82, + mozMeterSubSubOptimum = 83, + mozPlaceholder = 84, + Count = 85, + NotPseudo = 86, + MAX = 87, } #[repr(C)] #[derive(Debug)] @@ -15782,19 +15786,17 @@ pub mod root { NodeIsContent = 17, ElementHasAnimations = 18, NodeHasValidDirAttribute = 19, - NodeHasFixedDir = 20, - NodeHasDirAutoSet = 21, - NodeHasTextNodeDirectionalityMap = 22, - NodeHasDirAuto = 23, - NodeAncestorHasDirAuto = 24, - ElementIsInStyleScope = 25, - ElementIsScopedStyleRoot = 26, - NodeHandlingClick = 27, - NodeHasRelevantHoverRules = 28, - ElementHasWeirdParserInsertionMode = 29, - ParserHasNotified = 30, - MayBeApzAware = 31, - BooleanFlagCount = 32, + NodeHasDirAutoSet = 20, + NodeHasTextNodeDirectionalityMap = 21, + NodeAncestorHasDirAuto = 22, + ElementIsInStyleScope = 23, + ElementIsScopedStyleRoot = 24, + NodeHandlingClick = 25, + NodeHasRelevantHoverRules = 26, + ElementHasWeirdParserInsertionMode = 27, + ParserHasNotified = 28, + MayBeApzAware = 29, + BooleanFlagCount = 30, } #[repr(C)] #[derive(Debug, Copy)] diff --git a/components/style/gecko/non_ts_pseudo_class_list.rs b/components/style/gecko/non_ts_pseudo_class_list.rs index 12c1fa21d1f..a6c3549bafa 100644 --- a/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/components/style/gecko/non_ts_pseudo_class_list.rs @@ -72,6 +72,10 @@ macro_rules! apply_non_ts_list { ("-moz-broken", MozBroken, mozBroken, IN_BROKEN_STATE, _), ("-moz-loading", MozLoading, mozLoading, IN_LOADING_STATE, _), ("-moz-suppressed", MozSuppressed, mozSuppressed, IN_SUPPRESSED_STATE, PSEUDO_CLASS_INTERNAL), + ("-moz-has-dir-attr", MozHasDirAttr, mozHasDirAttr, IN_HAS_DIR_ATTR_STATE, PSEUDO_CLASS_INTERNAL), + ("-moz-dir-attr-ltr", MozDirAttrLTR, mozDirAttrLTR, IN_HAS_DIR_ATTR_LTR_STATE, PSEUDO_CLASS_INTERNAL), + ("-moz-dir-attr-rtl", MozDirAttrRTL, mozDirAttrRTL, IN_HAS_DIR_ATTR_RTL_STATE, PSEUDO_CLASS_INTERNAL), + ("-moz-dir-attr-like-auto", MozDirAttrLikeAuto, mozDirAttrLikeAuto, IN_HAS_DIR_ATTR_LIKE_AUTO_STATE, PSEUDO_CLASS_INTERNAL), ("-moz-autofill", MozAutofill, mozAutofill, IN_AUTOFILL_STATE, PSEUDO_CLASS_INTERNAL), ("-moz-autofill-preview", MozAutofillPreview, mozAutofillPreview, IN_AUTOFILL_PREVIEW_STATE, PSEUDO_CLASS_INTERNAL), diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 9c99ead1fe4..e997486b1d3 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1517,6 +1517,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::MozMeterOptimum | NonTSPseudoClass::MozMeterSubOptimum | NonTSPseudoClass::MozMeterSubSubOptimum | + NonTSPseudoClass::MozHasDirAttr | + NonTSPseudoClass::MozDirAttrLTR | + NonTSPseudoClass::MozDirAttrRTL | + NonTSPseudoClass::MozDirAttrLikeAuto | NonTSPseudoClass::MozAutofill | NonTSPseudoClass::MozAutofillPreview => { self.get_state().intersects(pseudo_class.state_flag())