Skip to content

Commit e71f311

Browse files
committed
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
1 parent 2901ec4 commit e71f311

File tree

1 file changed

+4
-5
lines changed
  • components/style/rule_tree

1 file changed

+4
-5
lines changed

components/style/rule_tree/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,6 @@ impl StrongRuleNode {
14581458
use crate::gecko_bindings::structs::NS_AUTHOR_SPECIFIED_PADDING;
14591459
use crate::properties::{CSSWideKeyword, LonghandId};
14601460
use crate::properties::{PropertyDeclaration, PropertyDeclarationId};
1461-
use crate::values::specified::Color;
14621461
use std::borrow::Cow;
14631462

14641463
// Reset properties:
@@ -1581,11 +1580,11 @@ impl StrongRuleNode {
15811580

15821581
if is_author {
15831582
if !author_colors_allowed {
1584-
// FIXME(emilio): this looks wrong, this should
1585-
// do: if color is not transparent, then return
1586-
// true, or something.
15871583
if let PropertyDeclaration::BackgroundColor(ref color) = *declaration {
1588-
return *color == Color::transparent();
1584+
if color.is_transparent() {
1585+
return true;
1586+
}
1587+
continue;
15891588
}
15901589
}
15911590
return true;

0 commit comments

Comments
 (0)