Bug 1353628 - Part 3: Create PropertyAnimation for shorthands.

Therefore, we can start transitions on shorthand properties properly.

MozReview-Commit-ID: Ev2u2tEalnK
This commit is contained in:
Boris Chiou 2017-04-19 10:44:30 +08:00
parent 3a1421491b
commit 43f9f8ca95
2 changed files with 21 additions and 0 deletions

View file

@ -272,6 +272,15 @@ impl PropertyAnimation {
let timing_function = box_style.transition_timing_function_mod(transition_index);
let duration = box_style.transition_duration_mod(transition_index);
if transition_property.is_shorthand() {
return transition_property.longhands().iter().filter_map(|transition_property| {
PropertyAnimation::from_transition_property(*transition_property,
timing_function,
duration,
old_style,
new_style)
}).collect();
}
if transition_property != TransitionProperty::All {
if let Some(property_animation) =
@ -305,6 +314,8 @@ impl PropertyAnimation {
old_style: &ComputedValues,
new_style: &ComputedValues)
-> Option<PropertyAnimation> {
debug_assert!(!transition_property.is_shorthand() &&
transition_property != TransitionProperty::All);
let animated_property = AnimatedProperty::from_transition_property(&transition_property,
old_style,
new_style);