mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Fix two issues with themed widgets in high contrast mode.
There were two issues with the existing code that we use to determine whether a widget is styled or not. First, it was using `color == Color::transparent()` instead of `color.is_transparent()` to check for transparent backgrounds. That is not sound as `Color::transparent()` is the literal value `rgba(0, 0, 0, 0)`, not the `transparent` keyword, so the equality check would fail. The other issue is that this function was early-returning false if that check was returning false. It is a bug for this function to early-return false, as it makes the result of the function dependent of the order of the declarations. Differential Revision: https://phabricator.services.mozilla.com/D62060
This commit is contained in:
parent
5ed8fe8ee2
commit
6876fed6e0
1 changed files with 4 additions and 5 deletions
|
@ -1458,7 +1458,6 @@ impl StrongRuleNode {
|
|||
use crate::gecko_bindings::structs::NS_AUTHOR_SPECIFIED_PADDING;
|
||||
use crate::properties::{CSSWideKeyword, LonghandId};
|
||||
use crate::properties::{PropertyDeclaration, PropertyDeclarationId};
|
||||
use crate::values::specified::Color;
|
||||
use std::borrow::Cow;
|
||||
|
||||
// Reset properties:
|
||||
|
@ -1581,11 +1580,11 @@ impl StrongRuleNode {
|
|||
|
||||
if is_author {
|
||||
if !author_colors_allowed {
|
||||
// FIXME(emilio): this looks wrong, this should
|
||||
// do: if color is not transparent, then return
|
||||
// true, or something.
|
||||
if let PropertyDeclaration::BackgroundColor(ref color) = *declaration {
|
||||
return *color == Color::transparent();
|
||||
if color.is_transparent() {
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue