diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css index ac4a5cdcebcf..b8a0bd56e376 100644 --- a/browser/themes/linux/browser.css +++ b/browser/themes/linux/browser.css @@ -638,10 +638,11 @@ notification[value="translation"] menulist > .menulist-dropmarker { /* We draw to titlebar when Gkt+ CSD is available */ @media (-moz-gtk-csd-available) { /* Some Gtk+ themes use non-rectangular toplevel windows. To fully support - * such themes we need to make toplevel window transparent with ARGB visual. - * It may cause performanance issue so let's put it under a preference - * and allow distros to enable it per default theme. */ - @supports -moz-bool-pref("mozilla.widget.use-argb-visuals") { + * such themes we need to make toplevel window transparent. + * It may cause performanance issues so let's put it under a preference + * and enable it for desktop environment which do that by default. + * See nsWindow::TopLevelWindowUseARGBVisual() for details. */ + @media (-moz-gtk-csd-transparent-background) { :root[tabsintitlebar]:not(:-moz-lwtheme) { background-color: transparent; -moz-appearance: none; diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 4459faf0689a..c21bd165046c 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -399,6 +399,12 @@ nsMediaFeatures::InitSystemMetrics() sSystemMetrics->AppendElement(nsGkAtoms::_moz_gtk_csd_available); } + rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDTransparentBackground, + &metricResult); + if (NS_SUCCEEDED(rv) && metricResult) { + sSystemMetrics->AppendElement(nsGkAtoms::_moz_gtk_csd_transparent_background); + } + rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDMinimizeButton, &metricResult); if (NS_SUCCEEDED(rv) && metricResult) { diff --git a/layout/style/test/chrome/bug418986-2.js b/layout/style/test/chrome/bug418986-2.js index 532a84823804..543012079d22 100644 --- a/layout/style/test/chrome/bug418986-2.js +++ b/layout/style/test/chrome/bug418986-2.js @@ -54,6 +54,7 @@ var suppressed_toggles = [ "-moz-windows-default-theme", "-moz-windows-glass", "-moz-gtk-csd-available", + "-moz-gtk-csd-transparent-background", "-moz-gtk-csd-minimize-button", "-moz-gtk-csd-maximize-button", "-moz-gtk-csd-close-button", diff --git a/layout/style/test/test_media_queries.html b/layout/style/test/test_media_queries.html index d6dd73cc13e9..7ca5c4c7782a 100644 --- a/layout/style/test/test_media_queries.html +++ b/layout/style/test/test_media_queries.html @@ -694,6 +694,7 @@ function run() { expression_should_not_be_parseable("-moz-windows-glass"); expression_should_not_be_parseable("-moz-swipe-animation-enabled"); expression_should_not_be_parseable("-moz-gtk-csd-available"); + expression_should_not_be_parseable("-moz-gtk-csd-transparent-background"); expression_should_not_be_parseable("-moz-gtk-csd-minimize-button"); expression_should_not_be_parseable("-moz-gtk-csd-maximize-button"); expression_should_not_be_parseable("-moz-gtk-csd-close-button"); @@ -714,6 +715,7 @@ function run() { expression_should_not_be_parseable("-moz-windows-glass: 0"); expression_should_not_be_parseable("-moz-swipe-animation-enabled: 0"); expression_should_not_be_parseable("-moz-gtk-csd-available: 0"); + expression_should_not_be_parseable("-moz-gtk-csd-transparent-background: 0"); expression_should_not_be_parseable("-moz-gtk-csd-minimize-button: 0"); expression_should_not_be_parseable("-moz-gtk-csd-maximize-button: 0"); expression_should_not_be_parseable("-moz-gtk-csd-close-button: 0"); @@ -734,6 +736,7 @@ function run() { expression_should_not_be_parseable("-moz-windows-glass: 1"); expression_should_not_be_parseable("-moz-swipe-animation-enabled: 1"); expression_should_not_be_parseable("-moz-gtk-csd-available: 1"); + expression_should_not_be_parseable("-moz-gtk-csd-transparent-background: 1"); expression_should_not_be_parseable("-moz-gtk-csd-minimize-button: 1"); expression_should_not_be_parseable("-moz-gtk-csd-maximize-button: 1"); expression_should_not_be_parseable("-moz-gtk-csd-close-button: 1"); @@ -755,6 +758,7 @@ function run() { expression_should_not_be_parseable("-moz-touch-enabled: -1"); expression_should_not_be_parseable("-moz-swipe-animation-enabled: -1"); expression_should_not_be_parseable("-moz-gtk-csd-available: -1"); + expression_should_not_be_parseable("-moz-gtk-csd-transparent-background: -1"); expression_should_not_be_parseable("-moz-gtk-csd-minimize-button: -1"); expression_should_not_be_parseable("-moz-gtk-csd-maximize-button: -1"); expression_should_not_be_parseable("-moz-gtk-csd-close-button: -1"); @@ -775,6 +779,7 @@ function run() { expression_should_not_be_parseable("-moz-touch-enabled: true"); expression_should_not_be_parseable("-moz-swipe-animation-enabled: true"); expression_should_not_be_parseable("-moz-gtk-csd-available: true"); + expression_should_not_be_parseable("-moz-gtk-csd-transparent-background: true"); expression_should_not_be_parseable("-moz-gtk-csd-minimize-button: true"); expression_should_not_be_parseable("-moz-gtk-csd-maximize-button: true"); expression_should_not_be_parseable("-moz-gtk-csd-close-button: true"); diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index 5c744f24220e..9e84a7722b10 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -479,7 +479,7 @@ lazy_static! { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. - pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 47] = [ + pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 48] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -660,6 +660,7 @@ lazy_static! { system_metric_feature!(atom!("-moz-menubar-drag")), system_metric_feature!(atom!("-moz-swipe-animation-enabled")), system_metric_feature!(atom!("-moz-gtk-csd-available")), + system_metric_feature!(atom!("-moz-gtk-csd-transparent-background")), system_metric_feature!(atom!("-moz-gtk-csd-minimize-button")), system_metric_feature!(atom!("-moz-gtk-csd-maximize-button")), system_metric_feature!(atom!("-moz-gtk-csd-close-button")), diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h index 8dc2a3a4f0b7..42cc0b6bb1f7 100644 --- a/widget/LookAndFeel.h +++ b/widget/LookAndFeel.h @@ -417,6 +417,12 @@ public: */ eIntID_GTKCSDAvailable, + /* + * A boolean value indicating whether client-side decorations should + * have transparent background. + */ + eIntID_GTKCSDTransparentBackground, + /* * A boolean value indicating whether client-side decorations should * contain a minimize button. diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp index 45d05fc06c00..863cde273482 100644 --- a/widget/gtk/nsLookAndFeel.cpp +++ b/widget/gtk/nsLookAndFeel.cpp @@ -727,6 +727,9 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) EnsureInit(); aResult = mCSDCloseButton; break; + case eIntID_GTKCSDTransparentBackground: + aResult = nsWindow::TopLevelWindowUseARGBVisual(); + break; case eIntID_PrefersReducedMotion: { GtkSettings *settings; gboolean enableAnimations; diff --git a/widget/headless/HeadlessLookAndFeelGTK.cpp b/widget/headless/HeadlessLookAndFeelGTK.cpp index 67b4cfd8c11a..5559e72dea2f 100644 --- a/widget/headless/HeadlessLookAndFeelGTK.cpp +++ b/widget/headless/HeadlessLookAndFeelGTK.cpp @@ -280,6 +280,7 @@ HeadlessLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) aResult = 1; break; case eIntID_GTKCSDAvailable: + case eIntID_GTKCSDTransparentBackground: aResult = 0; break; case eIntID_GTKCSDMinimizeButton: diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp index a6a8cd7e40db..ee393ab0e024 100644 --- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -126,6 +126,9 @@ nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] = { "ui.GtkCSDAvailable", eIntID_GTKCSDAvailable, false, 0 }, + { "ui.GtkCSDTransparentBackground", + eIntID_GTKCSDTransparentBackground, + false, 0 }, { "ui.GtkCSDMinimizeButton", eIntID_GTKCSDMinimizeButton, false, 0 }, diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index 6987074ab271..c268ad5677d5 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -2022,6 +2022,7 @@ STATIC_ATOMS = [ Atom("_moz_is_resource_document", "-moz-is-resource-document"), Atom("_moz_swipe_animation_enabled", "-moz-swipe-animation-enabled"), Atom("_moz_gtk_csd_available", "-moz-gtk-csd-available"), + Atom("_moz_gtk_csd_transparent_background", "-moz-gtk-csd-transparent-background"), Atom("_moz_gtk_csd_minimize_button", "-moz-gtk-csd-minimize-button"), Atom("_moz_gtk_csd_maximize_button", "-moz-gtk-csd-maximize-button"), Atom("_moz_gtk_csd_close_button", "-moz-gtk-csd-close-button"),