mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Bug 1357357 - Make the parser of transition-property match the spec.
1. We add a new arm to TransitionProperty, TransitionProperty::Unsupported, which contains an Atom, so it's better to remove the Copy trait from TransitionProperty. 2. TransitionProperty::Unsupported(Atom) represents any non-animatable, custom, or unrecognized property, and we use Atom to store the ident string for serialization.
This commit is contained in:
parent
e5762cb695
commit
02fc1789e8
13 changed files with 139 additions and 56 deletions
|
@ -272,9 +272,13 @@ impl PropertyAnimation {
|
|||
let timing_function = box_style.transition_timing_function_mod(transition_index);
|
||||
let duration = box_style.transition_duration_mod(transition_index);
|
||||
|
||||
if let TransitionProperty::Unsupported(_) = transition_property {
|
||||
return result
|
||||
}
|
||||
|
||||
if transition_property.is_shorthand() {
|
||||
return transition_property.longhands().iter().filter_map(|transition_property| {
|
||||
PropertyAnimation::from_transition_property(*transition_property,
|
||||
PropertyAnimation::from_transition_property(transition_property,
|
||||
timing_function,
|
||||
duration,
|
||||
old_style,
|
||||
|
@ -284,7 +288,7 @@ impl PropertyAnimation {
|
|||
|
||||
if transition_property != TransitionProperty::All {
|
||||
if let Some(property_animation) =
|
||||
PropertyAnimation::from_transition_property(transition_property,
|
||||
PropertyAnimation::from_transition_property(&transition_property,
|
||||
timing_function,
|
||||
duration,
|
||||
old_style,
|
||||
|
@ -296,7 +300,7 @@ impl PropertyAnimation {
|
|||
|
||||
TransitionProperty::each(|transition_property| {
|
||||
if let Some(property_animation) =
|
||||
PropertyAnimation::from_transition_property(transition_property,
|
||||
PropertyAnimation::from_transition_property(&transition_property,
|
||||
timing_function,
|
||||
duration,
|
||||
old_style,
|
||||
|
@ -308,15 +312,15 @@ impl PropertyAnimation {
|
|||
result
|
||||
}
|
||||
|
||||
fn from_transition_property(transition_property: TransitionProperty,
|
||||
fn from_transition_property(transition_property: &TransitionProperty,
|
||||
timing_function: TransitionTimingFunction,
|
||||
duration: Time,
|
||||
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,
|
||||
transition_property != &TransitionProperty::All);
|
||||
let animated_property = AnimatedProperty::from_transition_property(transition_property,
|
||||
old_style,
|
||||
new_style);
|
||||
|
||||
|
@ -702,7 +706,7 @@ pub fn update_style_for_animation(context: &SharedStyleContext,
|
|||
for transition_property in &animation.properties_changed {
|
||||
debug!("update_style_for_animation: scanning prop {:?} for animation \"{}\"",
|
||||
transition_property, name);
|
||||
match PropertyAnimation::from_transition_property(*transition_property,
|
||||
match PropertyAnimation::from_transition_property(transition_property,
|
||||
timing_function,
|
||||
Time::from_seconds(relative_duration as f32),
|
||||
&from_style,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue