diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 905816f0b77..423a79be5dc 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -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); }