diff options
author | Martin Robinson <mrobinson@igalia.com> | 2020-05-05 13:36:57 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2020-05-05 20:08:44 +0200 |
commit | 3a74013abcec241d67d2685e52a031409dc59dd4 (patch) | |
tree | 0fc6791d087797120dd960aa0fb1e0a9a6ebce92 /components/script_traits/lib.rs | |
parent | b585ce5b1f181996b2f8109a4e045eb6f5b3e2a0 (diff) | |
download | servo-3a74013abcec241d67d2685e52a031409dc59dd4.tar.gz servo-3a74013abcec241d67d2685e52a031409dc59dd4.zip |
Start having animations conform to the HTML spec
This is a small step toward fixing #19242. The main idea is that the
clock for animations should advance as the event loop ticks. We
accomplish this by moving the clock from layout and naming it the
"animation timeline" which is the spec language. This should fix
flakiness with animations and transitions tests where a reflow could
move animations forward while script was running.
This change also starts to break out transition and animation events
into their own data structure, because it's quite likely that the next
step in fixing #19242 is to no longer send these events through a
channel.
Diffstat (limited to 'components/script_traits/lib.rs')
-rw-r--r-- | components/script_traits/lib.rs | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index caa3cf2d34a..aeac1ff6087 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -318,6 +318,22 @@ impl TransitionOrAnimationEventType { } } +#[derive(Deserialize, Serialize)] +/// A transition or animation event. +pub struct TransitionOrAnimationEvent { + /// The pipeline id of the layout task that sent this message. + pub pipeline_id: PipelineId, + /// The type of transition event this should trigger. + pub event_type: TransitionOrAnimationEventType, + /// The address of the node which owns this transition. + pub node: UntrustedNodeAddress, + /// The name of the property that is transitioning (in the case of a transition) + /// or the name of the animation (in the case of an animation). + pub property_or_animation_name: String, + /// The elapsed time property to send with this transition event. + pub elapsed_time: f64, +} + /// Messages sent from the constellation or layout to the script thread. #[derive(Deserialize, Serialize)] pub enum ConstellationControlMsg { @@ -405,19 +421,7 @@ pub enum ConstellationControlMsg { /// Notifies script thread that all animations are done 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. - pipeline_id: PipelineId, - /// The type of transition event this should trigger. - event_type: TransitionOrAnimationEventType, - /// The address of the node which owns this transition. - node: UntrustedNodeAddress, - /// The name of the property that is transitioning (in the case of a transition) - /// or the name of the animation (in the case of an animation). - property_or_animation_name: String, - /// The elapsed time property to send with this transition event. - elapsed_time: f64, - }, + TransitionOrAnimationEvent(TransitionOrAnimationEvent), /// Notifies the script thread that a new Web font has been loaded, and thus the page should be /// reflowed. WebFontLoaded(PipelineId), |