From f9a8fe0afef5b4a6bac6071b812a4faac0f963b7 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 1 Jul 2016 21:02:28 -0700 Subject: [PATCH 1/2] Do not crash on partial calc interpolation Fixes #12151 Fixes regression introduced by #11924 --- .../style/properties/helpers/animated_properties.mako.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 552f5b303c3..ad34f59dc89 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -329,8 +329,8 @@ impl Interpolate for CalcLengthOrPercentage { #[inline] fn interpolate(&self, other: &Self, time: f64) -> Result { 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), }) } } From 17717d45073e1e2b46a11de9a522bb2f7776d793 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 2 Jul 2016 09:57:28 -0700 Subject: [PATCH 2/2] Add test for transitions from percent to px This does not test the rendering, only that Servo doesn't crash. --- tests/wpt/mozilla/meta/MANIFEST.json | 24 +++++++++++++++++++ .../tests/css/transition_calc_implicit.html | 21 ++++++++++++++++ .../css/transition_calc_implicit_ref.html | 1 + 3 files changed, 46 insertions(+) create mode 100644 tests/wpt/mozilla/tests/css/transition_calc_implicit.html create mode 100644 tests/wpt/mozilla/tests/css/transition_calc_implicit_ref.html diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 2fcfe5ff25b..32d55768235 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5320,6 +5320,18 @@ "url": "/_mozilla/css/transition_calc.html" } ], + "css/transition_calc_implicit.html": [ + { + "path": "css/transition_calc_implicit.html", + "references": [ + [ + "/_mozilla/css/transition_calc_implicit_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/transition_calc_implicit.html" + } + ], "css/translate_clip.html": [ { "path": "css/translate_clip.html", @@ -12440,6 +12452,18 @@ "url": "/_mozilla/css/transition_calc.html" } ], + "css/transition_calc_implicit.html": [ + { + "path": "css/transition_calc_implicit.html", + "references": [ + [ + "/_mozilla/css/transition_calc_implicit_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/transition_calc_implicit.html" + } + ], "css/translate_clip.html": [ { "path": "css/translate_clip.html", diff --git a/tests/wpt/mozilla/tests/css/transition_calc_implicit.html b/tests/wpt/mozilla/tests/css/transition_calc_implicit.html new file mode 100644 index 00000000000..a4cca7548ae --- /dev/null +++ b/tests/wpt/mozilla/tests/css/transition_calc_implicit.html @@ -0,0 +1,21 @@ + + + +
+ diff --git a/tests/wpt/mozilla/tests/css/transition_calc_implicit_ref.html b/tests/wpt/mozilla/tests/css/transition_calc_implicit_ref.html new file mode 100644 index 00000000000..0e76edd65b7 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/transition_calc_implicit_ref.html @@ -0,0 +1 @@ +