зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1531338 - [Linux/Gtk] Get and use Gtk theme text color for active/pressed button, r=dao,emilio
- Follow Gtk and get theme button text color directly from "button" CSS node instead of "button label" - Provide new -moz-gtk-buttonactivetext color for active/pressed button text color - Replace ButtonText color with -moz-gtk-buttonactivetext when it's appropriate Differential Revision: https://phabricator.services.mozilla.com/D30566 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
49cc754a87
Коммит
ba6373e9aa
|
@ -64,12 +64,15 @@
|
|||
-moz-appearance: toolbarbutton;
|
||||
}
|
||||
|
||||
#placesMenu > menu:active,
|
||||
#placesMenu > menu:hover,
|
||||
#placesMenu > menu[open] {
|
||||
#placesMenu > menu:hover {
|
||||
color: ButtonText;
|
||||
}
|
||||
|
||||
#placesMenu > menu:active,
|
||||
#placesMenu > menu[open] {
|
||||
color: -moz-gtk-buttonactivetext;
|
||||
}
|
||||
|
||||
#placesMenu > menu::after {
|
||||
content: "";
|
||||
display: -moz-box;
|
||||
|
|
|
@ -244,6 +244,14 @@ select {
|
|||
overflow-clip-box: padding-box !important; /* bug 992447 */
|
||||
}
|
||||
|
||||
%ifdef MOZ_WIDGET_GTK
|
||||
/* Comboboxes use button styles on Gtk so it's safe to
|
||||
* use a button style here. */
|
||||
select:active:hover {
|
||||
color: -moz-gtk-buttonactivetext;
|
||||
}
|
||||
%endif
|
||||
|
||||
/* Need the "select[size][multiple]" selector to override the settings on
|
||||
'select[size="1"]', eg if one has <select size="1" multiple> */
|
||||
|
||||
|
@ -696,9 +704,14 @@ button:active:hover,
|
|||
input[type="reset"]:active:hover,
|
||||
input[type="button"]:active:hover,
|
||||
input[type="submit"]:active:hover {
|
||||
%ifdef MOZ_WIDGET_GTK
|
||||
color: -moz-gtk-buttonactivetext;
|
||||
%else
|
||||
color: ButtonText;
|
||||
%endif
|
||||
}
|
||||
|
||||
|
||||
button::-moz-focus-inner,
|
||||
input[type="color"]::-moz-focus-inner,
|
||||
input[type="reset"]::-moz-focus-inner,
|
||||
|
|
|
@ -35,6 +35,7 @@ pub mod system_colors {
|
|||
-moz-eventreerow -moz-field -moz-fieldtext -moz-dialog -moz-dialogtext
|
||||
-moz-dragtargetzone -moz-gtk-info-bar-text -moz-html-cellhighlight
|
||||
-moz-html-cellhighlighttext -moz-mac-buttonactivetext
|
||||
-moz-gtk-buttonactivetext
|
||||
-moz-mac-chrome-active -moz-mac-chrome-inactive
|
||||
-moz-mac-defaultbuttontext -moz-mac-focusring -moz-mac-menuselect
|
||||
-moz-mac-menushadow -moz-mac-menutextdisable -moz-mac-menutextselect
|
||||
|
|
|
@ -37,6 +37,12 @@ button:hover:not(:-moz-any(:active,[disabled="true"],[open="true"],[checked="tru
|
|||
color: -moz-buttonhovertext;
|
||||
}
|
||||
|
||||
/* .......... active state .......... */
|
||||
|
||||
button:not([disabled="true"]):-moz-any(:hover:active,[open="true"]) {
|
||||
color: -moz-gtk-buttonactivetext;
|
||||
}
|
||||
|
||||
/* .......... disabled state .......... */
|
||||
|
||||
button[disabled="true"] {
|
||||
|
|
|
@ -134,6 +134,11 @@ class LookAndFeel {
|
|||
eColorID__moz_eventreerow,
|
||||
eColorID__moz_oddtreerow,
|
||||
|
||||
// colors needed by the Linux Gtk theme
|
||||
|
||||
// used to button text, when button is pressed
|
||||
eColorID__moz_gtk_buttonactivetext,
|
||||
|
||||
// colors needed by the Mac OS X theme
|
||||
|
||||
// foreground color of :hover:active buttons
|
||||
|
|
|
@ -429,6 +429,9 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
case eColorID__moz_buttonhovertext:
|
||||
aColor = mButtonHoverText;
|
||||
break;
|
||||
case eColorID__moz_gtk_buttonactivetext:
|
||||
aColor = mButtonActiveText;
|
||||
break;
|
||||
case eColorID__moz_menuhover:
|
||||
aColor = mMenuHover;
|
||||
break;
|
||||
|
@ -1005,21 +1008,22 @@ void nsLookAndFeel::EnsureInit() {
|
|||
style = GetStyleContext(MOZ_GTK_BUTTON);
|
||||
{
|
||||
GtkStyleContext* labelStyle = CreateStyleForWidget(labelWidget, style);
|
||||
|
||||
GetSystemFontInfo(labelStyle, &mButtonFontName, &mButtonFontStyle);
|
||||
|
||||
gtk_style_context_get_border_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
mButtonDefault = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_NORMAL, &color);
|
||||
mButtonText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_PRELIGHT, &color);
|
||||
mButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT,
|
||||
&color);
|
||||
mButtonHoverFace = GDK_RGBA_TO_NS_RGBA(color);
|
||||
g_object_unref(labelStyle);
|
||||
}
|
||||
|
||||
gtk_style_context_get_border_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
mButtonDefault = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
mButtonText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
|
||||
mButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_ACTIVE, &color);
|
||||
mButtonActiveText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT,
|
||||
&color);
|
||||
mButtonHoverFace = GDK_RGBA_TO_NS_RGBA(color);
|
||||
|
||||
// Combobox text color
|
||||
style = GetStyleContext(MOZ_GTK_COMBOBOX_ENTRY_TEXTAREA);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
|
|
|
@ -65,6 +65,7 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
|
|||
nscolor mButtonText = kBlack;
|
||||
nscolor mButtonHoverText = kBlack;
|
||||
nscolor mButtonHoverFace = kWhite;
|
||||
nscolor mButtonActiveText = kBlack;
|
||||
nscolor mFrameOuterLightBorder = kBlack;
|
||||
nscolor mFrameInnerDarkBorder = kBlack;
|
||||
nscolor mOddCellBackground = kWhite;
|
||||
|
|
|
@ -177,6 +177,7 @@ const char nsXPLookAndFeel::sColorPrefs[][41] = {
|
|||
"ui.-moz_menubarhovertext",
|
||||
"ui.-moz_eventreerow",
|
||||
"ui.-moz_oddtreerow",
|
||||
"ui.-moz-gtk-buttonactivetext",
|
||||
"ui.-moz-mac-buttonactivetext",
|
||||
"ui.-moz_mac_chrome_active",
|
||||
"ui.-moz_mac_chrome_inactive",
|
||||
|
@ -646,6 +647,7 @@ nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID) {
|
|||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_oddtreerow:
|
||||
case eColorID__moz_gtk_buttonactivetext:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_mac_chrome_active:
|
||||
|
|
Загрузка…
Ссылка в новой задаче