mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Respect system colors in the color and background-color properties
The reason why this doesn't work is because these styles come from datetimebox.css, which is really an author style. We could special-case these elements, but the approach that the CSSWG resolved on for the new forced-colors spec is to respect system colors specified by authors, see: https://drafts.csswg.org/css-color-adjust-1/#forced-colors-properties So this moves us towards that, and fixes the issue nicely. Differential Revision: https://phabricator.services.mozilla.com/D108321
This commit is contained in:
parent
ed19da405f
commit
b0a1eaebaa
2 changed files with 13 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue