Remove 10k from AnimationValue::from_declaration.

This commit is contained in:
Josh Matthews 2017-09-07 12:45:38 -07:00
parent 77afc3f33a
commit 13df088201

View file

@ -407,7 +407,7 @@ impl AnimationValue {
) -> Option<Self> { ) -> Option<Self> {
use properties::LonghandId; use properties::LonghandId;
match *decl { let animatable = match *decl {
% for prop in data.longhands: % for prop in data.longhands:
% if prop.animatable: % if prop.animatable:
PropertyDeclaration::${prop.camel_case}(ref val) => { PropertyDeclaration::${prop.camel_case}(ref val) => {
@ -427,13 +427,13 @@ impl AnimationValue {
% else: % else:
let computed = val.to_computed_value(context); let computed = val.to_computed_value(context);
% endif % endif
Some(AnimationValue::${prop.camel_case}( AnimationValue::${prop.camel_case}(
% if prop.is_animatable_with_computed_value: % if prop.is_animatable_with_computed_value:
computed computed
% else: % else:
computed.to_animated_value() computed.to_animated_value()
% endif % endif
)) )
}, },
% endif % endif
% endfor % endfor
@ -444,33 +444,32 @@ impl AnimationValue {
% for prop in data.longhands: % for prop in data.longhands:
% if prop.animatable: % if prop.animatable:
LonghandId::${prop.camel_case} => { LonghandId::${prop.camel_case} => {
let computed = match keyword { let style_struct = match keyword {
% if not prop.style_struct.inherited: % if not prop.style_struct.inherited:
CSSWideKeyword::Unset | CSSWideKeyword::Unset |
% endif % endif
CSSWideKeyword::Initial => { CSSWideKeyword::Initial => {
let initial_struct = initial.get_${prop.style_struct.name_lower}(); initial.get_${prop.style_struct.name_lower}()
initial_struct.clone_${prop.ident}()
}, },
% if prop.style_struct.inherited: % if prop.style_struct.inherited:
CSSWideKeyword::Unset | CSSWideKeyword::Unset |
% endif % endif
CSSWideKeyword::Inherit => { CSSWideKeyword::Inherit => {
let inherit_struct = context.builder context.builder
.get_parent_${prop.style_struct.name_lower}(); .get_parent_${prop.style_struct.name_lower}()
inherit_struct.clone_${prop.ident}()
}, },
}; };
let computed = style_struct.clone_${prop.ident}();
% if not prop.is_animatable_with_computed_value: % if not prop.is_animatable_with_computed_value:
let computed = computed.to_animated_value(); let computed = computed.to_animated_value();
% endif % endif
Some(AnimationValue::${prop.camel_case}(computed)) AnimationValue::${prop.camel_case}(computed)
}, },
% endif % endif
% endfor % endfor
% for prop in data.longhands: % for prop in data.longhands:
% if not prop.animatable: % if not prop.animatable:
LonghandId::${prop.camel_case} => None, LonghandId::${prop.camel_case} => return None,
% endif % endif
% endfor % endfor
} }
@ -486,15 +485,16 @@ impl AnimationValue {
context.quirks_mode context.quirks_mode
) )
}; };
AnimationValue::from_declaration( return AnimationValue::from_declaration(
&substituted, &substituted,
context, context,
extra_custom_properties, extra_custom_properties,
initial, 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. /// Get an AnimationValue for an AnimatableLonghand from a given computed values.