Bug 1493145 - [CSD] Enable round corners by default by -moz-gtk-csd-transparent-background media query, r=dao

Replace mozilla.widget.use-argb-visuals pref by -moz-gtk-csd-transparent-background media query at browser.css
to draw transparent background. The media query is set by toolkit code and enabled when compatible
window manager is detected.

Differential Revision: https://phabricator.services.mozilla.com/D6658

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2018-09-25 11:53:04 +00:00
Родитель b83ae8cfed
Коммит 89822d9f40
10 изменённых файлов: 33 добавлений и 5 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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",

Просмотреть файл

@ -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");

Просмотреть файл

@ -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")),

Просмотреть файл

@ -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.

Просмотреть файл

@ -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;

Просмотреть файл

@ -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:

Просмотреть файл

@ -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 },

Просмотреть файл

@ -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"),