зеркало из https://github.com/mozilla/gecko-dev.git
bug 1272194 only add menubar class to menu items with GTK 3.4 r=stransky+263117
and save/restore context consistent with GTK 3.4. MozReview-Commit-ID: GdMoAmzOJlf --HG-- extra : rebase_source : c3cb854a304a0bc10cd27325b42361031a5107db
This commit is contained in:
Родитель
a7b88b8021
Коммит
6b738d9703
|
@ -2473,8 +2473,15 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
|
|||
}
|
||||
style = gtk_widget_get_style_context(item_widget);
|
||||
|
||||
if (widget == MOZ_GTK_MENUBARITEM) {
|
||||
gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
|
||||
bool pre_3_6 = gtk_check_version(3, 6, 0) != nullptr;
|
||||
if (pre_3_6) {
|
||||
// GTK+ 3.4 saves the style context and adds the menubar class to
|
||||
// menubar children, but does each of these only when drawing, not
|
||||
// during layout.
|
||||
gtk_style_context_save(style);
|
||||
if (widget == MOZ_GTK_MENUBARITEM) {
|
||||
gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_set_direction(item_widget, direction);
|
||||
|
@ -2490,8 +2497,8 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
|
|||
gtk_render_background(style, cr, x, y, w, h);
|
||||
gtk_render_frame(style, cr, x, y, w, h);
|
||||
|
||||
if (widget == MOZ_GTK_MENUBARITEM) {
|
||||
gtk_style_context_remove_class(style, GTK_STYLE_CLASS_MENUBAR);
|
||||
if (pre_3_6) {
|
||||
gtk_style_context_restore(style);
|
||||
}
|
||||
gtk_style_context_set_state(style, GTK_STATE_FLAG_NORMAL);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче