Bug 1250704 - use style from WidgetStyleCache for tooltip colors. r=stransky draft
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 07 Jun 2016 16:11:51 +1200
changeset 376932 4525fe7b22dc91afff9d90cf623a2418d21ddde3
parent 376931 6170a565cd031a243ed711da196f9f8f6576c275
child 376933 1096f104f171f376ce16348f3f0887ded13bf02d
push id20721
push userktomlinson@mozilla.com
push dateThu, 09 Jun 2016 08:18:57 +0000
reviewersstransky
bugs1250704
milestone50.0a1
Bug 1250704 - use style from WidgetStyleCache for tooltip colors. r=stransky 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);