style: Add a declaration iterator to AllShorthand for simplify code.

Bug: 1461285
Reviewed-by: emilio
MozReview-Commit-ID: 9w2B3SpdkQo
This commit is contained in:
Xidorn Quan 2018-07-11 10:52:52 +10:00 committed by Emilio Cobos Álvarez
parent 36038869aa
commit 2be1375745
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 47 additions and 28 deletions

View file

@ -455,34 +455,9 @@ impl PropertyDeclarationBlock {
mode,
);
}
match drain.all_shorthand {
AllShorthand::NotSet => {}
AllShorthand::CSSWideKeyword(keyword) => {
for id in ShorthandId::All.longhands() {
let decl = PropertyDeclaration::CSSWideKeyword(
WideKeywordDeclaration { id, keyword },
);
changed |= self.push(
decl,
importance,
mode,
);
}
}
AllShorthand::WithVariables(unparsed) => {
for id in ShorthandId::All.longhands() {
let decl = PropertyDeclaration::WithVariables(
VariableDeclaration { id, value: unparsed.clone() },
);
changed |= self.push(
decl,
importance,
mode,
);
}
}
}
changed
drain.all_shorthand.declarations().fold(changed, |changed, decl| {
changed | self.push(decl, importance, mode)
})
}
/// Adds or overrides the declaration for a given property in this block.