Bug 1738614 - Remove WindowBackground/Foreground system colors. r=mstange

There's no reason for these to be different to the CSS-exposed
Window/WindowText.

Differential Revision: https://phabricator.services.mozilla.com/D129990
This commit is contained in:
Emilio Cobos Álvarez 2021-11-02 18:08:07 +00:00
Родитель 0aadb60b82
Коммит ac14d7e42d
11 изменённых файлов: 6 добавлений и 47 удалений

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

@ -4078,7 +4078,7 @@ void nsTextPaintStyle::InitCommonColors() {
"default background color is not opaque");
nscolor defaultWindowBackgroundColor =
LookAndFeel::Color(LookAndFeel::ColorID::WindowBackground, mFrame);
LookAndFeel::Color(LookAndFeel::ColorID::Window, mFrame);
nscolor selectionTextColor =
LookAndFeel::Color(LookAndFeel::ColorID::Highlighttext, mFrame);
nscolor selectionBGColor =

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

@ -126,14 +126,10 @@ void PreferenceSheet::Prefs::LoadColors(bool aIsLight) {
} else {
using ColorID = LookAndFeel::ColorID;
const auto standins = LookAndFeel::UseStandins(useStandins);
// FIXME(emilio): Why do we look at a different set of colors when using
// standins vs. not?
colors.mDefault = LookAndFeel::Color(
useStandins ? ColorID::Windowtext : ColorID::WindowForeground, scheme,
standins, colors.mDefault);
colors.mDefault = LookAndFeel::Color(ColorID::Windowtext, scheme, standins,
colors.mDefault);
colors.mDefaultBackground = LookAndFeel::Color(
useStandins ? ColorID::Window : ColorID::WindowBackground, scheme,
standins, colors.mDefaultBackground);
ColorID::Window, scheme, standins, colors.mDefaultBackground);
colors.mLink = LookAndFeel::Color(ColorID::MozNativehyperlinktext, scheme,
standins, colors.mLink);

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

