mirror of
https://github.com/servo/servo.git
synced 2025-06-22 08:08:59 +01:00
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:
parent
3a1421491b
commit
43f9f8ca95
2 changed files with 21 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -158,6 +158,16 @@ impl TransitionProperty {
|
|||
_ => panic!("Not allowed to call longhands() for this TransitionProperty")
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this TransitionProperty is a shorthand.
|
||||
pub fn is_shorthand(&self) -> bool {
|
||||
match *self {
|
||||
% for prop in data.shorthands_except_all():
|
||||
TransitionProperty::${prop.camel_case} => true,
|
||||
% endfor
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this nsCSSPropertyID is one of the animatable properties.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue