Bug 1733565 - Clean up button active system colors. r=mstange,desktop-theme-reviewers,dao

This patch does three things:

 * Unifies mac and gtk's buttonactivetext system colors (unships mac's from
   content, but it was never meant to be exposed).

 * Simplifies the forms.css rules, since <input type=color>'s color property
   value doesn't affect its rendering in any meaningful way.

 * Adds a buttonactiveface color, which we'll use to provide dark backgrounds
   for buttons in Windows dark mode (and is good practice, since generally
   every text system color should have a corresponding background).

So as-is it shouldn't change content-exposed behavior (except we stop exposing
the -moz-mac-buttonactivetext to content), but it's a worthy cleanup.

Depends on D127246

Differential Revision: https://phabricator.services.mozilla.com/D127259
This commit is contained in:
Emilio Cobos Alvarez 2021-10-01 19:42:16 +00:00
Родитель c7fd83f7d9
Коммит 21a3f0049f
14 изменённых файлов: 37 добавлений и 33 удалений

Просмотреть файл

@ -73,7 +73,7 @@
#placesMenu > menu:active,
#placesMenu > menu[open] {
color: -moz-gtk-buttonactivetext;
color: -moz-buttonactivetext;
}
#placesMenu > menu::after {

Просмотреть файл

@ -162,7 +162,7 @@ html|img#editBookmarkPanelFavicon[src] {
#editBookmarkPanel .expander-down:hover:active {
/**
* We override the colour here because on macOS, buttons default to
* having :hover:active buttons have color -moz-mac-buttonactivetext
* having :hover:active buttons have color -moz-buttonactivetext
*/
color: var(--button-color);
background-color: var(--button-active-bgcolor);

Просмотреть файл

@ -615,29 +615,16 @@ button,
::file-selector-button:hover,
button:hover,
input:is([type=reset], [type=button], [type=submit], [type=color]):hover {
background-color: -moz-buttonhoverface;
}
::file-selector-button:hover,
button:hover,
input:is([type=reset], [type=button], [type=submit]):hover {
color: -moz-buttonhovertext;
background-color: -moz-buttonhoverface;
}
::file-selector-button:active:hover,
button:active:hover,
input:is([type=reset], [type=button], [type=submit], [type=color]):active:hover {
border-style: inset;
}
::file-selector-button:active:hover,
button:active:hover,
input:is([type=reset], [type=button], [type=submit]):active:hover {
%ifdef MOZ_WIDGET_GTK
color: -moz-gtk-buttonactivetext;
%else
color: ButtonText;
%endif
color: -moz-buttonactivetext;
background-color: -moz-buttonactiveface;
}
::-moz-focus-inner {

Просмотреть файл

@ -6,7 +6,8 @@
<script>
const NON_CONTENT_ACCESSIBLE_VALUES = {
"color": [
"-moz-gtk-buttonactivetext",
"-moz-buttonactivetext",
"-moz-buttonactiveface",
"-moz-colheaderhovertext",
"-moz-colheadertext",
"-moz-system-color(highlight, light)",

Просмотреть файл

@ -360,10 +360,12 @@ pub enum SystemColor {
/// Used for button text when pressed.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
MozGtkButtonactivetext,
MozButtonactivetext,
/// Used for button background when pressed.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
MozButtonactiveface,
/// Used for button text when pressed.
MozMacButtonactivetext,
/// Background color of chrome toolbars in active windows.
MozMacChromeActive,
/// Background color of chrome toolbars in inactive windows.

Просмотреть файл

@ -37,7 +37,7 @@ button:where(:hover:not([checked="true"])) {
/* .......... active state .......... */
button:where(:hover:active, [open="true"]) {
color: -moz-gtk-buttonactivetext;
color: -moz-buttonactivetext;
}
/* .......... disabled state .......... */

Просмотреть файл

@ -25,7 +25,7 @@ label {
:host([native]:not([disabled="true"]):hover:active),
:host([native]:not([disabled="true"])[open="true"]) {
color: -moz-gtk-buttonactivetext;
color: -moz-buttonactivetext;
}
:host([native][disabled="true"]) {

Просмотреть файл

@ -14,7 +14,7 @@ button {
}
button:where(:hover:active) {
color: -moz-mac-buttonactivetext;
color: -moz-buttonactivetext;
}
/* When the window isn't focused, the default button background isn't drawn,

Просмотреть файл

@ -201,7 +201,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
// Thanks to mpt26@student.canterbury.ac.nz for the hardcoded values that form the defaults
// if querying the Appearance Manager fails ;)
//
case ColorID::MozMacButtonactivetext:
case ColorID::MozButtonactivetext:
case ColorID::MozMacDefaultbuttontext:
color = NS_RGB(0xFF, 0xFF, 0xFF);
break;
@ -232,6 +232,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
break;
case ColorID::Buttonface:
case ColorID::MozButtonhoverface:
case ColorID::MozButtonactiveface:
color = GetColorFromNSColor(NSColor.controlColor);
break;
case ColorID::Buttonhighlight:

Просмотреть файл

@ -579,12 +579,13 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
aColor = mButtonDefault;
break;
case ColorID::MozButtonhoverface:
case ColorID::MozButtonactiveface:
aColor = mButtonHoverFace;
break;
case ColorID::MozButtonhovertext:
aColor = mButtonHoverText;
break;
case ColorID::MozGtkButtonactivetext:
case ColorID::MozButtonactivetext:
aColor = mButtonActiveText;
break;
case ColorID::MozMenuhover:

Просмотреть файл

@ -57,7 +57,7 @@ nsresult HeadlessLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::MozEventreerow:
aColor = NS_RGB(0xff, 0xff, 0xff);
break;
case ColorID::MozMacButtonactivetext:
case ColorID::MozButtonactivetext:
case ColorID::MozMacDefaultbuttontext:
aColor = NS_RGB(0xff, 0xff, 0xff);
break;

Просмотреть файл

@ -278,8 +278,8 @@ static const char sColorPrefs[][41] = {
"ui.-moz_menubarhovertext",
"ui.-moz_eventreerow",
"ui.-moz_oddtreerow",
"ui.-moz-gtk-buttonactivetext",
"ui.-moz-mac-buttonactivetext",
"ui.-moz-buttonactivetext",
"ui.-moz-buttonactiveface",
"ui.-moz_mac_chrome_active",
"ui.-moz_mac_chrome_inactive",
"ui.-moz-mac-defaultbuttontext",
@ -562,8 +562,9 @@ nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID,
COLOR(Selecteditem, 0x33, 0x99, 0xFF)
COLOR(Selecteditemtext, 0xFF, 0xFF, 0xFF)
COLOR(MozButtonhoverface, 0xF0, 0xF0, 0xF0)
COLOR(MozGtkButtonactivetext, 0x00, 0x00, 0x00)
COLOR(MozButtonhovertext, 0x00, 0x00, 0x00)
COLOR(MozButtonactiveface, 0xF0, 0xF0, 0xF0)
COLOR(MozButtonactivetext, 0x00, 0x00, 0x00)
COLOR(MozMenuhover, 0x33, 0x99, 0xFF)
COLOR(MozMenuhovertext, 0x00, 0x00, 0x00)
COLOR(MozMenubartext, 0x00, 0x00, 0x00)
@ -635,6 +636,8 @@ Maybe<nscolor> nsXPLookAndFeel::GenericDarkColor(ColorID aID) {
case ColorID::Fieldtext:
case ColorID::Buttontext: // --in-content-button-text-color (via
// --in-content-page-color)
case ColorID::MozButtonhovertext:
case ColorID::MozButtonactivetext:
#endif
color = NS_RGB(251, 251, 254);
break;
@ -652,6 +655,12 @@ Maybe<nscolor> nsXPLookAndFeel::GenericDarkColor(ColorID aID) {
// --in-content-item-selected-text
color = NS_RGB(43, 42, 51);
break;
case ColorID::MozButtonhoverface: // --in-content-button-background-hover
color = NS_RGB(82, 82, 94);
break;
case ColorID::MozButtonactiveface: // --in-content-button-background-active
color = NS_RGB(91, 91, 102);
break;
#endif
case ColorID::Highlight:
color = NS_RGBA(0, 221, 255, 153);
@ -994,7 +1003,8 @@ static bool ShouldUseStandinsForNativeColorForNonNativeTheme(
case ColorID::Buttontext:
case ColorID::MozButtonhoverface:
case ColorID::MozButtonhovertext:
case ColorID::MozGtkButtonactivetext:
case ColorID::MozButtonactiveface:
case ColorID::MozButtonactivetext:
case ColorID::MozCombobox:
case ColorID::MozComboboxtext:

Просмотреть файл

@ -65,7 +65,7 @@ var colors = {
"-moz-hyperlinktext": ["rgb(0, 0, 238)"],
"-moz-html-cellhighlight": ["rgb(212, 212, 212)"],
"-moz-html-cellhighlighttext": ["rgb(0, 0, 0)"],
"-moz-mac-buttonactivetext": ["rgb(0, 0, 0)", "rgb(255, 255, 255)"],
"-moz-buttonactivetext": ["rgb(0, 0, 0)", "rgb(255, 255, 255)"],
"-moz-mac-chrome-active": ["rgb(150, 150, 150)", "rgb(167, 167, 167)", "rgb(178, 178, 178)"],
"-moz-mac-chrome-inactive": ["rgb(202, 202, 202)", "rgb(216, 216, 216)", "rgb(225, 225, 225)"],
"-moz-mac-defaultbuttontext": ["rgb(0, 0, 0)", "rgb(255, 255, 255)"],

Просмотреть файл

@ -192,6 +192,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
break;
case ColorID::Buttonface:
case ColorID::MozButtonhoverface:
case ColorID::MozButtonactiveface:
idx = COLOR_BTNFACE;
break;
case ColorID::Buttonhighlight:
@ -202,6 +203,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
break;
case ColorID::Buttontext:
case ColorID::MozButtonhovertext:
case ColorID::MozButtonactivetext:
idx = COLOR_BTNTEXT;
break;
case ColorID::Captiontext: