aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_traits/lib.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2020-04-30 15:38:56 +0200
committerMartin Robinson <mrobinson@igalia.com>2020-05-05 15:13:35 +0200
commitb585ce5b1f181996b2f8109a4e045eb6f5b3e2a0 (patch)
tree2b99b00e665a8aef857f89f355eef9f269095368 /components/script_traits/lib.rs
parent5e44327325cdc92dffa40b92394e8b2b68df97e0 (diff)
downloadservo-b585ce5b1f181996b2f8109a4e045eb6f5b3e2a0.tar.gz
servo-b585ce5b1f181996b2f8109a4e045eb6f5b3e2a0.zip
Use a restyle for animation ticks
This change corrects synchronization issues with animations, by reworking the animation processing model to do a quick restyle and incremental layout when ticking animations. While this change adds overhead to animation ticks, the idea is that this will be the fallback when synchronous behavior is required to fulfill specification requirements. In the optimistic case, many animations could be updated and applied off-the-main-thread and then resynchronized when style information is queried by script. Fixes #13865.
Diffstat (limited to 'components/script_traits/lib.rs')
-rw-r--r--components/script_traits/lib.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index c23221f929f..caa3cf2d34a 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -10,6 +10,8 @@
#![deny(unsafe_code)]
#[macro_use]
+extern crate bitflags;
+#[macro_use]
extern crate malloc_size_of;
#[macro_use]
extern crate malloc_size_of_derive;
@@ -122,8 +124,6 @@ pub enum LayoutControlMsg {
ExitNow,
/// Requests the current epoch (layout counter) from this layout.
GetCurrentEpoch(IpcSender<Epoch>),
- /// Asks layout to run another step in its animation.
- TickAnimations(ImmutableOrigin),
/// Tells layout about the new scrolling offsets of each scrollable stacking context.
SetScrollStates(Vec<ScrollState>),
/// Requests the current load state of Web fonts. `true` is returned if fonts are still loading
@@ -403,7 +403,7 @@ pub enum ConstellationControlMsg {
/// Passes a webdriver command to the script thread for execution
WebDriverScriptCommand(PipelineId, WebDriverScriptCommand),
/// Notifies script thread that all animations are done
- TickAllAnimations(PipelineId),
+ TickAllAnimations(PipelineId, AnimationTickType),
/// Notifies the script thread that a transition or animation related event should be sent.
TransitionOrAnimationEvent {
/// The pipeline id of the layout task that sent this message.
@@ -812,13 +812,15 @@ pub struct IFrameLoadInfoWithData {
pub window_size: WindowSizeData,
}
-/// Specifies whether the script or layout thread needs to be ticked for animation.
-#[derive(Debug, Deserialize, Serialize)]
-pub enum AnimationTickType {
- /// The script thread.
- Script,
- /// The layout thread.
- Layout,
+bitflags! {
+ #[derive(Deserialize, Serialize)]
+ /// Specifies if rAF should be triggered and/or CSS Animations and Transitions.
+ pub struct AnimationTickType: u8 {
+ /// Trigger a call to requestAnimationFrame.
+ const REQUEST_ANIMATION_FRAME = 0b001;
+ /// Trigger restyles for CSS Animations and Transitions.
+ const CSS_ANIMATIONS_AND_TRANSITIONS = 0b010;
+ }
}
/// The scroll state of a stacking context.