mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
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:
parent
6f58c66589
commit
c67c9fdcee
1 changed files with 9 additions and 4 deletions
|
@ -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")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue