diff --git a/components/style/gecko/pseudo_element_definition.mako.rs b/components/style/gecko/pseudo_element_definition.mako.rs index 06323699b19..b507fafd865 100644 --- a/components/style/gecko/pseudo_element_definition.mako.rs +++ b/components/style/gecko/pseudo_element_definition.mako.rs @@ -112,7 +112,11 @@ impl PseudoElement { % for pseudo in PSEUDOS: ${pseudo_element_variant(pseudo)} => % if pseudo.is_tree_pseudo_element(): - 0, + if unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_tree_pseudos_content_enabled } { + 0 + } else { + structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME + }, % elif pseudo.is_anon_box(): structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS, % else: diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 61e282c1dce..4a5ae8aef64 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -488,7 +488,9 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { } let args = args.into_boxed_slice(); if let Some(pseudo) = PseudoElement::tree_pseudo_element(&name, args) { - return Ok(pseudo); + if self.is_pseudo_element_enabled(&pseudo) { + return Ok(pseudo); + } } } Err(