mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Add comments for shorthand alias property logic
This commit is contained in:
parent
e1053f2c71
commit
936fa7c90b
1 changed files with 7 additions and 0 deletions
|
@ -1263,6 +1263,9 @@ impl ToCss for PropertyDeclaration {
|
|||
PropertyDeclaration::WithVariables(_, ref with_variables) => {
|
||||
// https://drafts.csswg.org/css-variables/#variables-in-shorthands
|
||||
match with_variables.from_shorthand {
|
||||
// Normally, we shouldn't be printing variables here if they came from
|
||||
// shorthands. But we should allow properties that came from shorthand
|
||||
// aliases. That also matches with the Gecko behavior.
|
||||
Some(shorthand) if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) =>
|
||||
dest.write_str(&*with_variables.css)?,
|
||||
None => dest.write_str(&*with_variables.css)?,
|
||||
|
@ -1345,6 +1348,10 @@ impl PropertyDeclaration {
|
|||
Some(&*with_variables.css)
|
||||
} else { None }
|
||||
} else {
|
||||
// Normally, longhand property that doesn't come from a shorthand
|
||||
// should return None here. But we return Some to longhands if they
|
||||
// came from a shorthand alias. Because for example, we should be able to
|
||||
// get -moz-transform's value from transform.
|
||||
if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) {
|
||||
return Some(&*with_variables.css);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue