diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2015-12-17 16:21:29 -0800 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2015-12-29 12:07:07 -0800 |
commit | a05d7f1dfd8500d299007af99861cc86fada9386 (patch) | |
tree | ea956e5046b37168344bdff3ffc4274007d54ab6 /components/style/animation.rs | |
parent | 47059d2d26f14f71e5b7212fa8bc01608eca11b5 (diff) | |
download | servo-a05d7f1dfd8500d299007af99861cc86fada9386.tar.gz servo-a05d7f1dfd8500d299007af99861cc86fada9386.zip |
Hoist style-related context bits into style/.
We do a few things-here:
* Hoist non-layout-dependent fields in SharedLayoutData and LocalLayoutData into style/.
* Hoist parts of css/matching.rs into style/.
* Hoist parts of layout/animation.rs into style/animation.rs.
* Remove the duplicated-but-slightly-different definition of OpaqueNode.
Diffstat (limited to 'components/style/animation.rs')
-rw-r--r-- | components/style/animation.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/components/style/animation.rs b/components/style/animation.rs index 42704700c4d..374b5396bee 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -4,6 +4,7 @@ use app_units::Au; use cssparser::{Color, RGBA}; +use dom::OpaqueNode; use euclid::point::Point2D; use properties::ComputedValues; use properties::longhands::background_position::computed_value::T as BackgroundPosition; @@ -30,6 +31,28 @@ use values::CSSFloat; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use values::computed::{CalcLengthOrPercentage, Length, LengthOrPercentage, Time}; +/// State relating to an animation. +#[derive(Clone)] +pub struct Animation { + /// An opaque reference to the DOM node participating in the animation. + pub node: OpaqueNode, + /// A description of the property animation that is occurring. + pub property_animation: PropertyAnimation, + /// The start time of the animation, as returned by `time::precise_time_s()`. + pub start_time: f64, + /// The end time of the animation, as returned by `time::precise_time_s()`. + pub end_time: f64, +} + +impl Animation { + /// Returns the duration of this animation in seconds. + #[inline] + pub fn duration(&self) -> f64 { + self.end_time - self.start_time + } +} + + #[derive(Clone, Debug)] pub struct PropertyAnimation { property: AnimatedProperty, |