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

@ -1290,7 +1290,7 @@ impl LayoutThread {
self.tick_animations(&mut rw_data);
}
pub fn tick_animations(&mut self, rw_data: &mut LayoutThreadData) {
fn tick_animations(&mut self, rw_data: &mut LayoutThreadData) {
let reflow_info = Reflow {
goal: ReflowGoal::ForDisplay,
page_clip_rect: MAX_RECT,
@ -1302,14 +1302,14 @@ impl LayoutThread {
if let Some(mut root_flow) = self.root_flow.clone() {
// Perform an abbreviated style recalc that operates without access to the DOM.
let mut animations = self.running_animations.write().unwrap();
let animations = self.running_animations.read().unwrap();
profile(time::ProfilerCategory::LayoutStyleRecalc,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| {
animation::recalc_style_for_animations(&layout_context,
flow_ref::deref_mut(&mut root_flow),
&mut animations)
&animations)
});
}