diff options
author | Martin Robinson <mrobinson@igalia.com> | 2020-06-16 19:13:52 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2020-06-16 19:25:52 +0200 |
commit | 36701e02232307d85f40497b545bc23cfb908ee4 (patch) | |
tree | f81be6a4e31e6896cce3cb54e245941de781e8d8 /components/style/animation.rs | |
parent | a84b06065bd85a914122e21c0905763f1f32ef63 (diff) | |
download | servo-36701e02232307d85f40497b545bc23cfb908ee4.tar.gz servo-36701e02232307d85f40497b545bc23cfb908ee4.zip |
Combine AnimationAndTransitionDeclarations and AnimationRules
These two structs are very similar, so we can combine them.
Diffstat (limited to 'components/style/animation.rs')
-rw-r--r-- | components/style/animation.rs | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/components/style/animation.rs b/components/style/animation.rs index ad5e41553fe..4576b91ef57 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -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( |