Bug 1962978 - Use non-native listboxes on GTK. r=stransky,geckoview-reviewers,nika
Gtk4 doesn't use different background colors for GtkColumnView (the replacement for the treeview), so avoid computing one. Our computation didn't have any guarantee of matching the fieldtext foreground color. This matches windows too. Remove unused -moz-eventreerow while at it. Differential Revision: https://phabricator.services.mozilla.com/D249237
This commit is contained in:
committed by
ealvarez@mozilla.com
parent
bcedd1dfc3
commit
751e7a3b2a
@@ -46,7 +46,6 @@ function runTest(testCanvasColors) {
|
|||||||
[ "-moz-ComboboxText", 0x00, 0x00, 0x00 ],
|
[ "-moz-ComboboxText", 0x00, 0x00, 0x00 ],
|
||||||
[ "-moz-Dialog", 0xF0, 0xF0, 0xF0 ],
|
[ "-moz-Dialog", 0xF0, 0xF0, 0xF0 ],
|
||||||
[ "-moz-DialogText", 0x00, 0x00, 0x00 ],
|
[ "-moz-DialogText", 0x00, 0x00, 0x00 ],
|
||||||
[ "-moz-EvenTreeRow", 0xFF, 0xFF, 0xFF ],
|
|
||||||
[ "-moz-Field", 0xFF, 0xFF, 0xFF ],
|
[ "-moz-Field", 0xFF, 0xFF, 0xFF ],
|
||||||
[ "-moz-FieldText", 0x00, 0x00, 0x00 ],
|
[ "-moz-FieldText", 0x00, 0x00, 0x00 ],
|
||||||
[ "-moz-MenuHover", 0x33, 0x99, 0xFF ],
|
[ "-moz-MenuHover", 0x33, 0x99, 0xFF ],
|
||||||
|
|||||||
@@ -270,9 +270,8 @@ pub enum SystemColor {
|
|||||||
/// Used for menubar item text when hovered.
|
/// Used for menubar item text when hovered.
|
||||||
MozMenubarhovertext,
|
MozMenubarhovertext,
|
||||||
|
|
||||||
/// On platforms where these colors are the same as -moz-field, use
|
/// On platforms where this color is the same as field, or transparent, use fieldtext as
|
||||||
/// -moz-fieldtext as foreground color
|
/// foreground color.
|
||||||
MozEventreerow,
|
|
||||||
MozOddtreerow,
|
MozOddtreerow,
|
||||||
|
|
||||||
/// Used for button text when pressed.
|
/// Used for button text when pressed.
|
||||||
|
|||||||
@@ -223,7 +223,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
|
|||||||
case ColorID::Field:
|
case ColorID::Field:
|
||||||
case ColorID::Threedhighlight:
|
case ColorID::Threedhighlight:
|
||||||
case ColorID::MozCombobox:
|
case ColorID::MozCombobox:
|
||||||
case ColorID::MozEventreerow:
|
|
||||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -326,7 +326,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
|
|||||||
break;
|
break;
|
||||||
case ColorID::MozColheader:
|
case ColorID::MozColheader:
|
||||||
case ColorID::MozColheaderhover:
|
case ColorID::MozColheaderhover:
|
||||||
case ColorID::MozEventreerow:
|
|
||||||
// Background color of even list rows.
|
// Background color of even list rows.
|
||||||
aColor =
|
aColor =
|
||||||
GetColorFromNSColor(NSColor.controlAlternatingRowBackgroundColors[0]);
|
GetColorFromNSColor(NSColor.controlAlternatingRowBackgroundColors[0]);
|
||||||
|
|||||||
@@ -779,10 +779,6 @@ static GtkStyleContext* GetCssNodeStyleInternal(WidgetNodeType aNodeType) {
|
|||||||
case MOZ_GTK_FRAME_BORDER:
|
case MOZ_GTK_FRAME_BORDER:
|
||||||
style = CreateChildCSSNode("border", MOZ_GTK_FRAME);
|
style = CreateChildCSSNode("border", MOZ_GTK_FRAME);
|
||||||
break;
|
break;
|
||||||
case MOZ_GTK_TREEVIEW_VIEW:
|
|
||||||
// TODO - create from CSS node
|
|
||||||
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
|
|
||||||
break;
|
|
||||||
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
||||||
style = CreateChildCSSNode("separator", MOZ_GTK_SPLITTER_HORIZONTAL);
|
style = CreateChildCSSNode("separator", MOZ_GTK_SPLITTER_HORIZONTAL);
|
||||||
break;
|
break;
|
||||||
@@ -870,9 +866,6 @@ static GtkStyleContext* GetWidgetStyleInternal(WidgetNodeType aNodeType) {
|
|||||||
break;
|
break;
|
||||||
case MOZ_GTK_FRAME_BORDER:
|
case MOZ_GTK_FRAME_BORDER:
|
||||||
return GetWidgetRootStyle(MOZ_GTK_FRAME);
|
return GetWidgetRootStyle(MOZ_GTK_FRAME);
|
||||||
case MOZ_GTK_TREEVIEW_VIEW:
|
|
||||||
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
|
|
||||||
break;
|
|
||||||
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
||||||
style = CreateSubStyleWithClass(MOZ_GTK_SPLITTER_HORIZONTAL,
|
style = CreateSubStyleWithClass(MOZ_GTK_SPLITTER_HORIZONTAL,
|
||||||
GTK_STYLE_CLASS_PANE_SEPARATOR);
|
GTK_STYLE_CLASS_PANE_SEPARATOR);
|
||||||
|
|||||||
@@ -344,38 +344,6 @@ static gint moz_gtk_vpaned_paint(cairo_t* cr, GdkRectangle* rect,
|
|||||||
return MOZ_GTK_SUCCESS;
|
return MOZ_GTK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint moz_gtk_treeview_paint(cairo_t* cr, GdkRectangle* rect,
|
|
||||||
GtkWidgetState* state,
|
|
||||||
GtkTextDirection direction) {
|
|
||||||
gint xthickness, ythickness;
|
|
||||||
GtkStyleContext* style;
|
|
||||||
GtkStyleContext* style_tree;
|
|
||||||
GtkStateFlags state_flags;
|
|
||||||
GtkBorder border;
|
|
||||||
|
|
||||||
/* only handle disabled and normal states, otherwise the whole background
|
|
||||||
* area will be painted differently with other states */
|
|
||||||
state_flags =
|
|
||||||
state->disabled ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL;
|
|
||||||
|
|
||||||
style =
|
|
||||||
GetStyleContext(MOZ_GTK_SCROLLED_WINDOW, state->image_scale, direction);
|
|
||||||
gtk_style_context_get_border(style, state_flags, &border);
|
|
||||||
xthickness = border.left;
|
|
||||||
ythickness = border.top;
|
|
||||||
|
|
||||||
style_tree =
|
|
||||||
GetStyleContext(MOZ_GTK_TREEVIEW_VIEW, state->image_scale, direction);
|
|
||||||
gtk_render_background(style_tree, cr, rect->x + xthickness,
|
|
||||||
rect->y + ythickness, rect->width - 2 * xthickness,
|
|
||||||
rect->height - 2 * ythickness);
|
|
||||||
|
|
||||||
style =
|
|
||||||
GetStyleContext(MOZ_GTK_SCROLLED_WINDOW, state->image_scale, direction);
|
|
||||||
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
|
|
||||||
return MOZ_GTK_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint moz_gtk_resizer_paint(cairo_t* cr, GdkRectangle* rect,
|
static gint moz_gtk_resizer_paint(cairo_t* cr, GdkRectangle* rect,
|
||||||
GtkWidgetState* state,
|
GtkWidgetState* state,
|
||||||
GtkTextDirection direction) {
|
GtkTextDirection direction) {
|
||||||
@@ -649,11 +617,6 @@ gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
|
|||||||
*left = *top = *right = *bottom = 0;
|
*left = *top = *right = *bottom = 0;
|
||||||
|
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case MOZ_GTK_TREEVIEW: {
|
|
||||||
style = GetStyleContext(MOZ_GTK_SCROLLED_WINDOW);
|
|
||||||
moz_gtk_add_style_border(style, left, top, right, bottom);
|
|
||||||
return MOZ_GTK_SUCCESS;
|
|
||||||
}
|
|
||||||
case MOZ_GTK_TABPANELS:
|
case MOZ_GTK_TABPANELS:
|
||||||
w = GetWidget(MOZ_GTK_TABPANELS);
|
w = GetWidget(MOZ_GTK_TABPANELS);
|
||||||
break;
|
break;
|
||||||
@@ -748,8 +711,6 @@ gint moz_gtk_widget_paint(WidgetNodeType widget, cairo_t* cr,
|
|||||||
cairo_new_path(cr);
|
cairo_new_path(cr);
|
||||||
|
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case MOZ_GTK_TREEVIEW:
|
|
||||||
return moz_gtk_treeview_paint(cr, rect, state, direction);
|
|
||||||
case MOZ_GTK_FRAME:
|
case MOZ_GTK_FRAME:
|
||||||
return moz_gtk_frame_paint(cr, rect, state, direction);
|
return moz_gtk_frame_paint(cr, rect, state, direction);
|
||||||
case MOZ_GTK_RESIZER:
|
case MOZ_GTK_RESIZER:
|
||||||
|
|||||||
@@ -152,8 +152,6 @@ enum WidgetNodeType : int {
|
|||||||
MOZ_GTK_TABPANELS,
|
MOZ_GTK_TABPANELS,
|
||||||
/* Paints the expander and border of a GtkTreeView */
|
/* Paints the expander and border of a GtkTreeView */
|
||||||
MOZ_GTK_TREEVIEW,
|
MOZ_GTK_TREEVIEW,
|
||||||
/* Paints the border of a GtkTreeView */
|
|
||||||
MOZ_GTK_TREEVIEW_VIEW,
|
|
||||||
/* Paints treeheader cells */
|
/* Paints treeheader cells */
|
||||||
MOZ_GTK_TREE_HEADER_CELL,
|
MOZ_GTK_TREE_HEADER_CELL,
|
||||||
/* Paints the background of menus, context menus. */
|
/* Paints the background of menus, context menus. */
|
||||||
|
|||||||
@@ -880,7 +880,6 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
|
|||||||
aColor = mIsDark ? *GenericDarkColor(aID) : NS_RGB(0xDC, 0xDC, 0xDC);
|
aColor = mIsDark ? *GenericDarkColor(aID) : NS_RGB(0xDC, 0xDC, 0xDC);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ColorID::MozEventreerow:
|
|
||||||
case ColorID::Field:
|
case ColorID::Field:
|
||||||
aColor = mField.mBg;
|
aColor = mField.mBg;
|
||||||
break;
|
break;
|
||||||
@@ -914,12 +913,10 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
|
|||||||
case ColorID::MozMenuhovertext:
|
case ColorID::MozMenuhovertext:
|
||||||
aColor = mMenuHover.mFg;
|
aColor = mMenuHover.mFg;
|
||||||
break;
|
break;
|
||||||
|
case ColorID::MozOddtreerow:
|
||||||
case ColorID::MozMenuhoverdisabled:
|
case ColorID::MozMenuhoverdisabled:
|
||||||
aColor = NS_TRANSPARENT;
|
aColor = NS_TRANSPARENT;
|
||||||
break;
|
break;
|
||||||
case ColorID::MozOddtreerow:
|
|
||||||
aColor = mOddCellBackground;
|
|
||||||
break;
|
|
||||||
case ColorID::Linktext:
|
case ColorID::Linktext:
|
||||||
aColor = mNativeHyperLinkText;
|
aColor = mNativeHyperLinkText;
|
||||||
break;
|
break;
|
||||||
@@ -2367,21 +2364,6 @@ void nsLookAndFeel::PerThemeData::Init() {
|
|||||||
mButtonActive.mBg = mWindow.mBg;
|
mButtonActive.mBg = mWindow.mBg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GTK's guide to fancy odd row background colors:
|
|
||||||
// 1) Check if a theme explicitly defines an odd row color
|
|
||||||
// 2) If not, check if it defines an even row color, and darken it
|
|
||||||
// slightly by a hardcoded value (gtkstyle.c)
|
|
||||||
// 3) If neither are defined, take the base background color and
|
|
||||||
// darken that by a hardcoded value
|
|
||||||
style = GetStyleContext(MOZ_GTK_TREEVIEW);
|
|
||||||
|
|
||||||
// Get odd row background color
|
|
||||||
gtk_style_context_save(style);
|
|
||||||
gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD);
|
|
||||||
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
|
||||||
mOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
|
|
||||||
gtk_style_context_restore(style);
|
|
||||||
|
|
||||||
// Column header colors
|
// Column header colors
|
||||||
style = GetStyleContext(MOZ_GTK_TREE_HEADER_CELL);
|
style = GetStyleContext(MOZ_GTK_TREE_HEADER_CELL);
|
||||||
mMozColHeader = GetColorPair(style, GTK_STATE_FLAG_NORMAL);
|
mMozColHeader = GetColorPair(style, GTK_STATE_FLAG_NORMAL);
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
|
|||||||
nscolor mButtonBorder = kBlack;
|
nscolor mButtonBorder = kBlack;
|
||||||
nscolor mThreeDHighlight = kBlack;
|
nscolor mThreeDHighlight = kBlack;
|
||||||
nscolor mThreeDShadow = kBlack;
|
nscolor mThreeDShadow = kBlack;
|
||||||
nscolor mOddCellBackground = kWhite;
|
|
||||||
nscolor mNativeHyperLinkText = kBlack;
|
nscolor mNativeHyperLinkText = kBlack;
|
||||||
nscolor mNativeVisitedHyperLinkText = kBlack;
|
nscolor mNativeVisitedHyperLinkText = kBlack;
|
||||||
ColorPair mField;
|
ColorPair mField;
|
||||||
|
|||||||
@@ -199,9 +199,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (aAppearance) {
|
switch (aAppearance) {
|
||||||
case StyleAppearance::Listbox:
|
|
||||||
aGtkWidgetType = MOZ_GTK_TREEVIEW;
|
|
||||||
break;
|
|
||||||
case StyleAppearance::Tabpanels:
|
case StyleAppearance::Tabpanels:
|
||||||
aGtkWidgetType = MOZ_GTK_TABPANELS;
|
aGtkWidgetType = MOZ_GTK_TABPANELS;
|
||||||
break;
|
break;
|
||||||
@@ -761,6 +758,7 @@ bool nsNativeThemeGTK::IsWidgetAlwaysNonNative(nsIFrame* aFrame,
|
|||||||
aAppearance == StyleAppearance::Radio ||
|
aAppearance == StyleAppearance::Radio ||
|
||||||
aAppearance == StyleAppearance::Button ||
|
aAppearance == StyleAppearance::Button ||
|
||||||
aAppearance == StyleAppearance::Toolbarbutton ||
|
aAppearance == StyleAppearance::Toolbarbutton ||
|
||||||
|
aAppearance == StyleAppearance::Listbox ||
|
||||||
aAppearance == StyleAppearance::Menulist ||
|
aAppearance == StyleAppearance::Menulist ||
|
||||||
aAppearance == StyleAppearance::ProgressBar ||
|
aAppearance == StyleAppearance::ProgressBar ||
|
||||||
aAppearance == StyleAppearance::Progresschunk ||
|
aAppearance == StyleAppearance::Progresschunk ||
|
||||||
@@ -824,7 +822,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (aAppearance) {
|
switch (aAppearance) {
|
||||||
case StyleAppearance::Listbox:
|
|
||||||
case StyleAppearance::Tab:
|
case StyleAppearance::Tab:
|
||||||
// case StyleAppearance::Tabpanel:
|
// case StyleAppearance::Tabpanel:
|
||||||
case StyleAppearance::Tabpanels:
|
case StyleAppearance::Tabpanels:
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ static const char sColorPrefs[][41] = {
|
|||||||
"ui.-moz_menuhoverdisabled",
|
"ui.-moz_menuhoverdisabled",
|
||||||
"ui.-moz_menuhovertext",
|
"ui.-moz_menuhovertext",
|
||||||
"ui.-moz_menubarhovertext",
|
"ui.-moz_menubarhovertext",
|
||||||
"ui.-moz_eventreerow",
|
|
||||||
"ui.-moz_oddtreerow",
|
"ui.-moz_oddtreerow",
|
||||||
"ui.-moz-buttonactivetext",
|
"ui.-moz-buttonactivetext",
|
||||||
"ui.-moz-buttonactiveface",
|
"ui.-moz-buttonactiveface",
|
||||||
@@ -703,7 +702,6 @@ nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID,
|
|||||||
COLOR(MozMenuhovertext, 0x00, 0x00, 0x00)
|
COLOR(MozMenuhovertext, 0x00, 0x00, 0x00)
|
||||||
COLOR(MozMenubarhovertext, 0x00, 0x00, 0x00)
|
COLOR(MozMenubarhovertext, 0x00, 0x00, 0x00)
|
||||||
COLOR(MozMenuhoverdisabled, 0xF0, 0xF0, 0xF0)
|
COLOR(MozMenuhoverdisabled, 0xF0, 0xF0, 0xF0)
|
||||||
COLOR(MozEventreerow, 0xFF, 0xFF, 0xFF)
|
|
||||||
COLOR(MozOddtreerow, 0xFF, 0xFF, 0xFF)
|
COLOR(MozOddtreerow, 0xFF, 0xFF, 0xFF)
|
||||||
COLOR(MozMacFocusring, 0x60, 0x9D, 0xD7)
|
COLOR(MozMacFocusring, 0x60, 0x9D, 0xD7)
|
||||||
COLOR(MozMacDisabledtoolbartext, 0x3F, 0x3F, 0x3F)
|
COLOR(MozMacDisabledtoolbartext, 0x3F, 0x3F, 0x3F)
|
||||||
@@ -754,7 +752,6 @@ Maybe<nscolor> nsXPLookAndFeel::GenericDarkColor(ColorID aID) {
|
|||||||
color = NS_RGB(0x3a, 0x39, 0x44);
|
color = NS_RGB(0x3a, 0x39, 0x44);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ColorID::MozEventreerow:
|
|
||||||
case ColorID::MozOddtreerow:
|
case ColorID::MozOddtreerow:
|
||||||
case ColorID::MozDialog: // --background-color-box
|
case ColorID::MozDialog: // --background-color-box
|
||||||
color = NS_RGB(35, 34, 43);
|
color = NS_RGB(35, 34, 43);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ var colors = {
|
|||||||
"-moz-buttonhovertext": ["rgb(0, 0, 0)"],
|
"-moz-buttonhovertext": ["rgb(0, 0, 0)"],
|
||||||
"-moz-cellhighlight": ["rgb(212, 212, 212)", "rgb(220, 220, 220)"],
|
"-moz-cellhighlight": ["rgb(212, 212, 212)", "rgb(220, 220, 220)"],
|
||||||
"-moz-cellhighlighttext": ["rgb(0, 0, 0)"],
|
"-moz-cellhighlighttext": ["rgb(0, 0, 0)"],
|
||||||
"-moz-eventreerow": ["rgb(255, 255, 255)"],
|
|
||||||
"-moz-field": ["rgb(255, 255, 255)"],
|
"-moz-field": ["rgb(255, 255, 255)"],
|
||||||
"-moz-fieldtext": ["rgb(0, 0, 0)"],
|
"-moz-fieldtext": ["rgb(0, 0, 0)"],
|
||||||
"-moz-dialog": ["rgb(232, 232, 232)"],
|
"-moz-dialog": ["rgb(232, 232, 232)"],
|
||||||
|
|||||||
@@ -186,10 +186,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
|
|||||||
// For inactive list selection
|
// For inactive list selection
|
||||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||||
break;
|
break;
|
||||||
case ColorID::MozEventreerow:
|
|
||||||
// Background color of even list rows.
|
|
||||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
|
||||||
break;
|
|
||||||
case ColorID::MozOddtreerow:
|
case ColorID::MozOddtreerow:
|
||||||
// Background color of odd list rows.
|
// Background color of odd list rows.
|
||||||
aResult = NS_TRANSPARENT;
|
aResult = NS_TRANSPARENT;
|
||||||
|
|||||||
@@ -402,7 +402,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
|
|||||||
case ColorID::Fieldtext:
|
case ColorID::Fieldtext:
|
||||||
idx = mHighContrastOn ? COLOR_BTNTEXT : COLOR_WINDOWTEXT;
|
idx = mHighContrastOn ? COLOR_BTNTEXT : COLOR_WINDOWTEXT;
|
||||||
break;
|
break;
|
||||||
case ColorID::MozEventreerow:
|
|
||||||
case ColorID::MozOddtreerow:
|
case ColorID::MozOddtreerow:
|
||||||
case ColorID::MozSidebar:
|
case ColorID::MozSidebar:
|
||||||
case ColorID::MozCombobox:
|
case ColorID::MozCombobox:
|
||||||
|
|||||||
Reference in New Issue
Block a user