Auto merge of #9858 - glennw:anim-smoothness, r=pcwalton

Fix animation smoothness when using requestAnimationFrame.

Previously, the flow for ticking animations was:

Compositor -> Constellation -> Layout -> Script

However, this means that the compositor <-> layout messages can thrash, meaning layout thread is very rarely idle.

This means that the script thread (which joins on the layout thread during reflow) was unable to execute and run rAF callbacks.

With this change, the flow is now:

Compositor -> Constellation -> Script (when rAF is active).
Compositor -> Constellation -> Layout (when transitions / animations are active and no rAF is present).

This makes rAF based animation *much* smoother.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9858)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-03-04 05:50:50 +05:30
commit aba500a698
5 changed files with 37 additions and 15 deletions

View file

@ -1220,10 +1220,6 @@ impl LayoutThread {
fn tick_all_animations<'a, 'b>(&mut self, possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut rw_data = possibly_locked_rw_data.lock();
self.tick_animations(&mut rw_data);
self.script_chan
.send(ConstellationControlMsg::TickAllAnimations(self.id))
.unwrap();
}
pub fn tick_animations(&mut self, rw_data: &mut LayoutThreadData) {