From 936fa7c90b0548d4bb4b9c2e4258516795771812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Tue, 9 May 2017 14:14:19 +0300 Subject: [PATCH] Add comments for shorthand alias property logic --- components/style/properties/properties.mako.rs | 7 +++++++ 1 file changed, 7 insertions(+) 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); }