Bug 1498356 - Move border and padding from -moz-window-titlebar* to -moz-window-button-box on GTK backend, r=dao

This is based on patch by Mike Conley (:mconley)

The left/right toolbox placement can be adjusted later as we know at toolkit level where the buttons are
so we can set border/padding accordingly.

Depends on D8529

Differential Revision: https://phabricator.services.mozilla.com/D8549

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2018-10-12 16:16:50 +00:00
parent 6a1af65492
commit 53bbcc32fb
3 changed files with 14 additions and 0 deletions

View File

@ -2571,6 +2571,13 @@ moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
return MOZ_GTK_SUCCESS;
}
case MOZ_GTK_HEADER_BAR_BUTTON_BOX:
{
style = GetStyleContext(MOZ_GTK_HEADER_BAR);
moz_gtk_add_border_padding(style, left, top, right, bottom);
*top = *bottom = 0;
return MOZ_GTK_SUCCESS;
}
/* These widgets have no borders, since they are not containers. */
case MOZ_GTK_CHECKBUTTON_LABEL:
case MOZ_GTK_RADIOBUTTON_LABEL:

View File

@ -327,6 +327,8 @@ typedef enum {
MOZ_GTK_HEADER_BAR,
/* Paints a GtkHeaderBar in maximized state */
MOZ_GTK_HEADER_BAR_MAXIMIZED,
/* Container for GtkHeaderBar buttons */
MOZ_GTK_HEADER_BAR_BUTTON_BOX,
/* Paints GtkHeaderBar title buttons.
* Keep the order here as MOZ_GTK_HEADER_BAR_BUTTON_* are processed
* as an array from MOZ_GTK_HEADER_BAR_BUTTON_CLOSE to the last one.

View File

@ -800,6 +800,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aWidgetType, nsIFrame* aF
case StyleAppearance::MozWindowTitlebarMaximized:
aGtkWidgetType = MOZ_GTK_HEADER_BAR_MAXIMIZED;
break;
case StyleAppearance::MozWindowButtonBox:
aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_BOX;
break;
case StyleAppearance::MozWindowButtonClose:
aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_CLOSE;
break;
@ -1435,6 +1438,7 @@ nsNativeThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
switch (aWidgetType) {
case StyleAppearance::ButtonFocus:
case StyleAppearance::Toolbarbutton:
case StyleAppearance::MozWindowButtonBox:
case StyleAppearance::MozWindowButtonClose:
case StyleAppearance::MozWindowButtonMinimize:
case StyleAppearance::MozWindowButtonMaximize:
@ -2016,6 +2020,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
#endif
return !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
case StyleAppearance::MozWindowButtonBox:
case StyleAppearance::MozWindowButtonClose:
case StyleAppearance::MozWindowButtonMinimize:
case StyleAppearance::MozWindowButtonMaximize: