style: Rewrite the animation representation to allow having state in layout

I have to make the appropriate changes in layout, but I'm running out of battery
in the bus.
This commit is contained in:
Emilio Cobos Álvarez 2016-06-19 19:39:32 +02:00
parent 5b27e46d04
commit c16c5acade
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 258 additions and 152 deletions

View file

@ -6,7 +6,7 @@
#![allow(unsafe_code)]
use animation;
use animation::{self, Animation};
use context::{SharedStyleContext, LocalStyleContext};
use data::PrivateStyleData;
use dom::{TElement, TNode, TRestyleDamage};
@ -471,7 +471,10 @@ trait PrivateMatchMethods: TNode
had_animations_to_expire = animations_to_expire.is_some();
if let Some(ref animations) = animations_to_expire {
for animation in *animations {
animation.property_animation.update(Arc::make_mut(style), 1.0);
// TODO: revisit this code for keyframes
if let Animation::Transition(_, _, ref frame) = *animation {
frame.property_animation.update(Arc::make_mut(style), 1.0);
}
}
}
}
@ -489,7 +492,8 @@ trait PrivateMatchMethods: TNode
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() {
animation::update_style_for_animation::<Self::ConcreteRestyleDamage>(running_animation, style, None);
animation::update_style_for_animation::<Self::ConcreteRestyleDamage,
<Self::ConcreteElement as Element>::Impl>(context, running_animation, style, None);
}
all_running_animations.remove(&this_opaque);
}