Auto merge of #12159 - notriddle:fix_interpolate_cleanup_regression, r=emilio

Do not crash on partial calc interpolation

It should always be possible to interpolate between CalcLengthOrPercentage points.
____

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12151 (github issue number if applicable).
- [ ] There are tests for these changes  (*I STILL NEED TO WRITE TESTS*)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12159)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-07-03 06:35:01 -07:00 committed by GitHub
commit ed514d7934
4 changed files with 48 additions and 2 deletions

View file

@ -324,8 +324,8 @@ impl Interpolate for CalcLengthOrPercentage {
#[inline]
fn interpolate(&self, other: &Self, time: f64) -> Result<Self, ()> {
Ok(CalcLengthOrPercentage {
length: try!(self.length.interpolate(&other.length, time)),
percentage: try!(self.percentage.interpolate(&other.percentage, time)),
length: self.length.interpolate(&other.length, time).ok().and_then(|x|x),
percentage: self.percentage.interpolate(&other.percentage, time).ok().and_then(|x|x),
})
}
}