bug 1287036 draw menuitem background even when not in hover r=stransky+263117

MozReview-Commit-ID: tuf5WXY0d4

--HG--
extra : rebase_source : 52c9afca0b35d867ebff6657140ca4ed94db01dc
This commit is contained in:
Karl Tomlinson 2016-07-21 12:49:31 +12:00
Родитель 75c41a7cee
Коммит 1d4e286029
1 изменённых файлов: 23 добавлений и 26 удалений

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

@ -1814,36 +1814,33 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
{ {
gint x, y, w, h; gint x, y, w, h;
if (state->inHover && !state->disabled) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); GtkStyleContext* style = ClaimStyleContext(widget, direction, state_flags);
GtkStyleContext* style =
ClaimStyleContext(widget, direction, state_flags);
bool pre_3_6 = gtk_check_version(3, 6, 0) != nullptr; bool pre_3_6 = gtk_check_version(3, 6, 0) != nullptr;
if (pre_3_6) { if (pre_3_6) {
// GTK+ 3.4 saves the style context and adds the menubar class to // GTK+ 3.4 saves the style context and adds the menubar class to
// menubar children, but does each of these only when drawing, not // menubar children, but does each of these only when drawing, not
// during layout. // during layout.
gtk_style_context_save(style); gtk_style_context_save(style);
if (widget == MOZ_GTK_MENUBARITEM) { if (widget == MOZ_GTK_MENUBARITEM) {
gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR); gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
}
} }
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);
if (pre_3_6) {
gtk_style_context_restore(style);
}
ReleaseStyleContext(style);
} }
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);
if (pre_3_6) {
gtk_style_context_restore(style);
}
ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS; return MOZ_GTK_SUCCESS;
} }