mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Combine AnimationAndTransitionDeclarations and AnimationRules
These two structs are very similar, so we can combine them.
This commit is contained in:
parent
a84b06065b
commit
36701e0223
6 changed files with 38 additions and 50 deletions
|
@ -14,6 +14,7 @@ use crate::properties::animated_properties::{AnimationValue, AnimationValueMap};
|
|||
use crate::properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection;
|
||||
use crate::properties::longhands::animation_fill_mode::computed_value::single_value::T as AnimationFillMode;
|
||||
use crate::properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
||||
use crate::properties::AnimationDeclarations;
|
||||
use crate::properties::{
|
||||
ComputedValues, Importance, LonghandId, LonghandIdSet, PropertyDeclarationBlock,
|
||||
PropertyDeclarationId,
|
||||
|
@ -1235,13 +1236,13 @@ impl DocumentAnimationSet {
|
|||
}
|
||||
|
||||
/// Get all the animation declarations for the given key, returning an empty
|
||||
/// `AnimationAndTransitionDeclarations` if there are no animations.
|
||||
/// `AnimationDeclarations` if there are no animations.
|
||||
pub(crate) fn get_all_declarations(
|
||||
&self,
|
||||
key: &AnimationSetKey,
|
||||
time: f64,
|
||||
shared_lock: &SharedRwLock,
|
||||
) -> AnimationAndTransitionDeclarations {
|
||||
) -> AnimationDeclarations {
|
||||
let sets = self.sets.read();
|
||||
let set = match sets.get(key) {
|
||||
Some(set) => set,
|
||||
|
@ -1256,7 +1257,7 @@ impl DocumentAnimationSet {
|
|||
let block = PropertyDeclarationBlock::from_animation_value_map(&map);
|
||||
Arc::new(shared_lock.wrap(block))
|
||||
});
|
||||
AnimationAndTransitionDeclarations {
|
||||
AnimationDeclarations {
|
||||
animations,
|
||||
transitions,
|
||||
}
|
||||
|
@ -1270,23 +1271,6 @@ impl DocumentAnimationSet {
|
|||
}
|
||||
}
|
||||
|
||||
/// A set of property declarations for a node, including animations and
|
||||
/// transitions.
|
||||
#[derive(Default)]
|
||||
pub struct AnimationAndTransitionDeclarations {
|
||||
/// Declarations for animations.
|
||||
pub animations: Option<Arc<Locked<PropertyDeclarationBlock>>>,
|
||||
/// Declarations for transitions.
|
||||
pub transitions: Option<Arc<Locked<PropertyDeclarationBlock>>>,
|
||||
}
|
||||
|
||||
impl AnimationAndTransitionDeclarations {
|
||||
/// Whether or not this `AnimationAndTransitionDeclarations` is empty.
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
self.animations.is_none() && self.transitions.is_none()
|
||||
}
|
||||
}
|
||||
|
||||
/// Kick off any new transitions for this node and return all of the properties that are
|
||||
/// transitioning. This is at the end of calculating style for a single node.
|
||||
pub fn start_transitions_if_applicable(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue