Bug 1353147 - Allow Gtk+ theme override, r?karlt draft
authorMartin Stransky <stransky@redhat.com>
Tue, 04 Apr 2017 22:30:12 +0200
changeset 555764 8a5edf751a0217aa91d6b2e7bac3f10b7ba9d1fc
parent 555310 b5d8b27a753725c1de41ffae2e338798f3b5cacd
child 622697 0952871477f782bddc8a7dccb9a74966624bb0e2
push id52335
push userstransky@redhat.com
push dateTue, 04 Apr 2017 20:30:56 +0000
reviewerskarlt
bugs1353147
milestone55.0a1
Bug 1353147 - Allow Gtk+ theme override, r?karlt Allow to override Gtk+ theme for content process when e10s is enabled. MozReview-Commit-ID: 1Kd2jLpBavA
widget/gtk/nsLookAndFeel.cpp
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -1166,16 +1166,26 @@ nsLookAndFeel::EnsureInit()
                 mozilla::Preferences::GetBool("widget.chrome.allow-gtk-dark-theme",
                                               false);
         }
         if (!allowDarkTheme) {
             g_object_set(settings, dark_setting, FALSE, nullptr);
         }
     }
 
+    // Allow content Gtk theme override by pref, it's useful when styled Gtk+
+    // widgets break web content.
+    if (XRE_IsContentProcess()) {
+        auto contentThemeName =
+            mozilla::Preferences::GetCString("widget.content.gtk-theme-override");
+        if (!contentThemeName.IsEmpty()) {
+            g_object_set(settings, "gtk-theme-name", contentThemeName.get(), nullptr);
+        }
+    }
+
     // Scrollbar colors
     style = ClaimStyleContext(MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL);
     gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
     ReleaseStyleContext(style);
 
     // Window colors
     style = ClaimStyleContext(MOZ_GTK_WINDOW);