Bug 1738614 - Remove other Widget* colors. r=mstange

These are only used for frameset painting and the non-e10s <select>
dropdown focus codepath. We have other more appropriate standard
colors for this.

Differential Revision: https://phabricator.services.mozilla.com/D129992
This commit is contained in:
Emilio Cobos Álvarez
2021-11-02 18:08:07 +00:00
parent 1708cbcf2d
commit c5be0433f1
12 changed files with 15 additions and 124 deletions

View File

@@ -217,8 +217,8 @@ void nsListControlFrame::PaintFocus(DrawTarget* aDrawTarget, nsPoint aPt) {
// set up back stop colors and then ask L&F service for the real colors
nscolor color = LookAndFeel::Color(
lastItemIsSelected ? LookAndFeel::ColorID::WidgetSelectForeground
: LookAndFeel::ColorID::WidgetSelectBackground,
lastItemIsSelected ? LookAndFeel::ColorID::Selecteditem
: LookAndFeel::ColorID::Selecteditemtext,
this);
nsCSSRendering::PaintFocus(presContext, aDrawTarget, fRect, color);

View File

@@ -1364,16 +1364,16 @@ void nsHTMLFramesetBorderFrame::PaintBorder(DrawTarget* aDrawTarget,
if (widthInPixels <= 0) return;
ColorPattern bgColor(ToDeviceColor(LookAndFeel::Color(
LookAndFeel::ColorID::WidgetBackground, this, NS_RGB(200, 200, 200))));
LookAndFeel::ColorID::Window, this, NS_RGB(200, 200, 200))));
ColorPattern fgColor(ToDeviceColor(LookAndFeel::Color(
LookAndFeel::ColorID::WidgetForeground, this, NS_RGB(0, 0, 0))));
LookAndFeel::ColorID::Windowtext, this, NS_RGB(0, 0, 0))));
ColorPattern hltColor(ToDeviceColor(LookAndFeel::Color(
LookAndFeel::ColorID::Widget3DHighlight, this, NS_RGB(255, 255, 255))));
LookAndFeel::ColorID::Threedhighlight, this, NS_RGB(255, 255, 255))));
ColorPattern sdwColor(ToDeviceColor(LookAndFeel::Color(
LookAndFeel::ColorID::Widget3DShadow, this, NS_RGB(128, 128, 128))));
LookAndFeel::ColorID::Threedshadow, this, NS_RGB(128, 128, 128))));
ColorPattern color(ToDeviceColor(NS_RGB(255, 255, 255))); // default to white
if (mVisibility) {

View File

@@ -215,18 +215,6 @@ pub enum Color {
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
#[repr(u8)]
pub enum SystemColor {
#[css(skip)]
WidgetBackground,
#[css(skip)]
WidgetForeground,
#[css(skip)]
WidgetSelectBackground,
#[css(skip)]
WidgetSelectForeground,
#[css(skip)]
Widget3DHighlight,
#[css(skip)]
Widget3DShadow,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
TextSelectBackgroundDisabled,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]

View File

@@ -131,9 +131,9 @@ already_AddRefed<nsWebBrowser> nsWebBrowser::Create(
// get the system default window background colour
//
// TODO(emilio): Can we get the color-scheme from somewhere here?
browser->mBackgroundColor = LookAndFeel::Color(
LookAndFeel::ColorID::WindowBackground, LookAndFeel::ColorScheme::Light,
LookAndFeel::UseStandins::No);
browser->mBackgroundColor =
LookAndFeel::Color(LookAndFeel::ColorID::Window, ColorScheme::Light,
LookAndFeel::UseStandins::No);
// HACK ALERT - this registration registers the nsDocShellTreeOwner as a
// nsIWebBrowserListener so it can setup its MouseListener in one of the

View File

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

View File

@@ -131,16 +131,9 @@ 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::WidgetForeground:
case ColorID::MozMenubartext:
aColor = mSystemColors.colorForeground;
break;
case ColorID::Widget3DHighlight:
aColor = NS_RGB(0xa0, 0xa0, 0xa0);
break;
case ColorID::Widget3DShadow:
aColor = NS_RGB(0x40, 0x40, 0x40);
break;
case ColorID::ThemedScrollbarThumbInactive:
case ColorID::ThemedScrollbarThumb:
@@ -151,7 +144,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
case ColorID::IMESelectedRawTextBackground:
case ColorID::IMESelectedConvertedTextBackground:
case ColorID::WidgetSelectBackground:
aColor = mSystemColors.textColorHighlight;
break;
case ColorID::IMESelectedRawTextForeground:
@@ -184,7 +176,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
case ColorID::Inactiveborder: // inactive window border
case ColorID::Inactivecaption: // inactive window caption
case ColorID::Scrollbar: // scrollbar gray area
case ColorID::WidgetBackground:
aColor = mSystemColors.colorBackground;
break;
case ColorID::Graytext: // disabled text in windows, menus, etc.

View File

@@ -118,18 +118,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
case ColorID::Infobackground:
color = NS_RGB(0xdd, 0xdd, 0xdd);
break;
case ColorID::WidgetSelectBackground:
color = NS_RGB(0x80, 0x80, 0x80);
break;
case ColorID::WidgetSelectForeground:
color = NS_RGB(0x00, 0x00, 0x80);
break;
case ColorID::Widget3DHighlight:
color = NS_RGB(0xa0, 0xa0, 0xa0);
break;
case ColorID::Widget3DShadow:
color = NS_RGB(0x40, 0x40, 0x40);
break;
case ColorID::Highlight:
color = ProcessSelectionBackground(GetColorFromNSColor(NSColor.selectedTextBackgroundColor),
aScheme);
@@ -206,7 +194,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
color = GetColorFromNSColor(NSColor.textColor);
break;
case ColorID::Windowtext:
case ColorID::WidgetForeground:
color = GetColorFromNSColor(NSColor.windowFrameTextColor);
break;
case ColorID::Activecaption:
@@ -268,7 +255,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
case ColorID::Windowframe:
color = GetColorFromNSColor(NSColor.windowFrameColor);
break;
case ColorID::WidgetBackground:
case ColorID::Window: {
if (@available(macOS 10.14, *)) {
color = GetColorFromNSColor(NSColor.windowBackgroundColor);

View File

@@ -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::WidgetBackground:
case ColorID::Appworkspace: // MDI background color
case ColorID::Background: // desktop background
case ColorID::Window:
@@ -411,12 +410,10 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
case ColorID::MozCombobox:
aColor = mMozWindowBackground;
break;
case ColorID::WidgetForeground:
case ColorID::Windowtext:
case ColorID::MozDialogtext:
aColor = mMozWindowText;
break;
case ColorID::WidgetSelectBackground:
case ColorID::IMESelectedRawTextBackground:
case ColorID::IMESelectedConvertedTextBackground:
case ColorID::MozDragtargetzone:
@@ -429,7 +426,6 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
break;
}
[[fallthrough]];
case ColorID::WidgetSelectForeground:
case ColorID::IMESelectedRawTextForeground:
case ColorID::IMESelectedConvertedTextForeground:
aColor = mTextSelectedText;
@@ -448,12 +444,6 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
case ColorID::MozCellhighlighttext:
aColor = mMozCellHighlightText;
break;
case ColorID::Widget3DHighlight:
aColor = NS_RGB(0xa0, 0xa0, 0xa0);
break;
case ColorID::Widget3DShadow:
aColor = NS_RGB(0x40, 0x40, 0x40);
break;
case ColorID::IMERawInputBackground:
case ColorID::IMEConvertedTextBackground:
aColor = NS_TRANSPARENT;

View File

@@ -76,24 +76,6 @@ nsresult HeadlessLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::TextSelectBackgroundDisabled:
aColor = NS_RGB(0xaa, 0xaa, 0xaa);
break;
case ColorID::Widget3DHighlight:
aColor = NS_RGB(0xa0, 0xa0, 0xa0);
break;
case ColorID::Widget3DShadow:
aColor = NS_RGB(0x40, 0x40, 0x40);
break;
case ColorID::WidgetBackground:
aColor = NS_RGB(0xdd, 0xdd, 0xdd);
break;
case ColorID::WidgetForeground:
aColor = NS_RGB(0x00, 0x00, 0x00);
break;
case ColorID::WidgetSelectBackground:
aColor = NS_RGB(0x80, 0x80, 0x80);
break;
case ColorID::WidgetSelectForeground:
aColor = NS_RGB(0x00, 0x00, 0x80);
break;
case ColorID::Highlight:
case ColorID::Selecteditem:
case ColorID::MozAccentColor:

View File

@@ -199,12 +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.widgetBackground",
"ui.widgetForeground",
"ui.widgetSelectBackground",
"ui.widgetSelectForeground",
"ui.widget3DHighlight",
"ui.widget3DShadow",
"ui.textSelectBackgroundDisabled",
"ui.textSelectBackgroundAttention",
"ui.textHighlightBackground",
@@ -1186,12 +1180,6 @@ static bool ColorIsCSSAccessible(LookAndFeel::ColorID aId) {
using ColorID = LookAndFeel::ColorID;
switch (aId) {
case ColorID::WidgetBackground:
case ColorID::WidgetForeground:
case ColorID::WidgetSelectBackground:
case ColorID::WidgetSelectForeground:
case ColorID::Widget3DHighlight:
case ColorID::Widget3DShadow:
case ColorID::TextSelectBackgroundDisabled:
case ColorID::TextSelectBackgroundAttention:
case ColorID::TextHighlightBackground:

View File

@@ -46,24 +46,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID, ColorScheme, nscolor& aResult) {
nsresult res = NS_OK;
switch (aID) {
case ColorID::WidgetBackground:
aResult = NS_RGB(0xdd, 0xdd, 0xdd);
break;
case ColorID::WidgetForeground:
aResult = NS_RGB(0x00, 0x00, 0x00);
break;
case ColorID::WidgetSelectBackground:
aResult = NS_RGB(0x80, 0x80, 0x80);
break;
case ColorID::WidgetSelectForeground:
aResult = NS_RGB(0x00, 0x00, 0x80);
break;
case ColorID::Widget3DHighlight:
aResult = NS_RGB(0xa0, 0xa0, 0xa0);
break;
case ColorID::Widget3DShadow:
aResult = NS_RGB(0x40, 0x40, 0x40);
break;
case ColorID::Highlight:
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
break;

View File

@@ -127,24 +127,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
int idx;
switch (aID) {
case ColorID::WidgetBackground:
idx = COLOR_BTNFACE;
break;
case ColorID::WidgetForeground:
idx = COLOR_BTNTEXT;
break;
case ColorID::WidgetSelectBackground:
idx = COLOR_HIGHLIGHT;
break;
case ColorID::WidgetSelectForeground:
idx = COLOR_HIGHLIGHTTEXT;
break;
case ColorID::Widget3DHighlight:
idx = COLOR_BTNHIGHLIGHT;
break;
case ColorID::Widget3DShadow:
idx = COLOR_BTNSHADOW;
break;
case ColorID::IMERawInputBackground:
case ColorID::IMEConvertedTextBackground:
aColor = NS_TRANSPARENT;