diff --git a/components/style/properties/cascade.rs b/components/style/properties/cascade.rs index 275ed7afc38..9c3e6ebd85e 100644 --- a/components/style/properties/cascade.rs +++ b/components/style/properties/cascade.rs @@ -416,6 +416,10 @@ fn tweak_when_ignoring_colors( // A few special-cases ahead. match **declaration { PropertyDeclaration::BackgroundColor(ref color) => { + // We honor system colors. + if color.is_system() { + return; + } // For background-color, we revert or initial-with-preserved-alpha // otherwise, this is needed to preserve semi-transparent // backgrounds. @@ -433,7 +437,10 @@ fn tweak_when_ignoring_colors( } }, PropertyDeclaration::Color(ref color) => { - // We honor color: transparent, and "revert-or-initial" otherwise. + // We honor color: transparent and system colors. + if color.0.is_system() { + return; + } if alpha_channel(&color.0, context) == 0 { return; } diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index 486d22fa101..c70d69e01b8 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -561,6 +561,11 @@ fn parse_hash_color(value: &[u8]) -> Result { } impl Color { + /// Returns whether this color is a system color. + pub fn is_system(&self) -> bool { + matches!(self, Color::System(..)) + } + /// Returns currentcolor value. #[inline] pub fn currentcolor() -> Color {