diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index f3d6f9aa7c5..250e2ff6d74 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -407,7 +407,7 @@ impl AnimationValue { ) -> Option { use properties::LonghandId; - match *decl { + let animatable = match *decl { % for prop in data.longhands: % if prop.animatable: PropertyDeclaration::${prop.camel_case}(ref val) => { @@ -427,13 +427,13 @@ impl AnimationValue { % else: let computed = val.to_computed_value(context); % endif - Some(AnimationValue::${prop.camel_case}( + AnimationValue::${prop.camel_case}( % if prop.is_animatable_with_computed_value: computed % else: computed.to_animated_value() % endif - )) + ) }, % endif % endfor @@ -444,33 +444,32 @@ impl AnimationValue { % for prop in data.longhands: % if prop.animatable: LonghandId::${prop.camel_case} => { - let computed = match keyword { + let style_struct = match keyword { % if not prop.style_struct.inherited: CSSWideKeyword::Unset | % endif CSSWideKeyword::Initial => { - let initial_struct = initial.get_${prop.style_struct.name_lower}(); - initial_struct.clone_${prop.ident}() + initial.get_${prop.style_struct.name_lower}() }, % if prop.style_struct.inherited: CSSWideKeyword::Unset | % endif CSSWideKeyword::Inherit => { - let inherit_struct = context.builder - .get_parent_${prop.style_struct.name_lower}(); - inherit_struct.clone_${prop.ident}() + context.builder + .get_parent_${prop.style_struct.name_lower}() }, }; + let computed = style_struct.clone_${prop.ident}(); % if not prop.is_animatable_with_computed_value: let computed = computed.to_animated_value(); % endif - Some(AnimationValue::${prop.camel_case}(computed)) + AnimationValue::${prop.camel_case}(computed) }, % endif % endfor % for prop in data.longhands: % if not prop.animatable: - LonghandId::${prop.camel_case} => None, + LonghandId::${prop.camel_case} => return None, % endif % endfor } @@ -486,15 +485,16 @@ impl AnimationValue { context.quirks_mode ) }; - AnimationValue::from_declaration( + return AnimationValue::from_declaration( &substituted, context, extra_custom_properties, initial, ) }, - _ => None // non animatable properties will get included because of shorthands. ignore. - } + _ => return None // non animatable properties will get included because of shorthands. ignore. + }; + Some(animatable) } /// Get an AnimationValue for an AnimatableLonghand from a given computed values.