aboutsummaryrefslogtreecommitdiffstats
path: root/components/compositing/headless.rs
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2016-03-04 06:18:34 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2016-03-04 07:26:00 +1000
commit92061132f369409380c80046adb475941d805921 (patch)
tree2e491912c8f33dd75da24b7c0616abe4572e355e /components/compositing/headless.rs
parent46256b33efeb84b35cc90ae2dee03890ba7f38c7 (diff)
downloadservo-92061132f369409380c80046adb475941d805921.tar.gz
servo-92061132f369409380c80046adb475941d805921.zip
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.
Diffstat (limited to 'components/compositing/headless.rs')
-rw-r--r--components/compositing/headless.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs
index 78be2671f5c..c46bdd52262 100644
--- a/components/compositing/headless.rs
+++ b/components/compositing/headless.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use AnimationTickType;
use CompositorMsg as ConstellationMsg;
use compositor_thread::{CompositorEventListener, CompositorReceiver};
use compositor_thread::{InitialCompositorState, Msg};
@@ -98,7 +99,7 @@ impl CompositorEventListener for NullCompositor {
AnimationState::NoAnimationsPresent |
AnimationState::NoAnimationCallbacksPresent => {}
AnimationState::AnimationCallbacksPresent => {
- let msg = ConstellationMsg::TickAnimation(pipeline_id);
+ let msg = ConstellationMsg::TickAnimation(pipeline_id, AnimationTickType::Script);
self.constellation_chan.send(msg).unwrap()
}
}