From ab79cc0e39783c41e39307b46e71306cdfc90907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 25 May 2020 23:54:10 +0000 Subject: [PATCH] style: Implement the ::file-chooser-button pseudo-element. As per https://github.com/w3c/csswg-drafts/issues/5049. Don't enable it unconditionally just yet, as the name may change. I had to move some rules in forms.css because otherwise you get specificity conflicts. Differential Revision: https://phabricator.services.mozilla.com/D76214 --- components/style/gecko/pseudo_element.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index b537295f785..631172d9511 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -37,7 +37,8 @@ impl ::selectors::parser::PseudoElement for PseudoElement { PseudoElement::Before | PseudoElement::After | PseudoElement::Marker | - PseudoElement::Placeholder + PseudoElement::Placeholder | + PseudoElement::FileChooserButton ) } @@ -159,12 +160,12 @@ impl PseudoElement { /// Whether this pseudo-element is enabled for all content. pub fn enabled_in_content(&self) -> bool { - if (self.flags() & structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME) != 0 { - return false; - } match *self { PseudoElement::MozFocusOuter => static_prefs::pref!("layout.css.moz-focus-outer.enabled"), - _ => true, + PseudoElement::FileChooserButton => static_prefs::pref!("layout.css.file-chooser-button.enabled"), + _ => { + (self.flags() & structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME) == 0 + } } }