style: Avoid ending up with an invalid keyframe when inf or NaN are at play.

This commit is contained in:
Emilio Cobos Álvarez 2016-12-15 13:30:06 +01:00
parent 04d9ab50eb
commit fa01716c52
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 24 additions and 2 deletions

View file

@ -50,10 +50,11 @@ impl KeyframePercentage {
KeyframePercentage::new(1.)
} else {
let percentage = try!(input.expect_percentage());
if percentage > 1. || percentage < 0. {
if percentage >= 0. && percentage <= 1. {
KeyframePercentage::new(percentage)
} else {
return Err(());
}
KeyframePercentage::new(percentage)
};
Ok(percentage)

View file

@ -8294,6 +8294,12 @@
"url": "/_mozilla/mozilla/iterable.html"
}
],
"mozilla/keyframe-infinite-percentage.html": [
{
"path": "mozilla/keyframe-infinite-percentage.html",
"url": "/_mozilla/mozilla/keyframe-infinite-percentage.html"
}
],
"mozilla/lenient_this.html": [
{
"path": "mozilla/lenient_this.html",

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset="utf-8">
<title>Shouldn't end up with an invalid keyframe when inf or nan are at play.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@keyframes anim {
0e309% {}
}
</style>
<script>
test(function() {
assert_true(true, "Doesn't crash");
}, "Doesn't crash");
</script>