style: When resetting background color for high contrast, preserve alpha channel appropriately.

But discard it when backplating behind text, so that text is readable.

This should be uncontroversial... Dealing with widgets is a bit harder
so TBD.

Differential Revision: https://phabricator.services.mozilla.com/D91779
This commit is contained in:
Emilio Cobos Álvarez 2020-09-29 22:04:56 +00:00
parent 1a5f48ba43
commit 379fb984f1
2 changed files with 40 additions and 15 deletions

View file

@ -529,15 +529,6 @@ impl Color {
parse_hash_color(&serialization)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError))
}
/// Returns true if the color is completely transparent, and false
/// otherwise.
pub fn is_transparent(&self) -> bool {
match *self {
Color::Numeric { ref parsed, .. } => parsed.alpha == 0,
_ => false,
}
}
}
#[cfg(feature = "gecko")]