@ -215,10 +215,6 @@ pub enum Color {
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
#[repr(u8)]
pub enum SystemColor {
#[css(skip)]
WindowBackground,
#[css(skip)]
WindowForeground,
#[css(skip)]
WidgetBackground,
#[css(skip)]

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

@ -33,11 +33,11 @@ struct ParamTraits<mozilla::LookAndFeel::IntID>
template <>
struct ParamTraits<mozilla::LookAndFeel::ColorID>
: ContiguousEnumSerializer<mozilla::LookAndFeel::ColorID,
mozilla::LookAndFeel::ColorID::WindowBackground,
mozilla::LookAndFeel::ColorID::WidgetBackground,
mozilla::LookAndFeel::ColorID::End> {
using IdType = std::underlying_type_t<mozilla::LookAndFeel::ColorID>;
static_assert(
static_cast<IdType>(mozilla::LookAndFeel::ColorID::WindowBackground) ==
static_cast<IdType>(mozilla::LookAndFeel::ColorID::WidgetBackground) ==
IdType(0));
};

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

@ -131,9 +131,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
switch (aID) {
// These colors don't seem to be used for anything anymore in Mozilla
// The CSS2 colors below are used.
case ColorID::WindowForeground:
aColor = mSystemColors.textColorPrimary;
break;
case ColorID::WidgetForeground:
case ColorID::MozMenubartext:
aColor = mSystemColors.colorForeground;
@ -240,7 +237,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
aColor = NS_RGB(0xec, 0xe7, 0xe2);
break;
case ColorID::WindowBackground:
case ColorID::Buttonhighlight:
case ColorID::Field:
case ColorID::Threedhighlight:

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

@ -207,7 +207,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
color = GetColorFromNSColor(NSColor.textColor);
break;
case ColorID::Windowtext:
case ColorID::WindowForeground:
case ColorID::WidgetForeground:
color = GetColorFromNSColor(NSColor.windowFrameTextColor);
break;
@ -265,13 +264,11 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
color = NS_RGB(0xDA, 0xDA, 0xDA);
break;
case ColorID::Menu:
case ColorID::TextBackground:
color = GetColorFromNSColor(NSColor.textBackgroundColor);
break;
case ColorID::Windowframe:
color = GetColorFromNSColor(NSColor.windowFrameColor);
break;
case ColorID::WindowBackground:
case ColorID::WidgetBackground:
case ColorID::Window: {
if (@available(macOS 10.14, *)) {

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

@ -402,7 +402,6 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
switch (aID) {
// These colors don't seem to be used for anything anymore in Mozilla
// The CSS2 colors below are used.
case ColorID::WindowBackground:
case ColorID::WidgetBackground:
case ColorID::TextBackground:
case ColorID::Appworkspace: // MDI background color
@ -413,7 +412,6 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
case ColorID::MozCombobox:
aColor = mMozWindowBackground;
break;
case ColorID::WindowForeground:
case ColorID::WidgetForeground:
case ColorID::TextForeground:
case ColorID::Windowtext:

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

@ -100,12 +100,6 @@ nsresult HeadlessLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::WidgetSelectForeground:
aColor = NS_RGB(0x00, 0x00, 0x80);
break;
case ColorID::WindowBackground:
aColor = NS_RGB(0xff, 0xff, 0xff);
break;
case ColorID::WindowForeground:
aColor = NS_RGB(0x00, 0x00, 0x00);
break;
case ColorID::Highlight:
case ColorID::Selecteditem:
case ColorID::MozAccentColor:

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

@ -199,8 +199,6 @@ static_assert(ArrayLength(sFloatPrefs) == size_t(LookAndFeel::FloatID::End),
// This array MUST be kept in the same order as the color list in
// specified/color.rs
static const char sColorPrefs[][41] = {
"ui.windowBackground",
"ui.windowForeground",
"ui.widgetBackground",
"ui.widgetForeground",
"ui.widgetSelectBackground",
@ -633,7 +631,6 @@ Maybe<nscolor> nsXPLookAndFeel::GenericDarkColor(ColorID aID) {
static constexpr nscolor kWindowText = NS_RGB(251, 251, 254);
switch (aID) {
case ColorID::Window: // --in-content-page-background
case ColorID::WindowBackground:
case ColorID::Background:
case ColorID::Menu:
case ColorID::TextBackground:
@ -645,7 +642,6 @@ Maybe<nscolor> nsXPLookAndFeel::GenericDarkColor(ColorID aID) {
break;
case ColorID::Windowtext: // --in-content-page-color
case ColorID::Menutext:
case ColorID::WindowForeground:
case ColorID::TextForeground:
case ColorID::MozDialogtext:
case ColorID::Fieldtext:
@ -1194,8 +1190,6 @@ static bool ColorIsCSSAccessible(LookAndFeel::ColorID aId) {
using ColorID = LookAndFeel::ColorID;
switch (aId) {
case ColorID::WindowBackground:
case ColorID::WindowForeground:
case ColorID::WidgetBackground:
case ColorID::WidgetForeground:
case ColorID::WidgetSelectBackground:

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

@ -46,12 +46,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID, ColorScheme, nscolor& aResult) {
nsresult res = NS_OK;
switch (aID) {
case ColorID::WindowBackground:
aResult = NS_RGB(0xff, 0xff, 0xff);
break;
case ColorID::WindowForeground:
aResult = NS_RGB(0x00, 0x00, 0x00);
break;
case ColorID::WidgetBackground:
aResult = NS_RGB(0xdd, 0xdd, 0xdd);
break;

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

@ -127,12 +127,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
int idx;
switch (aID) {
case ColorID::WindowBackground:
idx = COLOR_WINDOW;
break;
case ColorID::WindowForeground:
idx = COLOR_WINDOWTEXT;
break;
case ColorID::WidgetBackground:
idx = COLOR_BTNFACE;
break;