Bug 1387948 - Fix the computation of the interpolation of FontWeight. draft
authorBoris Chiou <boris.chiou@gmail.com>
Tue, 08 Aug 2017 13:34:53 +0800
changeset 642410 79ad89544d9999055443db14606e196f1c0124c6
parent 642358 a6800ce8b7f4b83ec62778a129667037365abd78
child 642411 6126cc3a6b43d3d399d37885421f5beca8367442
push id72734
push userbmo:boris.chiou@gmail.com
push dateTue, 08 Aug 2017 05:41:26 +0000
bugs1387948
milestone57.0a1
Bug 1387948 - Fix the computation of the interpolation of FontWeight. MozReview-Commit-ID: ABi6tr3TkBp
servo/components/style/properties/helpers/animated_properties.mako.rs
--- 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)