Bug 1387939 - Round harlway values toward positive infinity for integer type of animation. r?birtles
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
MozReview-Commit-ID: 2dGCpUru0sf
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -857,17 +857,17 @@ impl Animatable for f64 {
Ok(*self * self_portion + *other * other_portion)
}
}
/// https://drafts.csswg.org/css-transitions/#animtype-integer
impl Animatable for i32 {
#[inline]
fn add_weighted(&self, other: &i32, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
- 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)
}
}
/// https://drafts.csswg.org/css-transitions/#animtype-number
impl Animatable for Angle {
#[inline]
fn add_weighted(&self, other: &Angle, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
match (*self, *other) {