Bug 1791455 - Honor currentColor in HCM. r=morgan

I think it's fair to honor it, just like we honor system color keywords.

By definition if we're forcing colors currentColor can only be forced or
a system color.

Differential Revision: https://phabricator.services.mozilla.com/D157675
This commit is contained in:
Emilio Cobos Álvarez 2022-09-20 17:52:34 +00:00
parent 00e15b9118
commit 66d4c80ac5
4 changed files with 22 additions and 2 deletions

View File

@ -0,0 +1,9 @@
<!doctype html>
<style>
div {
width: 50px;
height: 50px;
border: 1px solid SelectedItem;
}
</style>
<div></div>

View File

@ -0,0 +1,10 @@
<!doctype html>
<style>
div {
width: 50px;
height: 50px;
border: 1px solid currentColor;
color: SelectedItem;
}
</style>
<div></div>

View File

@ -93,6 +93,7 @@ pref(browser.display.use_system_colors,true) pref(browser.display.document_color
!= border-color-transparent.html about:blank
== border-color-transparent.html border-color-transparent-ref.html
== currentColor.html currentColor-ref.html
pref(layout.css.color-mix.enabled,true) != color-mix.html color-mix-notref.html

View File

@ -514,8 +514,8 @@ impl Color {
/// Returns whether this color is allowed in forced-colors mode.
pub fn honored_in_forced_colors_mode(&self, allow_transparent: bool) -> bool {
match *self {
Color::InheritFromBodyQuirk | Color::CurrentColor => false,
Color::System(..) => true,
Color::InheritFromBodyQuirk => false,
Color::CurrentColor | Color::System(..) => true,
Color::Numeric { ref parsed, .. } => allow_transparent && parsed.alpha == 0,
Color::ColorMix(ref mix) => {
mix.left.honored_in_forced_colors_mode(allow_transparent) &&