Bug 1869299 - Generalize -moz-mac-sidebar into a cross-platform -moz-sidebar{,text,border} set. r=dao,desktop-theme-reviewers,win-reviewers,gstoll

This will be useful for Adwaita. Keep the field colors in this patch
tho.

Differential Revision: https://phabricator.services.mozilla.com/D196150
This commit is contained in:
Emilio Cobos Álvarez 2023-12-12 15:22:44 +00:00
Родитель d1aa4ad7e6
Коммит b21a492ac7
11 изменённых файлов: 37 добавлений и 18 удалений

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

@ -7,10 +7,6 @@
@namespace html url("http://www.w3.org/1999/xhtml");
:root {
--sidebar-border-color: ThreeDShadow;
}
/**
* We intentionally do not include browser-custom-colors.css,
* instead choosing to fall back to system colours and transparencies

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

@ -9,9 +9,6 @@
:root {
--arrowpanel-field-background: light-dark(rgba(249, 249, 250, .3), rgba(12, 12, 13, .3));
--sidebar-border-color: hsla(240, 5%, 5%, .1);
--sidebar-background-color: -moz-mac-sidebar;
}
#browser,

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

@ -9,7 +9,7 @@
/* Places Organizer Sidebars */
#placesList {
background-color: -moz-mac-sidebar;
background-color: -moz-sidebar;
width: 160px;
min-width: 100px;
max-width: 400px;

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

@ -5,8 +5,9 @@
@namespace html url("http://www.w3.org/1999/xhtml");
:root {
--sidebar-background-color: Field;
--sidebar-text-color: FieldText;
--sidebar-background-color: -moz-sidebar;
--sidebar-text-color: -moz-sidebartext;
--sidebar-border-color: -moz-sidebarborder;
}
#sidebar-box {

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

@ -6,10 +6,6 @@
@import url("chrome://browser/skin/contextmenu.css");
@import url("chrome://browser/skin/browser-custom-colors.css");
:root {
--sidebar-border-color: ThreeDLightShadow;
}
#menubar-items {
flex-direction: column; /* for flex hack */
justify-content: normal; /* align the menubar to the top also in customize mode */

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

@ -310,9 +310,15 @@ pub enum SystemColor {
/// Text color of disabled text on toolbars.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
MozMacDisabledtoolbartext,
/// The background of a macOS sidebar.
/// The background of a sidebar.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
MozMacSidebar,
MozSidebar,
/// The foreground color of a sidebar.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
MozSidebartext,
/// The border color of a sidebar.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
MozSidebarborder,
/// Theme accent color.
/// https://drafts.csswg.org/css-color-4/#valdef-system-color-accentcolor

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

@ -179,10 +179,14 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::MozMacDefaultbuttontext:
color = NS_RGB(0xFF, 0xFF, 0xFF);
break;
case ColorID::MozMacSidebar:
case ColorID::MozSidebar:
color = aScheme == ColorScheme::Light ? NS_RGB(0xf6, 0xf6, 0xf6)
: NS_RGB(0x2d, 0x2d, 0x2d);
break;
case ColorID::MozSidebarborder:
// hsla(240, 5%, 5%, .1)
color = NS_RGBA(12, 12, 13, 26);
break;
case ColorID::MozButtonactivetext:
// Pre-macOS 12, pressed buttons were filled with the highlight color and
// the text was white. Starting with macOS 12, pressed (non-default)
@ -194,6 +198,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
break;
case ColorID::Menutext:
case ColorID::Infotext:
case ColorID::MozSidebartext:
color = GetColorFromNSColor(NSColor.textColor);
break;
case ColorID::Windowtext:

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

@ -719,6 +719,15 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
case ColorID::Fieldtext:
aColor = mField.mFg;
break;
case ColorID::MozSidebar:
aColor = mSidebar.mBg;
break;
case ColorID::MozSidebartext:
aColor = mSidebar.mFg;
break;
case ColorID::MozSidebarborder:
aColor = mSidebarBorder;
break;
case ColorID::MozButtonhoverface:
aColor = mButtonHover.mBg;
break;
@ -2025,6 +2034,7 @@ void nsLookAndFeel::PerThemeData::Init() {
mField.mBg = GDK_RGBA_TO_NS_RGBA(bgColor);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
mField.mFg = GDK_RGBA_TO_NS_RGBA(color);
mSidebar = mField;
// Selected text and background
{
@ -2143,6 +2153,7 @@ void nsLookAndFeel::PerThemeData::Init() {
style = GetStyleContext(MOZ_GTK_FRAME);
GetBorderColors(style, &mFrameOuterLightBorder, &mFrameInnerDarkBorder);
}
mSidebarBorder = mFrameInnerDarkBorder;
// Some themes have a unified menu bar, and support window dragging on it
gboolean supports_menubar_drag = FALSE;

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

@ -112,6 +112,8 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
nscolor mComboBoxText = kBlack;
ColorPair mField;
ColorPair mWindow;
ColorPair mSidebar;
nscolor mSidebarBorder = kBlack;
nscolor mMozWindowActiveBorder = kBlack;
nscolor mMozWindowInactiveBorder = kBlack;

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

@ -274,7 +274,9 @@ static const char sColorPrefs[][41] = {
"ui.-moz-mac-defaultbuttontext",
"ui.-moz-mac-focusring",
"ui.-moz_mac_disabledtoolbartext",
"ui.-moz-mac-sidebar",
"ui.-moz-sidebar",
"ui.-moz-sidebartext",
"ui.-moz-sidebarborder",
"ui.accentcolor",
"ui.accentcolortext",
"ui.-moz-autofill-background",

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

@ -301,6 +301,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::Threedlightshadow:
case ColorID::Buttonborder:
case ColorID::MozDisabledfield:
case ColorID::MozSidebarborder:
idx = COLOR_3DLIGHT;
break;
case ColorID::Threedshadow:
@ -318,10 +319,12 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::MozEventreerow:
case ColorID::MozOddtreerow:
case ColorID::Field:
case ColorID::MozSidebar:
case ColorID::MozCombobox:
idx = COLOR_WINDOW;
break;
case ColorID::Fieldtext:
case ColorID::MozSidebartext:
case ColorID::MozComboboxtext:
idx = COLOR_WINDOWTEXT;
break;