Bug 1250704 - use style from WidgetStyleCache for tooltip colors. r=stransky, a=lizzard
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 07 Jun 2016 16:11:51 +1200
changeset 339757 5149c25f049838540ecacdd9385516f546ecb190
parent 339756 d0c7b813a3a1ccc68f5c6c782f14c1decebcd61c
child 339758 122279c7a10935cbc577bee8e5a1b9fab0cd0300
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky, lizzard
bugs1250704
milestone49.0a2
Bug 1250704 - use style from WidgetStyleCache for tooltip colors. r=stransky, a=lizzard MozReview-Commit-ID: 9xzL8ckxTRQ
widget/gtk/nsLookAndFeel.cpp
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -26,16 +26,17 @@
 #include "WidgetUtils.h"
 
 #include <dlfcn.h>
 
 #include "mozilla/gfx/2D.h"
 
 #if MOZ_WIDGET_GTK != 2
 #include <cairo-gobject.h>
+#include "WidgetStyleCache.h"
 #endif
 
 using mozilla::LookAndFeel;
 
 #define GDK_COLOR_TO_NS_RGB(c) \
     ((nscolor) NS_RGB(c.red>>8, c.green>>8, c.blue>>8))
 #define GDK_RGBA_TO_NS_RGBA(c) \
     ((nscolor) NS_RGBA((int)((c).red*255), (int)((c).green*255), \
@@ -1130,25 +1131,25 @@ nsLookAndFeel::Init()
     style = create_context(path);
     gtk_style_context_save(style);
     gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
     gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
     gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
     gtk_style_context_restore(style);
+    g_object_unref(style);
 
     // tooltip foreground and background
-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
+    style = ClaimStyleContext(MOZ_GTK_TOOLTIP);
     gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
     gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sInfoText = GDK_RGBA_TO_NS_RGBA(color);
-    g_object_unref(style);
+    ReleaseStyleContext(style);
 
     // menu foreground & menu background
     GtkWidget *accel_label = gtk_accel_label_new("M");
     GtkWidget *menuitem = gtk_menu_item_new();
     GtkWidget *menu = gtk_menu_new();
 
     g_object_ref_sink(menu);