style: Allow pausing and unpausing animations.

There's a bit of flickering when unpausing where the node has the original
state, but I'm not totally sure where it comes from, posibly from
PropertyAnimation returning None due to no styles changing?
This commit is contained in:
Emilio Cobos Álvarez 2016-06-24 00:07:42 +02:00
parent 2b2e58a868
commit 8527762b83
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 159 additions and 71 deletions

View file

@ -469,8 +469,9 @@ trait PrivateMatchMethods: TNode
had_animations_to_expire = animations_to_expire.is_some();
if let Some(ref animations) = animations_to_expire {
for animation in *animations {
// TODO: revisit this code for keyframes
if let Animation::Transition(_, _, ref frame) = *animation {
// NB: Expiring a keyframes animation is the same as not
// applying the keyframes style to it, so we're safe.
if let Animation::Transition(_, _, ref frame, _) = *animation {
frame.property_animation.update(Arc::make_mut(style), 1.0);
}
}
@ -489,11 +490,11 @@ trait PrivateMatchMethods: TNode
.is_some();
if had_running_animations {
let mut all_running_animations = context.running_animations.write().unwrap();
for running_animation in all_running_animations.get(&this_opaque).unwrap() {
for mut running_animation in all_running_animations.get_mut(&this_opaque).unwrap() {
animation::update_style_for_animation::<Self::ConcreteRestyleDamage,
<Self::ConcreteElement as Element>::Impl>(context, running_animation, style, None);
running_animation.mark_as_expired();
}
all_running_animations.remove(&this_opaque);
}
had_animations_to_expire || had_running_animations