Bug 1272332 - Allow dark gtk theme with environment variable. r=karlt, a=gchang
authorBenjamin Neff <mozilla@benjaminneff.ch>
Fri, 05 Aug 2016 15:21:00 +0200
changeset 340443 ffbb44b8911389d1e1e0d6760da7456bb281a0dd
parent 340442 dcdb0d847056e6c461801e6c5cbd833139462f3a
child 340444 6b74a4734d1659dad98b792b1c8fca713ea1b2f3
push id6337
push userryanvm@gmail.com
push dateThu, 25 Aug 2016 03:33:50 +0000
treeherdermozilla-beta@901d8d3d4597 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, gchang
bugs1272332
milestone49.0
Bug 1272332 - Allow dark gtk theme with environment variable. r=karlt, a=gchang
widget/gtk/nsLookAndFeel.cpp
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -27,16 +27,17 @@
 
 #include <dlfcn.h>
 
 #include "mozilla/gfx/2D.h"
 
 #if MOZ_WIDGET_GTK != 2
 #include <cairo-gobject.h>
 #include "WidgetStyleCache.h"
+#include "prenv.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), \
@@ -1101,17 +1102,17 @@ nsLookAndFeel::Init()
     // Disable dark theme because it interacts poorly with widget styling in
     // web content (see bug 1216658).
     // To avoid triggering reload of theme settings unnecessarily, only set the
     // setting when necessary.
     const gchar* dark_setting = "gtk-application-prefer-dark-theme";
     gboolean dark;
     g_object_get(settings, dark_setting, &dark, nullptr);
 
-    if (dark) {
+    if (dark && !PR_GetEnv("MOZ_ALLOW_GTK_DARK_THEME")) {
         g_object_set(settings, dark_setting, FALSE, nullptr);
     }
 
     GtkWidgetPath *path = gtk_widget_path_new();
     gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
 
     mBackgroundStyle = create_context(path);
     gtk_style_context_add_class(mBackgroundStyle, GTK_STYLE_CLASS_BACKGROUND);