diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-11-05 00:16:58 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-11-05 12:32:15 +0100 |
commit | d035d02517f37573e52260bf7870b1932ddecc5c (patch) | |
tree | edb9338625fa8df2a87f4469e436fcbc5cc7b59b /components/style/rule_tree/mod.rs | |
parent | 33fed655978824c29dd4dcc4424b3148c3b2d26d (diff) | |
download | servo-d035d02517f37573e52260bf7870b1932ddecc5c.tar.gz servo-d035d02517f37573e52260bf7870b1932ddecc5c.zip |
style: Don't keep a separate list of ignored-when-colors-disabled longhands.
Most of the change is moving sets around to be static functions on
LonghandIdSet. I think I like that pattern, but I can also make the new set a
global static and add mako code to be `pub` or something.
Though I think the LonghandIdSet::foo().contains(..) pattern is nice to read :)
Differential Revision: https://phabricator.services.mozilla.com/D10653
Diffstat (limited to 'components/style/rule_tree/mod.rs')
-rw-r--r-- | components/style/rule_tree/mod.rs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 7277afd4d9f..59c06e58923 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -1288,25 +1288,12 @@ impl StrongRuleNode { } } - // If author colors are not allowed, only claim to have author-specified - // rules if we're looking at a non-color property, a border image, or if - // we're looking at the background color and it's set to transparent. - const IGNORED_WHEN_COLORS_DISABLED: &'static [LonghandId] = &[ - LonghandId::BackgroundImage, - LonghandId::BorderImageSource, - LonghandId::BorderTopColor, - LonghandId::BorderRightColor, - LonghandId::BorderBottomColor, - LonghandId::BorderLeftColor, - LonghandId::BorderInlineStartColor, - LonghandId::BorderInlineEndColor, - LonghandId::BorderBlockStartColor, - LonghandId::BorderBlockEndColor, - ]; - + // If author colors are not allowed, don't look at those properties + // (except for background-color which is special and we handle below). if !author_colors_allowed { - for id in IGNORED_WHEN_COLORS_DISABLED { - properties.remove(*id); + properties.remove_all(LonghandIdSet::ignored_when_colors_disabled()); + if rule_type_mask & NS_AUTHOR_SPECIFIED_BACKGROUND != 0 { + properties.insert(LonghandId::BackgroundColor); } } |