Bug 1250704 - use style from WidgetStyleCache for tooltip colors. r=stransky
MozReview-Commit-ID: 9xzL8ckxTRQ
--- 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);