style: Honor background-color: transparent in forced colors mode

See comment as for why, and linked bugs, in particular:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1755713#c16

And the following screenshot for example.

Differential Revision: https://phabricator.services.mozilla.com/D141514
This commit is contained in:
Emilio Cobos Álvarez 2023-06-06 23:58:24 +02:00 committed by Oriol Brufau
parent eb96b29af0
commit 32dd0b27e4

View file

@ -428,17 +428,18 @@ fn tweak_when_ignoring_colors(
// otherwise, this is needed to preserve semi-transparent // otherwise, this is needed to preserve semi-transparent
// backgrounds. // backgrounds.
// //
// FIXME(emilio, bug 1666059): We revert for alpha == 0, but maybe // NOTE(emilio): We revert even for alpha == 0. Not doing so would
// should consider not doing that even if it causes some issues like // be a bit special casey, even though it causes issues like
// bug 1625036, or finding a performant way to preserve the original // bug 1625036. The reasoning is that the conditions that trigger
// widget background color's rgb channels but not alpha... // that (having mismatched widget and default backgrounds) are both
// uncommon, and broken in other applications as well, and not
// honoring transparent makes stuff uglier or break unconditionally
// (bug 1666059, bug 1755713).
let alpha = alpha_channel(color, context); let alpha = alpha_channel(color, context);
if alpha != 0 { let mut color = context.builder.device.default_background_color();
let mut color = context.builder.device.default_background_color(); color.alpha = alpha;
color.alpha = alpha; declarations_to_apply_unless_overriden
declarations_to_apply_unless_overriden .push(PropertyDeclaration::BackgroundColor(color.into()))
.push(PropertyDeclaration::BackgroundColor(color.into()))
}
}, },
PropertyDeclaration::Color(ref color) => { PropertyDeclaration::Color(ref color) => {
// We honor color: transparent and system colors. // We honor color: transparent and system colors.