style: Only override to default color in high-contrast / forced-colors mode if inheriting from transparent.

That way elements inside links, form controls, etc have the right
contrast, even if the page overrides the color.

We can't do it when inheriting from transparent because we've already
forgotten about the "right" color to inherit, so the default color makes
sense. But that is a pretty unlikely edge case.

Differential Revision: https://phabricator.services.mozilla.com/D73069
This commit is contained in:
Emilio Cobos Álvarez 2020-04-30 00:09:19 +00:00
parent 6f58c66589
commit c67c9fdcee

View file

@ -384,10 +384,15 @@ fn tweak_when_ignoring_colors(
if color.0.is_transparent() {
return;
}
let color = builder.device.default_color();
declarations_to_apply_unless_overriden.push(
PropertyDeclaration::Color(specified::ColorPropertyValue(color.into()))
)
// If the inherited color would be transparent, but we would
// override this with a non-transparent color, then override it with
// the default color. Otherwise just let it inherit through.
if builder.get_parent_inherited_text().clone_color().alpha == 0 {
let color = builder.device.default_color();
declarations_to_apply_unless_overriden.push(
PropertyDeclaration::Color(specified::ColorPropertyValue(color.into()))
)
}
},
// We honor url background-images if backplating.
#[cfg(feature = "gecko")]