bug 1197165 apply tooltip style class when creating window instead of when drawing r=acomminos
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 02 Mar 2016 18:04:00 +1300
changeset 322976 fe3b0ce3a5fe3d28313ecd225cd800e45c435a3b
parent 322975 8b9251fa3a326b32a98dd5eb65562885b7defca2
child 322977 1be1bac73a4fda04c8720571d856debad65b030f
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersacomminos
bugs1197165, 761870
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1197165 apply tooltip style class when creating window instead of when drawing r=acomminos This is consistent with gtktooltip.c. gtk_style_context_save() modifies the CSS node hierarchy causing this rule to incorrectly match: .tooltip * { background-color: transparent; } See also https://bugzilla.gnome.org/show_bug.cgi?id=761870#c2
widget/gtk/gtk3drawing.c
--- a/widget/gtk/gtk3drawing.c
+++ b/widget/gtk/gtk3drawing.c
@@ -504,16 +504,18 @@ ensure_toolbar_separator_widget()
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 ensure_tooltip_widget()
 {
     if (!gTooltipWidget) {
         gTooltipWidget = gtk_window_new(GTK_WINDOW_POPUP);
+        GtkStyleContext* style = gtk_widget_get_style_context(gTooltipWidget);
+        gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
         gtk_widget_realize(gTooltipWidget);
         moz_gtk_set_widget_name(gTooltipWidget);
     }
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 ensure_tab_widget()
@@ -1941,21 +1943,18 @@ moz_gtk_tooltip_paint(cairo_t *cr, GdkRe
                       GtkTextDirection direction)
 {
     GtkStyleContext* style;
 
     ensure_tooltip_widget();
     gtk_widget_set_direction(gTooltipWidget, direction);
 
     style = gtk_widget_get_style_context(gTooltipWidget);
-    gtk_style_context_save(style);
-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
     gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
     gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
-    gtk_style_context_restore(style);
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 moz_gtk_resizer_paint(cairo_t *cr, GdkRectangle* rect,
                       GtkWidgetState* state,
                       GtkTextDirection direction)
 {