Bug 1371480 - Return zero when computing distance of Option with both value is none. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Tue, 13 Jun 2017 16:23:12 +0900
changeset 593094 55881213937c021a5bb4bf57eccbf481e27f7a1d
parent 592979 2a3a253806d129c0bb6f2b76bf75630457a24492
child 593095 cccde6164addf1d7c97c88aacb90847ef51a37d8
push id63600
push usermantaroh@gmail.com
push dateTue, 13 Jun 2017 07:26:20 +0000
reviewersbirtles
bugs1371480
milestone56.0a1
Bug 1371480 - Return zero when computing distance of Option with both value is none. r?birtles MozReview-Commit-ID: 80uFiC6JkJp
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
@@ -848,16 +848,17 @@ impl <T> Animatable for Option<T>
     }
 
     #[inline]
     fn compute_squared_distance(&self, other: &Self) -> Result<f64, ()> {
         match (self, other) {
             (&Some(ref this), &Some(ref other)) => {
                 this.compute_squared_distance(other)
             },
+            (&None, &None) => Ok(0.0),
             _ => Err(()),
         }
     }
 }
 
 /// https://drafts.csswg.org/css-transitions/#animtype-number
 impl Animatable for f32 {
     #[inline]