mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +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
|
@ -76,6 +76,13 @@ mod timer_scheduler;
|
|||
mod touch;
|
||||
pub mod windowing;
|
||||
|
||||
/// Specifies whether the script or layout thread needs to be ticked for animation.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum AnimationTickType {
|
||||
Script,
|
||||
Layout,
|
||||
}
|
||||
|
||||
/// Messages from the compositor to the constellation.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum CompositorMsg {
|
||||
|
@ -98,7 +105,7 @@ pub enum CompositorMsg {
|
|||
Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
|
||||
ResizedWindow(WindowSizeData),
|
||||
/// Requests that the constellation instruct layout to begin a new tick of the animation.
|
||||
TickAnimation(PipelineId),
|
||||
TickAnimation(PipelineId, AnimationTickType),
|
||||
/// Dispatch a webdriver command
|
||||
WebDriverCommand(WebDriverCommandMsg),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue