Bug 1353147 - Allow Gtk+ theme override, r?karlt
Allow to override Gtk+ theme for content process when e10s is enabled.
MozReview-Commit-ID: 1Kd2jLpBavA
--- 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);