Bug 1272332 - Allow dark gtk theme with environment variable. r=karlt, a=ritu
authorBenjamin Neff <mozilla@benjaminneff.ch>
Fri, 05 Aug 2016 15:21:00 +0200
changeset 349792 e2be3bbce44a9f118a1cfe17961fad25f0ffe8dd
parent 349791 2bdd8158b05656d15e385246d06e18926cec13b0
child 349793 afbb4f8032dfef27c7af94b8dfd62e2858960f5e
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, ritu
bugs1272332
milestone50.0a2
Bug 1272332 - Allow dark gtk theme with environment variable. r=karlt, a=ritu
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);