From 08ebc524cfff916a5f917e3a1756ac6e6c6b82be Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Tue, 15 Aug 2017 13:04:21 +0900 Subject: [PATCH] Round halfway values toward positive infinity for integer type of animation. From the spec[1]; `with values halfway between a pair of integers rounded towards positive infinity.` [1] https://drafts.csswg.org/css-transitions/#animtype-integer --- components/style/properties/helpers/animated_properties.mako.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 2863b04294c6..3e12db373891 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -863,7 +863,7 @@ impl Animatable for f64 { impl Animatable for i32 { #[inline] fn add_weighted(&self, other: &i32, self_portion: f64, other_portion: f64) -> Result { - Ok((*self as f64 * self_portion + *other as f64 * other_portion).round() as i32) + Ok((*self as f64 * self_portion + *other as f64 * other_portion + 0.5).floor() as i32) } }