bug 1315668 remove use of gtk_container_get_border_width from menuitems r=stransky+263117

The GtkContainer border-width property defaults to zero.  It is not influenced
by theme CSS.  While theme engines can theoretically modify default values for
properties of any class, I don't think that is something that needs to be
supported.

Removing this code is necessary to switch from caching GtkWidgets to caching
GtkStyleContexts only.

MozReview-Commit-ID: IxgM8qjfK3a

--HG--
extra : rebase_source : c5c94c19227d7e7d31c4a094bb4fb68f094ddb50
This commit is contained in:
Karl Tomlinson 2016-11-14 16:13:50 +13:00
Родитель 6cd5db91d6
Коммит e8416905f1
1 изменённых файлов: 10 добавлений и 27 удалений

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

@ -1768,19 +1768,15 @@ moz_gtk_menu_separator_paint(cairo_t *cr, GdkRectangle* rect,
GtkStyleContext* style;
gboolean wide_separators;
gint separator_height;
guint border_width;
gint x, y, w;
GtkBorder padding;
border_width =
gtk_container_get_border_width(GTK_CONTAINER(
GetWidget(MOZ_GTK_MENUSEPARATOR)));
style = ClaimStyleContext(MOZ_GTK_MENUSEPARATOR, direction);
gtk_style_context_get_padding(style, GTK_STATE_FLAG_NORMAL, &padding);
x = rect->x + border_width;
y = rect->y + border_width;
w = rect->width - border_width * 2;
x = rect->x;
y = rect->y;
w = rect->width;
gtk_style_context_save(style);
gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
@ -1818,8 +1814,6 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
gint x, y, w, h;
if (state->inHover && !state->disabled) {
guint border_width =
gtk_container_get_border_width(GTK_CONTAINER(GetWidget(widget)));
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style =
ClaimStyleContext(widget, direction, state_flags);
@ -1835,10 +1829,10 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
}
}
x = rect->x + border_width;
y = rect->y + border_width;
w = rect->width - border_width * 2;
h = rect->height - border_width * 2;
x = rect->x;
y = rect->y;
w = rect->width;
h = rect->height;
gtk_render_background(style, cr, x, y, w, h);
gtk_render_frame(style, cr, x, y, w, h);
@ -1877,7 +1871,6 @@ moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style;
GtkBorder padding;
gint offset;
gint indicator_size, horizontal_padding;
gint x, y;
@ -1900,9 +1893,7 @@ moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
MOZ_GTK_CHECKMENUITEM,
direction, state_flags);
gtk_style_context_get_padding(style, state_flags, &padding);
offset = gtk_container_get_border_width(GTK_CONTAINER(
GetWidget(MOZ_GTK_CHECKMENUITEM_CONTAINER)));
offset += padding.left + 2;
gint offset = padding.left + 2;
if (direction == GTK_TEXT_DIR_RTL) {
x = rect->width - indicator_size - offset - horizontal_padding;
@ -2167,7 +2158,6 @@ moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
w = GetWidget(MOZ_GTK_CHECKMENUITEM_CONTAINER);
}
*left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
moz_gtk_add_style_padding(gtk_widget_get_style_context(w),
left, top, right, bottom);
return MOZ_GTK_SUCCESS;
@ -2444,14 +2434,7 @@ moz_gtk_get_menu_separator_height(gint *size)
gboolean wide_separators;
gint separator_height;
GtkBorder padding;
GtkStyleContext* style;
guint border_width;
border_width =
gtk_container_get_border_width(GTK_CONTAINER(
GetWidget(MOZ_GTK_MENUSEPARATOR)));
style = ClaimStyleContext(MOZ_GTK_MENUSEPARATOR);
GtkStyleContext* style = ClaimStyleContext(MOZ_GTK_MENUSEPARATOR);
gtk_style_context_get_padding(style, GTK_STATE_FLAG_NORMAL, &padding);
gtk_style_context_save(style);
@ -2465,7 +2448,7 @@ moz_gtk_get_menu_separator_height(gint *size)
gtk_style_context_restore(style);
ReleaseStyleContext(style);
*size = padding.top + padding.bottom + border_width*2;
*size = padding.top + padding.bottom;
*size += (wide_separators) ? separator_height : 1;
return MOZ_GTK_SUCCESS;