Bug 1387948 - Fix the computation of the interpolation of FontWeight.
MozReview-Commit-ID: ABi6tr3TkBp
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -1416,17 +1416,17 @@ impl ToAnimatedZero for MaxLength {
/// http://dev.w3.org/csswg/css-transitions/#animtype-font-weight
impl Animatable for FontWeight {
#[inline]
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
let a = self.0 as f64;
let b = other.0 as f64;
const NORMAL: f64 = 400.;
let weight = (a - NORMAL) * self_portion + (b - NORMAL) * other_portion + NORMAL;
- let weight = (weight.min(100.).max(900.) / 100.).round() * 100.;
+ let weight = (weight.max(100.).min(900.) / 100.).round() * 100.;
Ok(FontWeight(weight as u16))
}
#[inline]
fn compute_distance(&self, other: &Self) -> Result<f64, ()> {
let a = self.0 as f64;
let b = other.0 as f64;
a.compute_distance(&b)