Bug 1650256 - Remove unused StyleAppearance values. r=emilio

The parsing of these values was disabled in bug 1554150.

Differential Revision: https://phabricator.services.mozilla.com/D82122
This commit is contained in:
Cameron McCormack 2020-07-03 04:06:13 +00:00
Родитель 7a693e1563
Коммит c40850b854
7 изменённых файлов: 10 добавлений и 94 удалений

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

@ -1537,16 +1537,9 @@ pub enum Appearance {
ButtonArrowPrevious,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
ButtonArrowUp,
/// A rectangular button that contains complex content
/// like images (e.g. HTML <button> elements)
#[css(skip)]
ButtonBevel,
/// The focus outline box inside of a button.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
ButtonFocus,
/// The caret of a text area
#[css(skip)]
Caret,
/// A dual toolbar button (e.g., a Back button with a dropdown)
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
Dualbutton,
@ -1557,9 +1550,6 @@ pub enum Appearance {
InnerSpinButton,
/// List boxes.
Listbox,
/// A listbox item.
#[css(skip)]
Listitem,
/// Menu Bar background
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
Menubar,
@ -1580,9 +1570,6 @@ pub enum Appearance {
/// The text part of a dropdown list, to left of button.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
MenulistText,
/// An editable textfield with a dropdown list (a combobox).
#[css(skip)]
MenulistTextfield,
/// Menu Popup background.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
Menupopup,

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

@ -1224,7 +1224,6 @@ void nsNativeThemeCocoa::DrawMenuSeparator(CGContextRef cgContext, const CGRect&
static bool ShouldUnconditionallyDrawFocusRingIfFocused(nsIFrame* aFrame) {
// Mac always draws focus rings for textboxes and lists.
switch (aFrame->StyleDisplay()->mAppearance) {
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
@ -2846,14 +2845,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
WidgetInfo::Button(ButtonParams{ComputeControlParams(aFrame, eventState), buttonType}));
}
case StyleAppearance::ButtonBevel: {
bool isDefaultButton = IsDefaultButton(aFrame);
ButtonType buttonType =
isDefaultButton ? ButtonType::eDefaultBevelButton : ButtonType::eRegularBevelButton;
return Some(
WidgetInfo::Button(ButtonParams{ComputeControlParams(aFrame, eventState), buttonType}));
}
case StyleAppearance::InnerSpinButton: {
case StyleAppearance::Spinner:
bool isSpinner = (aAppearance == StyleAppearance::Spinner);
@ -2951,7 +2942,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
case StyleAppearance::Groupbox:
return Some(WidgetInfo::GroupBox());
case StyleAppearance::MenulistTextfield:
case StyleAppearance::Textfield:
case StyleAppearance::NumberInput: {
// See ShouldUnconditionallyDrawFocusRingIfFocused.
@ -2966,8 +2956,7 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
}
bool isDisabled = IsDisabled(aFrame, eventState) || IsReadOnly(aFrame);
bool borderless = (aAppearance == StyleAppearance::MenulistTextfield && !isFocused);
return Some(WidgetInfo::TextBox(TextBoxParams{isDisabled, isFocused, borderless}));
return Some(WidgetInfo::TextBox(TextBoxParams{isDisabled, isFocused, /* borderless = */ false}));
}
case StyleAppearance::Searchfield:
@ -3414,7 +3403,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
case StyleAppearance::MozMacHelpButton:
case StyleAppearance::MozMacDisclosureButtonOpen:
case StyleAppearance::MozMacDisclosureButtonClosed:
case StyleAppearance::ButtonBevel:
case StyleAppearance::Spinner:
case StyleAppearance::SpinnerUpbutton:
case StyleAppearance::SpinnerDownbutton:
@ -3424,7 +3412,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
case StyleAppearance::MozWindowTitlebar:
case StyleAppearance::Statusbar:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::MenulistButton:
case StyleAppearance::MozMenulistArrowButton:
case StyleAppearance::Groupbox:
@ -3583,7 +3570,6 @@ LayoutDeviceIntMargin nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aCont
result = DirectionAwareMargin(kAquaDropdownBorder, aFrame);
break;
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield: {
SInt32 frameOutset = 0;
@ -3697,7 +3683,6 @@ bool nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame*
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MozMenulistArrowButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::Checkbox:
case StyleAppearance::Radio:
case StyleAppearance::Tab:
@ -3817,7 +3802,6 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame*
break;
}
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
@ -4103,7 +4087,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFra
case StyleAppearance::Button:
case StyleAppearance::ButtonArrowUp:
case StyleAppearance::ButtonArrowDown:
case StyleAppearance::ButtonBevel:
case StyleAppearance::Toolbarbutton:
case StyleAppearance::InnerSpinButton:
case StyleAppearance::Spinner:
@ -4135,7 +4118,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFra
case StyleAppearance::Treeheadersortarrow:
case StyleAppearance::Treeitem:
case StyleAppearance::Treeline:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::MozMacSourceList:
case StyleAppearance::MozMacSourceListSelection:
case StyleAppearance::MozMacActiveSourceListSelection:
@ -4253,7 +4235,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(StyleAppearance aA
case StyleAppearance::SpinnerDownbutton:
case StyleAppearance::Separator:
case StyleAppearance::Toolbox:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Treeview:

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

@ -315,7 +315,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
if (aAppearance == StyleAppearance::NumberInput ||
aAppearance == StyleAppearance::Textfield ||
aAppearance == StyleAppearance::Textarea ||
aAppearance == StyleAppearance::MenulistTextfield ||
aAppearance == StyleAppearance::SpinnerTextfield ||
aAppearance == StyleAppearance::RadioContainer ||
aAppearance == StyleAppearance::RadioLabel) {
@ -626,9 +625,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
break;
case StyleAppearance::MenulistText:
return false; // nothing to do, but prevents the bg from being drawn
case StyleAppearance::MenulistTextfield:
aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY;
break;
case StyleAppearance::MozMenulistArrowButton:
aGtkWidgetType = MOZ_GTK_DROPDOWN_ARROW;
break;
@ -1660,7 +1656,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
aResult->width += border.left + border.right;
aResult->height += border.top + border.bottom;
} break;
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield: {
gint contentHeight = 0;
@ -1885,7 +1880,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Resizerpanel:
case StyleAppearance::Resizer:
case StyleAppearance::Listbox:
// case StyleAppearance::Listitem:
case StyleAppearance::Treeview:
// case StyleAppearance::Treeitem:
case StyleAppearance::Treetwisty:
@ -1921,7 +1915,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::ScrollbarthumbHorizontal:
case StyleAppearance::ScrollbarthumbVertical:
case StyleAppearance::ScrollbarNonDisappearing:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
@ -2004,7 +1997,6 @@ bool nsNativeThemeGTK::ThemeDrawsFocusForWidget(StyleAppearance aAppearance) {
case StyleAppearance::Button:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::Textarea:
case StyleAppearance::Textfield:
case StyleAppearance::Treeheadercell:

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

@ -35,7 +35,6 @@ LayoutDeviceIntMargin HeadlessThemeGTK::GetWidgetBorder(
result.left = 7;
break;
case StyleAppearance::FocusOutline:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
result.top = 5;
@ -223,7 +222,6 @@ HeadlessThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
aResult->width = 14;
aResult->height = 26;
break;
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
aResult->width = 0;
@ -369,7 +367,6 @@ HeadlessThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistText:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::ScaleHorizontal:
case StyleAppearance::ScaleVertical:
case StyleAppearance::ScalethumbHorizontal:

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

@ -651,7 +651,6 @@ nsNativeBasicTheme::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
case StyleAppearance::Listbox:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
PaintMenulist(dt, devPxRect, eventState, dpi);
break;
case StyleAppearance::MozMenulistArrowButton:
@ -722,8 +721,7 @@ LayoutDeviceIntMargin nsNativeBasicTheme::GetWidgetBorder(
}
case StyleAppearance::Listbox:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield: {
case StyleAppearance::MenulistButton: {
const LayoutDeviceIntCoord w = kMenulistBorderWidth * dpi;
return LayoutDeviceIntMargin(w, w, w, w);
}
@ -768,7 +766,6 @@ bool nsNativeBasicTheme::GetWidgetPadding(nsDeviceContext* aContext,
case StyleAppearance::Listbox:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
aResult->SizeTo(6 * dpi, 7 * dpi, 6 * dpi, 7 * dpi);
return true;
@ -887,7 +884,6 @@ bool nsNativeBasicTheme::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Listbox:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::MozMenulistArrowButton:
case StyleAppearance::SpinnerUpbutton:

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

@ -264,7 +264,6 @@ bool nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext,
return (aAppearance == StyleAppearance::NumberInput ||
aAppearance == StyleAppearance::Button ||
aAppearance == StyleAppearance::MenulistTextfield ||
aAppearance == StyleAppearance::Textfield ||
aAppearance == StyleAppearance::Textarea ||
aAppearance == StyleAppearance::Listbox ||

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

@ -131,13 +131,6 @@ static MARGINS GetCheckboxMargins(HANDLE theme, HDC hdc) {
return checkboxContent;
}
static COLORREF GetTextfieldFillColor(HANDLE theme, int32_t part,
int32_t state) {
COLORREF color = {0};
GetThemeColor(theme, part, state, TMT_FILLCOLOR, &color);
return color;
}
static SIZE GetCheckboxBGSize(HANDLE theme, HDC hdc) {
SIZE checkboxSize;
GetThemePartSize(theme, hdc, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, nullptr,
@ -690,7 +683,6 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
case StyleAppearance::Checkbox:
case StyleAppearance::Groupbox:
return Some(eUXButton);
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
@ -754,7 +746,6 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
case StyleAppearance::Treeheadersortarrow:
return Some(eUXHeader);
case StyleAppearance::Listbox:
case StyleAppearance::Listitem:
case StyleAppearance::Treeview:
case StyleAppearance::Treetwistyopen:
case StyleAppearance::Treeitem:
@ -907,7 +898,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
// same as GBS_NORMAL don't bother supporting GBS_DISABLED.
return NS_OK;
}
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea: {
@ -1833,22 +1823,10 @@ RENDER_AGAIN:
aAppearance == StyleAppearance::MozMenulistArrowButton) {
DrawThemeBGRTLAware(theme, hdc, part, state, &widgetRect, &clipRect,
IsFrameRTL(aFrame));
} else if (aAppearance == StyleAppearance::MenulistTextfield ||
aAppearance == StyleAppearance::NumberInput ||
} else if (aAppearance == StyleAppearance::NumberInput ||
aAppearance == StyleAppearance::Textfield ||
aAppearance == StyleAppearance::Textarea) {
if (aAppearance == StyleAppearance::MenulistTextfield &&
state != TFS_EDITBORDER_FOCUSED) {
// We want 'menulist-textfield' to behave like 'textfield', except we
// don't want a border unless it's focused. We have to handle the
// non-focused case manually here.
COLORREF color = GetTextfieldFillColor(theme, part, state);
HBRUSH brush = CreateSolidBrush(color);
::FillRect(hdc, &widgetRect, brush);
DeleteObject(brush);
} else {
DrawThemeBackground(theme, hdc, part, state, &widgetRect, &clipRect);
}
DrawThemeBackground(theme, hdc, part, state, &widgetRect, &clipRect);
if (state == TFS_EDITBORDER_DISABLED) {
InflateRect(&widgetRect, -1, -1);
@ -2032,8 +2010,7 @@ LayoutDeviceIntMargin nsNativeThemeWin::GetWidgetBorder(
result.left = 0;
}
if (aFrame && (aAppearance == StyleAppearance::MenulistTextfield ||
aAppearance == StyleAppearance::NumberInput ||
if (aFrame && (aAppearance == StyleAppearance::NumberInput ||
aAppearance == StyleAppearance::Textfield ||
aAppearance == StyleAppearance::Textarea)) {
nsIContent* content = aFrame->GetContent();
@ -2125,8 +2102,7 @@ bool nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
return ok;
}
if (aAppearance == StyleAppearance::MenulistTextfield ||
aAppearance == StyleAppearance::NumberInput ||
if (aAppearance == StyleAppearance::NumberInput ||
aAppearance == StyleAppearance::Textfield ||
aAppearance == StyleAppearance::Textarea ||
aAppearance == StyleAppearance::MenulistButton ||
@ -2144,8 +2120,7 @@ bool nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
* Instead, we add 2px padding for the contents and fix this. (Used to be 1px
* added, see bug 430212)
*/
if (aAppearance == StyleAppearance::MenulistTextfield ||
aAppearance == StyleAppearance::NumberInput ||
if (aAppearance == StyleAppearance::NumberInput ||
aAppearance == StyleAppearance::Textfield ||
aAppearance == StyleAppearance::Textarea) {
aResult->top = aResult->bottom = 2;
@ -2279,7 +2254,6 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext,
switch (aAppearance) {
case StyleAppearance::Groupbox:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Toolbox:
@ -2617,7 +2591,6 @@ bool nsNativeThemeWin::ThemeDrawsFocusForWidget(StyleAppearance aAppearance) {
switch (aAppearance) {
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::Textarea:
case StyleAppearance::Textfield:
case StyleAppearance::NumberInput:
@ -2775,7 +2748,6 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
case StyleAppearance::ScalethumbVertical:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::MozMenulistArrowButton:
case StyleAppearance::InnerSpinButton:
case StyleAppearance::SpinnerUpbutton:
@ -2833,7 +2805,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
case StyleAppearance::Treeview:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::Tab:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
@ -2995,7 +2966,6 @@ nsresult nsNativeThemeWin::ClassicGetMinimumWidgetSize(
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::Statusbar:
case StyleAppearance::Statusbarpanel:
case StyleAppearance::Resizerpanel:
@ -3242,7 +3212,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
case StyleAppearance::Textarea:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
case StyleAppearance::Range:
case StyleAppearance::RangeThumb:
case StyleAppearance::ScrollbarthumbVertical:
@ -3660,13 +3629,9 @@ RENDER_AGAIN:
case StyleAppearance::Textarea:
case StyleAppearance::Listbox:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield: {
// Paint the border, except for 'menulist-textfield' that isn't focused:
if (aAppearance != StyleAppearance::MenulistTextfield || focused) {
// Draw inset edge
::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
}
case StyleAppearance::MenulistButton: {
// Draw inset edge
::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
EventStates eventState = GetContentState(aFrame, aAppearance);
@ -4019,7 +3984,6 @@ uint32_t nsNativeThemeWin::GetWidgetNativeDrawingFlags(
case StyleAppearance::Textarea:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MenulistTextfield:
return gfxWindowsNativeDrawing::CANNOT_DRAW_TO_COLOR_ALPHA |
gfxWindowsNativeDrawing::CAN_AXIS_ALIGNED_SCALE |
gfxWindowsNativeDrawing::CANNOT_COMPLEX_TRANSFORM;