diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-02-10 00:37:36 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-02-12 02:43:21 +0100 |
commit | 6876fed6e0238d3da2cfd4a022fcf75aa2225698 (patch) | |
tree | b214d4b64ed18a9f27e5c3c3b172c85673496801 /components/style/rule_tree/mod.rs | |
parent | 5ed8fe8ee2145702f2a9d7288caca95b03aed99a (diff) | |
download | servo-6876fed6e0238d3da2cfd4a022fcf75aa2225698.tar.gz servo-6876fed6e0238d3da2cfd4a022fcf75aa2225698.zip |
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
Diffstat (limited to 'components/style/rule_tree/mod.rs')
-rw-r--r-- | components/style/rule_tree/mod.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 1dbc17eaf34..8a36e2f20d2 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -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; |