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
This commit is contained in:
Emilio Cobos Álvarez 2018-11-05 00:16:58 +00:00
parent 33fed65597
commit d035d02517
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 56 additions and 36 deletions

View file

@ -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);
}
}