mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Split animations and transitions into separate lists
This change splits the list of animations and transitions, which are almost always handled differently. It also renames `ElementAnimationState` to `ElementAnimationSet` and establishes an `AnimationState` for every transition and animation. This allows us to stop continually reallocating lists every time a transition or animation needs to be canceled. Fixes #14419.
This commit is contained in:
parent
b290ad95c1
commit
b8874ad6ac
5 changed files with 670 additions and 692 deletions
File diff suppressed because it is too large
Load diff
|
@ -5,7 +5,7 @@
|
|||
//! The context within which style is calculated.
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
use crate::animation::ElementAnimationState;
|
||||
use crate::animation::ElementAnimationSet;
|
||||
use crate::bloom::StyleBloom;
|
||||
use crate::data::{EagerPseudoStyles, ElementData};
|
||||
#[cfg(feature = "servo")]
|
||||
|
@ -167,7 +167,7 @@ pub struct SharedStyleContext<'a> {
|
|||
|
||||
/// The state of all animations for our styled elements.
|
||||
#[cfg(feature = "servo")]
|
||||
pub animation_states: Arc<RwLock<FxHashMap<OpaqueNode, ElementAnimationState>>>,
|
||||
pub animation_states: Arc<RwLock<FxHashMap<OpaqueNode, ElementAnimationSet>>>,
|
||||
|
||||
/// Paint worklets
|
||||
#[cfg(feature = "servo")]
|
||||
|
|
|
@ -452,15 +452,15 @@ trait PrivateMatchMethods: TElement {
|
|||
&context.thread_local.font_metrics_provider,
|
||||
);
|
||||
|
||||
animation_state.apply_new_and_running_animations::<Self>(
|
||||
animation_state.apply_active_animations::<Self>(
|
||||
shared_context,
|
||||
new_values,
|
||||
&context.thread_local.font_metrics_provider,
|
||||
);
|
||||
|
||||
// If the ElementAnimationState is empty, and don't store it in order to
|
||||
// If the ElementAnimationSet is empty, and don't store it in order to
|
||||
// save memory and to avoid extra processing later.
|
||||
animation_state.finished_animations.clear();
|
||||
animation_state.clear_finished_animations();
|
||||
if !animation_state.is_empty() {
|
||||
animation_states.insert(this_opaque, animation_state);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue