Struct script::animations::Animations
source · pub(crate) struct Animations {
pub sets: DocumentAnimationSet,
has_running_animations: Cell<bool>,
rooted_nodes: DomRefCell<FxHashMap<NoTrace<OpaqueNode>, Dom<Node>>>,
pending_events: DomRefCell<Vec<TransitionOrAnimationEvent>>,
timeline_value_at_last_dirty: Cell<f64>,
}
Expand description
The set of animations for a document.
Fields§
§sets: DocumentAnimationSet
The map of nodes to their animation states.
has_running_animations: Cell<bool>
Whether or not we have animations that are running.
rooted_nodes: DomRefCell<FxHashMap<NoTrace<OpaqueNode>, Dom<Node>>>
A list of nodes with in-progress CSS transitions or pending events.
pending_events: DomRefCell<Vec<TransitionOrAnimationEvent>>
A list of pending animation-related events.
timeline_value_at_last_dirty: Cell<f64>
The timeline value at the last time all animations were marked dirty. This is used to prevent marking animations dirty when the timeline has not changed.
Implementations§
source§impl Animations
impl Animations
pub(crate) fn new() -> Self
pub(crate) fn clear(&self)
pub(crate) fn mark_animating_nodes_as_dirty( &self, current_timeline_value: f64, ) -> bool
pub(crate) fn update_for_new_timeline_value(&self, window: &Window, now: f64)
sourcepub(crate) fn cancel_animations_for_node(&self, node: &Node)
pub(crate) fn cancel_animations_for_node(&self, node: &Node)
Cancel animations for the given node, if any exist.
sourcepub(crate) fn do_post_reflow_update(&self, window: &Window, now: f64)
pub(crate) fn do_post_reflow_update(&self, window: &Window, now: f64)
Processes any new animations that were discovered after reflow. Collect messages that trigger events for any animations that changed state.
fn update_running_animations_presence(&self, window: &Window, new_value: bool)
fn handle_animation_presence_or_pending_events_change(&self, window: &Window)
pub(crate) fn running_animation_count(&self) -> usize
sourcefn start_pending_animations(
&self,
key: &AnimationSetKey,
set: &mut ElementAnimationSet,
now: f64,
pipeline_id: PipelineId,
)
fn start_pending_animations( &self, key: &AnimationSetKey, set: &mut ElementAnimationSet, now: f64, pipeline_id: PipelineId, )
Walk through the list of pending animations and start all of the ones that have left the delay phase.
sourcefn finish_running_animations(
&self,
key: &AnimationSetKey,
set: &mut ElementAnimationSet,
now: f64,
pipeline_id: PipelineId,
)
fn finish_running_animations( &self, key: &AnimationSetKey, set: &mut ElementAnimationSet, now: f64, pipeline_id: PipelineId, )
Walk through the list of running animations and remove all of the ones that have ended.
sourcefn handle_canceled_animations(
&self,
key: &AnimationSetKey,
set: &mut ElementAnimationSet,
now: f64,
pipeline_id: PipelineId,
)
fn handle_canceled_animations( &self, key: &AnimationSetKey, set: &mut ElementAnimationSet, now: f64, pipeline_id: PipelineId, )
Send events for canceled animations. Currently this only handles canceled transitions, but eventually this should handle canceled CSS animations as well.
fn handle_new_animations( &self, key: &AnimationSetKey, set: &mut ElementAnimationSet, now: f64, pipeline_id: PipelineId, )
sourcefn root_newly_animating_dom_nodes(
&self,
sets: &FxHashMap<AnimationSetKey, ElementAnimationSet>,
)
fn root_newly_animating_dom_nodes( &self, sets: &FxHashMap<AnimationSetKey, ElementAnimationSet>, )
Ensure that all nodes with new animations are rooted. This should be called immediately after a restyle, to ensure that these addresses are still valid.
fn unroot_unused_nodes( &self, sets: &FxHashMap<AnimationSetKey, ElementAnimationSet>, )
fn add_transition_event( &self, key: &AnimationSetKey, transition: &Transition, event_type: TransitionOrAnimationEventType, now: f64, pipeline_id: PipelineId, )
fn add_animation_event( &self, key: &AnimationSetKey, animation: &Animation, event_type: TransitionOrAnimationEventType, now: f64, pipeline_id: PipelineId, )
pub(crate) fn send_pending_events(&self, window: &Window, can_gc: CanGc)
Trait Implementations§
source§impl Default for Animations
impl Default for Animations
source§fn default() -> Animations
fn default() -> Animations
source§impl MallocSizeOf for Animations
impl MallocSizeOf for Animations
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl !Freeze for Animations
impl !RefUnwindSafe for Animations
impl !Send for Animations
impl !Sync for Animations
impl Unpin for Animations
impl !UnwindSafe for Animations
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.