mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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.
This commit is contained in:
parent
46256b33ef
commit
92061132f3
5 changed files with 37 additions and 15 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue