style: Cleanup some of the animation starting code.

This commit is contained in:
Emilio Cobos Álvarez 2018-05-05 18:15:14 +02:00
parent 5327758b9b
commit d44bd82703
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -544,10 +544,9 @@ where
let box_style = new_style.get_box();
for (i, name) in box_style.animation_name_iter().enumerate() {
let name = if let Some(atom) = name.as_atom() {
atom
} else {
continue;
let name = match name.as_atom() {
Some(atom) => atom,
None => continue,
};
debug!("maybe_start_animations: name={}", name);
@ -556,7 +555,11 @@ where
continue;
}
if let Some(anim) = context.stylist.get_animation(name, element) {
let anim = match context.stylist.get_animation(name, element) {
Some(animation) => animation,
None => continue,
};
debug!("maybe_start_animations: animation {} found", name);
// If this animation doesn't have any keyframe, we can just continue
@ -601,17 +604,17 @@ where
started_at: animation_start,
duration: duration as f64,
delay: delay as f64,
iteration_state: iteration_state,
running_state: running_state,
iteration_state,
running_state,
direction: animation_direction,
current_direction: initial_direction,
expired: false,
cascade_style: new_style.clone(),
},
)).unwrap();
))
.unwrap();
had_animations = true;
}
}
had_animations
}