From 64b0d59d21b6a3d4ad9f985cb387c42fc6ea22e6 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 24 May 2017 09:09:56 +0900 Subject: [PATCH] Define accumulate method on Animatable trait --- .../style/properties/helpers/animated_properties.mako.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 6ea63347b60..a488524c8d1 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -680,6 +680,15 @@ pub trait Animatable: Sized { self.add_weighted(other, 1.0, 1.0) } + /// [Accumulates][animation-accumulation] this value onto itself (|count| - 1) times then + /// accumulates |other| onto the result. + /// If |count| is zero, the result will be |other|. + /// + /// [animation-accumulation]: https://w3c.github.io/web-animations/#animation-accumulation + fn accumulate(&self, other: &Self, count: u64) -> Result { + self.add_weighted(other, count as f64, 1.0) + } + /// Compute distance between a value and another for a given property. fn compute_distance(&self, _other: &Self) -> Result { Err(()) }