Bug 1888203 - Remove appearance: {toolbar,toolbox}. r=mac-reviewers,desktop-theme-reviewers,mstange,dao

* Linux doesn't support them already.
 * macOS doesn't draw anything either.
 * Windows doesn't have dark-color-scheme support so the relevant
   windows that have them need to set appearance none already.

Remove them and simplify the relevant code.

Differential Revision: https://phabricator.services.mozilla.com/D205872
This commit is contained in:
Emilio Cobos Álvarez 2024-03-30 12:17:57 +00:00
parent 185bbd28bd
commit 716b863fb4
11 changed files with 5 additions and 96 deletions

View file

@ -8,7 +8,6 @@
}
#placesToolbar {
appearance: none;
position: relative;
-moz-window-dragging: drag;
padding: env(-moz-mac-titlebar-height) 4px 3px;

View file

@ -82,7 +82,6 @@
/* Toolbar and menus */
#placesToolbar {
appearance: none;
background-color: var(--organizer-toolbar-background);
color: var(--organizer-color);
border-bottom: 1px solid var(--organizer-border-color);

View file

@ -852,9 +852,9 @@ class nsDisplayListBuilder {
/**
* Notifies the builder that a particular themed widget exists
* at the given rectangle within the currently built display list.
* For certain appearance values (currently only StyleAppearance::Toolbar and
* StyleAppearance::WindowTitlebar) this gets called during every display list
* construction, for every themed widget of the right type within the
* For certain appearance values (currently only
* StyleAppearance::MozWindowTitlebar) this gets called during every display
* list construction, for every themed widget of the right type within the
* display list, except for themed widgets which are transformed or have
* effects applied to them (e.g. CSS opacity or filters).
*

View file

@ -1567,18 +1567,12 @@ pub enum Appearance {
TabScrollArrowBack,
#[parse(condition = "ParserContext::chrome_rules_enabled")]
TabScrollArrowForward,
/// A toolbar in an application window.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Toolbar,
/// A single toolbar button (with no associated dropdown).
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Toolbarbutton,
/// The dropdown portion of a toolbar button
#[parse(condition = "ParserContext::chrome_rules_enabled")]
ToolbarbuttonDropdown,
/// The toolbox that contains the toolbars.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Toolbox,
/// A tooltip.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Tooltip,

View file

@ -8,11 +8,6 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
toolbox {
appearance: auto;
-moz-default-appearance: toolbox;
}
toolbar {
background-color: -moz-headerbar;
color: -moz-headerbartext;

View file

@ -8,14 +8,7 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
toolbox {
appearance: auto;
-moz-default-appearance: toolbox;
}
toolbar {
appearance: auto;
-moz-default-appearance: toolbar;
min-width: 1px;
min-height: 19px;
}
@ -24,13 +17,6 @@ toolbar:first-child {
min-width: 1px;
}
*|*:root[lwtheme] {
toolbox,
toolbar {
appearance: none;
}
}
toolbarseparator {
appearance: auto;
-moz-default-appearance: separator;

View file

@ -1020,7 +1020,6 @@ static bool IsToolbarStyleContainer(nsIFrame* aFrame) {
}
switch (aFrame->StyleDisplay()->EffectiveAppearance()) {
case StyleAppearance::Toolbar:
case StyleAppearance::Statusbar:
return true;
default:
@ -2662,7 +2661,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
case StyleAppearance::SpinnerDownbutton:
case StyleAppearance::Toolbarbutton:
case StyleAppearance::Separator:
case StyleAppearance::Toolbar:
case StyleAppearance::MozWindowTitlebar:
case StyleAppearance::Statusbar:
case StyleAppearance::Menulist:
@ -3043,8 +3041,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame,
// Some widget types just never change state.
switch (aAppearance) {
case StyleAppearance::MozWindowTitlebar:
case StyleAppearance::Toolbox:
case StyleAppearance::Toolbar:
case StyleAppearance::Statusbar:
case StyleAppearance::Tooltip:
case StyleAppearance::Tabpanels:
@ -3130,13 +3126,11 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Spinner:
case StyleAppearance::SpinnerUpbutton:
case StyleAppearance::SpinnerDownbutton:
case StyleAppearance::Toolbar:
case StyleAppearance::Statusbar:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
case StyleAppearance::Searchfield:
case StyleAppearance::Toolbox:
case StyleAppearance::ProgressBar:
case StyleAppearance::Progresschunk:
case StyleAppearance::Meter:
@ -3217,7 +3211,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(
case StyleAppearance::SpinnerUpbutton:
case StyleAppearance::SpinnerDownbutton:
case StyleAppearance::Separator:
case StyleAppearance::Toolbox:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Treeview:
@ -3255,7 +3248,6 @@ nsITheme::Transparency nsNativeThemeCocoa::GetWidgetTransparency(
switch (aAppearance) {
case StyleAppearance::Menupopup:
case StyleAppearance::Tooltip:
case StyleAppearance::Toolbar:
return eTransparent;
case StyleAppearance::MozMacUnifiedToolbarWindow:
// We want these to be treated as opaque by Gecko. We ensure there's an

View file

@ -882,11 +882,6 @@ LayoutDeviceIntMargin nsNativeThemeGTK::GetWidgetBorder(
CSSIntMargin result;
GtkTextDirection direction = GetTextDirection(aFrame);
switch (aAppearance) {
case StyleAppearance::Toolbox:
// gtk has no toolbox equivalent. So, although we map toolbox to
// gtk's 'toolbar' for purposes of painting the widget background,
// we don't use the toolbar border for toolbox.
break;
case StyleAppearance::Dualbutton:
// TOOLBAR_DUAL_BUTTON is an interesting case. We want a border to draw
// around the entire button + dropdown, and also an inner border if you're
@ -1167,9 +1162,7 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame,
}
// Some widget types just never change state.
if (aAppearance == StyleAppearance::Toolbox ||
aAppearance == StyleAppearance::Toolbar ||
aAppearance == StyleAppearance::Progresschunk ||
if (aAppearance == StyleAppearance::Progresschunk ||
aAppearance == StyleAppearance::ProgressBar ||
aAppearance == StyleAppearance::Tooltip ||
aAppearance == StyleAppearance::MozWindowDecorations) {
@ -1242,7 +1235,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Button:
case StyleAppearance::Radio:
case StyleAppearance::Checkbox:
case StyleAppearance::Toolbox: // N/A
case StyleAppearance::Toolbarbutton:
case StyleAppearance::Dualbutton: // so we can override the border with 0
case StyleAppearance::ToolbarbuttonDropdown:

View file

@ -484,9 +484,6 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
return Some(eUXEdit);
case StyleAppearance::Toolbox:
return Some(eUXRebar);
case StyleAppearance::Toolbar:
case StyleAppearance::Toolbarbutton:
case StyleAppearance::Separator:
return Some(eUXToolbar);
@ -719,27 +716,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
}
return NS_OK;
}
case StyleAppearance::Toolbox: {
aState = 0;
aPart = RP_BACKGROUND;
return NS_OK;
}
case StyleAppearance::Toolbar: {
// Use -1 to indicate we don't wish to have the theme background drawn
// for this item. We will pass any nessessary information via aState,
// and will render the item using separate code.
aPart = -1;
aState = 0;
if (aFrame) {
nsIContent* content = aFrame->GetContent();
nsIContent* parent = content->GetParent();
// XXXzeniko hiding the first toolbar will result in an unwanted margin
if (parent && parent->GetFirstChild() == content) {
aState = 1;
}
}
return NS_OK;
}
case StyleAppearance::Treeview:
case StyleAppearance::Listbox: {
aPart = TREEVIEW_BODY;
@ -1031,16 +1007,6 @@ RENDER_AGAIN:
::DeleteObject(hPen);
}
}
} else if (aAppearance == StyleAppearance::Toolbar && state == 0) {
// Draw toolbar separator lines above all toolbars except the first one.
// The lines are part of the Rebar theme, which is loaded for
// StyleAppearance::Toolbox.
theme = GetTheme(StyleAppearance::Toolbox);
if (!theme) return NS_ERROR_FAILURE;
widgetRect.bottom = widgetRect.top + TB_SEPARATOR_HEIGHT;
DrawThemeEdge(theme, hdc, RP_BAND, 0, &widgetRect, EDGE_ETCHED, BF_TOP,
nullptr);
}
nativeDrawing.EndNativeDrawing();
@ -1101,7 +1067,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::GetWidgetBorder(
}
if (!WidgetIsContainer(aAppearance) ||
aAppearance == StyleAppearance::Toolbox ||
aAppearance == StyleAppearance::Tabpanel)
return result; // Don't worry about it.
@ -1109,12 +1074,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::GetWidgetBorder(
nsresult rv = GetThemePartAndState(aFrame, aAppearance, part, state);
if (NS_FAILED(rv)) return result;
if (aAppearance == StyleAppearance::Toolbar) {
// make space for the separator line above all toolbars but the first
if (state == 0) result.top = TB_SEPARATOR_HEIGHT;
return result;
}
result = GetCachedWidgetBorder(theme, themeClass.value(), aAppearance, part,
state);
@ -1278,8 +1237,6 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
switch (aAppearance) {
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Toolbox:
case StyleAppearance::Toolbar:
case StyleAppearance::Progresschunk:
case StyleAppearance::Tabpanels:
case StyleAppearance::Tabpanel:
@ -1352,9 +1309,7 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame,
nsAtom* aAttribute, bool* aShouldRepaint,
const nsAttrValue* aOldValue) {
// Some widget types just never change state.
if (aAppearance == StyleAppearance::Toolbox ||
aAppearance == StyleAppearance::Toolbar ||
aAppearance == StyleAppearance::Progresschunk ||
if (aAppearance == StyleAppearance::Progresschunk ||
aAppearance == StyleAppearance::ProgressBar ||
aAppearance == StyleAppearance::Tabpanels ||
aAppearance == StyleAppearance::Tabpanel ||

View file

@ -62,8 +62,6 @@ const wchar_t* nsUXThemeData::GetClassName(nsUXThemeClass cls) {
return L"Button";
case eUXEdit:
return L"Edit";
case eUXRebar:
return L"Rebar";
case eUXToolbar:
return L"Toolbar";
case eUXProgress:

View file

@ -19,7 +19,6 @@
enum nsUXThemeClass {
eUXButton = 0,
eUXEdit,
eUXRebar,
eUXToolbar,
eUXProgress,
eUXTab,