Bug 1427999 - Use GetToolbarButtonMetrics() to get correct titlebar button size at nsNativeThemeGTK::GetMinimumWidgetSize, r=jhorak

MozReview-Commit-ID: HfPUk30LaJn

--HG--
extra : rebase_source : ef406e78e686a6ae190a0fbdb9aa945e40503ac6
This commit is contained in:
Martin Stransky 2018-01-22 12:09:09 +01:00
Родитель e77fe4bfe2
Коммит 0594ae2db5
2 изменённых файлов: 18 добавлений и 4 удалений

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

@ -555,6 +555,14 @@ CreateHeaderBar(WidgetNodeType aWidgetType)
// Emulate what create_titlebar() at gtkwindow.c does.
GtkStyleContext* style = gtk_widget_get_style_context(headerbar);
gtk_style_context_add_class(style, "titlebar");
// TODO: Define default-decoration titlebar style as workaround
// to ensure the titlebar buttons does not overflow outside.
// Recently the titlebar size is calculated as
// tab size + titlebar border/padding (default-decoration has 6px padding
// at default Adwaita theme).
// We need to fix titlebar size calculation to also include
// titlebar button sizes. (Bug 1419442)
gtk_style_context_add_class(style, "default-decoration");
return headerbar;

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

@ -1575,6 +1575,16 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
*aIsOverridable = false;
}
break;
case NS_THEME_WINDOW_BUTTON_CLOSE:
case NS_THEME_WINDOW_BUTTON_MINIMIZE:
case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
case NS_THEME_WINDOW_BUTTON_RESTORE:
{
const ToolbarButtonGTKMetrics* metrics = GetToolbarButtonMetrics();
aResult->width = metrics->minSizeWithBorderMargin.width;
aResult->height = metrics->minSizeWithBorderMargin.height;
break;
}
case NS_THEME_CHECKBOX_CONTAINER:
case NS_THEME_RADIO_CONTAINER:
case NS_THEME_CHECKBOX_LABEL:
@ -1583,10 +1593,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
case NS_THEME_MENULIST:
case NS_THEME_TOOLBARBUTTON:
case NS_THEME_TREEHEADERCELL:
case NS_THEME_WINDOW_BUTTON_CLOSE:
case NS_THEME_WINDOW_BUTTON_MINIMIZE:
case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
case NS_THEME_WINDOW_BUTTON_RESTORE:
{
if (aWidgetType == NS_THEME_MENULIST) {
// Include the arrow size.