From 90b37cfa2168c6bf5bbaec823fd56e3db76b6437 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Sun, 4 Feb 2018 22:57:53 +0100 Subject: [PATCH] Use less type aliases from longhands in PropertyDeclaration This will help us reuse code between different variants in a later patch, to implement Clone by hand to optimise it. --- components/style/properties/properties.mako.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 49bb8eba408..487a1fbefd4 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1443,12 +1443,16 @@ impl PropertyId { #[derive(Clone, PartialEq)] pub enum PropertyDeclaration { % for property in data.longhands: - /// ${property.name} - % if property.boxed: - ${property.camel_case}(Box), - % else: - ${property.camel_case}(longhands::${property.ident}::SpecifiedValue), - % endif + /// ${property.name} + <% + if property.predefined_type and not property.is_vector: + ty = "::values::specified::{}".format(property.predefined_type) + else: + ty = "longhands::{}::SpecifiedValue".format(property.ident) + if property.boxed: + ty = "Box<{}>".format(ty) + %> + ${property.camel_case}(${ty}), % endfor /// A css-wide keyword. CSSWideKeyword(LonghandId, CSSWideKeyword),