Bug 1662478 - Rename ::file-chooser-button to ::file-selector-button, and enable it in all channels. r=jwatt

See https://github.com/w3c/csswg-drafts/issues/5049

Differential Revision: https://phabricator.services.mozilla.com/D88995
This commit is contained in:
Emilio Cobos Álvarez 2020-09-01 22:58:10 +00:00
parent 9258cf89d3
commit 03baee9d8a
17 changed files with 42 additions and 42 deletions

View File

@ -74,7 +74,7 @@ if (
});
}
if (Services.prefs.getBoolPref("layout.css.file-chooser-button.enabled")) {
if (Services.prefs.getBoolPref("layout.css.file-selector-button.enabled")) {
// System colors reserved to UA / chrome sheets
whitelist.push({
sourceName: /(?:res|gre-resources)\/forms\.css$/i,
@ -86,7 +86,7 @@ if (Services.prefs.getBoolPref("layout.css.file-chooser-button.enabled")) {
// Reserved to UA sheets, behind a pref for content.
whitelist.push({
sourceName: /(?:res|gre-resources)\/forms\.css$/i,
errorMessage: /Unknown pseudo-.*file-chooser-button/i,
errorMessage: /Unknown pseudo-.*file-selector-button/i,
isFromDevTools: false,
});
}

View File

@ -733,7 +733,7 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
return node.matches(":fullscreen");
case ":cue":
return node.nodeName == "VIDEO";
case ":file-chooser-button":
case ":file-selector-button":
return node.nodeName == "INPUT" && node.type == "file";
case ":placeholder":
case ":-moz-placeholder":

View File

@ -10813,7 +10813,7 @@ exports.PSEUDO_ELEMENTS = [
":-moz-meter-bar",
":placeholder",
":-moz-color-swatch",
":file-chooser-button"
":file-selector-button"
];
/**

View File

@ -210,7 +210,7 @@ static already_AddRefed<Element> MakeAnonButton(Document* aDoc,
// NOTE: SetIsNativeAnonymousRoot() has to be called before setting any
// attribute.
button->SetIsNativeAnonymousRoot();
button->SetPseudoElementType(PseudoStyleType::fileChooserButton);
button->SetPseudoElementType(PseudoStyleType::fileSelectorButton);
// Set the file picking button text depending on the current locale.
nsAutoString buttonTxt;

View File

@ -15,7 +15,7 @@
":marker",
":backdrop",
":cue",
":file-chooser-button",
":file-selector-button",
":first-letter",
":first-line",
":placeholder",

View File

@ -92,6 +92,6 @@ CSS_PSEUDO_ELEMENT(mozTextControlEditingRoot, ":-moz-text-control-editing-root",
CSS_PSEUDO_ELEMENT(mozTextControlPreview, ":-moz-text-control-preview",
CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS)
CSS_PSEUDO_ELEMENT(fileChooserButton, ":file-chooser-button",
CSS_PSEUDO_ELEMENT(fileSelectorButton, ":file-selector-button",
CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS |
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)

View File

@ -122,8 +122,8 @@ class nsCSSPseudoElements {
switch (aType) {
case Type::mozFocusOuter:
return mozilla::StaticPrefs::layout_css_moz_focus_outer_enabled();
case Type::fileChooserButton:
return mozilla::StaticPrefs::layout_css_file_chooser_button_enabled();
case Type::fileSelectorButton:
return mozilla::StaticPrefs::layout_css_file_selector_button_enabled();
default:
return !PseudoElementHasAnyFlag(
aType, CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME);

View File

@ -128,7 +128,7 @@ textarea {
}
/* A few properties that we don't want to inherit by default: */
input, textarea, select, button, ::file-chooser-button {
input, textarea, select, button, ::file-selector-button {
text-align: initial;
text-indent: initial;
text-shadow: initial;
@ -521,7 +521,7 @@ input[type="search"] {
/* Non text-related properties for buttons: these ones are shared with
input[type="color"] */
button,
::file-chooser-button,
::file-selector-button,
input:is([type="color"], [type="reset"], [type="button"], [type="submit"]) {
appearance: auto;
-moz-default-appearance: button;
@ -540,7 +540,7 @@ input:is([type="color"], [type="reset"], [type="button"], [type="submit"]) {
/* Text-related properties for buttons: these ones are not shared with
input[type="color"] */
button,
::file-chooser-button,
::file-selector-button,
input:is([type="reset"], [type="button"], [type="submit"]) {
color: ButtonText;
font: -moz-button;
@ -555,7 +555,7 @@ input[type="color"] {
}
button,
::file-chooser-button {
::file-selector-button {
/* Buttons should lay out like "normal" html, mostly */
white-space: unset;
text-indent: 0;
@ -597,19 +597,19 @@ button,
justify-items: inherit;
}
::file-chooser-button:hover,
::file-selector-button:hover,
button:hover,
input:is([type="reset"], [type="button"], [type="submit"], [type="color"]):hover {
background-color: -moz-buttonhoverface;
}
::file-chooser-button:hover,
::file-selector-button:hover,
button:hover,
input:is([type="reset"], [type="button"], [type="submit"]):hover {
color: -moz-buttonhovertext;
}
::file-chooser-button:active:hover,
::file-selector-button:active:hover,
button:active:hover,
input:is([type="reset"], [type="button"], [type="submit"], [type="color"]):active:hover {
%ifndef XP_MACOSX
@ -620,7 +620,7 @@ input:is([type="reset"], [type="button"], [type="submit"], [type="color"]):activ
background-color: ButtonFace;
}
::file-chooser-button:active:hover,
::file-selector-button:active:hover,
button:active:hover,
input:is([type="reset"], [type="button"], [type="submit"]):active:hover {
%ifdef MOZ_WIDGET_GTK
@ -641,7 +641,7 @@ input:is([type="reset"], [type="button"], [type="submit"]):active:hover {
border-color: currentColor;
}
:is(:disabled, :disabled:active)::file-chooser-button,
:is(:disabled, :disabled:active)::file-selector-button,
button:is(:disabled, :disabled:active),
input:is([type="reset"], [type="button"], [type="submit"], [type="color"]):is(:disabled, :disabled:active),
select:is(:disabled, :disabled:active) > button {
@ -653,7 +653,7 @@ select:is(:disabled, :disabled:active) > button {
cursor: unset;
}
:is(:disabled, :disabled:active)::file-chooser-button,
:is(:disabled, :disabled:active)::file-selector-button,
button:is(:disabled, :disabled:active),
input:is([type="reset"], [type="button"], [type="submit"]):is(:disabled, :disabled:active),
select:is(:disabled, :disabled:active) > button {
@ -692,7 +692,7 @@ input[type="file"] > label {
}
/* button part of file selector */
::file-chooser-button {
::file-selector-button {
font-size: unset;
letter-spacing: unset;
cursor: unset;

View File

@ -6470,10 +6470,10 @@
value: true
mirror: always
# Is support for the ::file-chooser-button pseudo-element enabled?
- name: layout.css.file-chooser-button.enabled
# Is support for the ::file-selector-button pseudo-element enabled?
- name: layout.css.file-selector-button.enabled
type: RelaxedAtomicBool
value: @IS_NIGHTLY_OR_DEV_EDITION@
value: true
mirror: always
rust: true

View File

@ -38,7 +38,7 @@ impl ::selectors::parser::PseudoElement for PseudoElement {
PseudoElement::After |
PseudoElement::Marker |
PseudoElement::Placeholder |
PseudoElement::FileChooserButton
PseudoElement::FileSelectorButton
)
}
@ -164,8 +164,8 @@ impl PseudoElement {
PseudoElement::MozFocusOuter => {
static_prefs::pref!("layout.css.moz-focus-outer.enabled")
},
PseudoElement::FileChooserButton => {
static_prefs::pref!("layout.css.file-chooser-button.enabled")
PseudoElement::FileSelectorButton => {
static_prefs::pref!("layout.css.file-selector-button.enabled")
},
_ => (self.flags() & structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME) == 0,
}

View File

@ -1,2 +0,0 @@
[file-chooser-button-001.tentative.html]
prefs: [layout.css.file-chooser-button.enabled:true]

View File

@ -0,0 +1,2 @@
[file-selector-button-001.tentative.html]
prefs: [layout.css.file-selector-button.enabled:true]

View File

@ -1,11 +0,0 @@
<!doctype html>
<title>::file-chooser-button allows to customize the button in &lt;input type=file&gt;</title>
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5049">
<link rel="mismatch" href="file-chooser-button-001-notref.html">
<style>
input::file-chooser-button {
background: green;
color: white;
}
</style>
<input type="file">

View File

@ -0,0 +1,11 @@
<!doctype html>
<title>::file-selector-button allows to customize the button in &lt;input type=file&gt;</title>
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5049">
<link rel="mismatch" href="file-selector-button-001-notref.html">
<style>
input::file-selector-button {
background: green;
color: white;
}
</style>
<input type="file">

View File

@ -1,8 +1,8 @@
<!doctype html>
<title>Shouldn't assert when re-creating a ::file-chooser-button pseudo-element after it being display: none</title>
<title>Shouldn't assert when re-creating a ::file-selector-button pseudo-element after it being display: none</title>
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5049">
<style>
.tweak::file-chooser-button {
.tweak::file-selector-button {
display: none;
}
</style>

View File

@ -2483,7 +2483,7 @@ STATIC_ATOMS = [
PseudoElementAtom("PseudoElement_mozColorSwatch", ":-moz-color-swatch"),
PseudoElementAtom("PseudoElement_mozTextControlEditingRoot", ":-moz-text-control-editing-root"),
PseudoElementAtom("PseudoElement_mozTextControlPreview", ":-moz-text-control-preview"),
PseudoElementAtom("PseudoElement_fileChooserButton", ":file-chooser-button"),
PseudoElementAtom("PseudoElement_fileSelectorButton", ":file-selector-button"),
# CSS anonymous boxes -- these must appear in the same order as
# in nsCSSAnonBoxList.h