mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #12008 - servo:keyframes, r=Manishearth
Reorder code in KeyframesAnimation::from_keyframes() to avoid a panic. Fixes #11999. Fixes #12006. <!-- 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/12008) <!-- Reviewable:end -->
This commit is contained in:
commit
b2a32ec028
3 changed files with 25 additions and 1 deletions
|
@ -154,8 +154,12 @@ fn get_animated_properties(keyframe: &Keyframe) -> Vec<TransitionProperty> {
|
||||||
|
|
||||||
impl KeyframesAnimation {
|
impl KeyframesAnimation {
|
||||||
pub fn from_keyframes(keyframes: &[Keyframe]) -> Option<Self> {
|
pub fn from_keyframes(keyframes: &[Keyframe]) -> Option<Self> {
|
||||||
|
if keyframes.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let animated_properties = get_animated_properties(&keyframes[0]);
|
let animated_properties = get_animated_properties(&keyframes[0]);
|
||||||
if keyframes.is_empty() || animated_properties.is_empty() {
|
if animated_properties.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6072,6 +6072,12 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"testharness": {
|
"testharness": {
|
||||||
|
"css/empty-keyframes.html": [
|
||||||
|
{
|
||||||
|
"path": "css/empty-keyframes.html",
|
||||||
|
"url": "/_mozilla/css/empty-keyframes.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"css/flex-item-assign-inline-size.html": [
|
"css/flex-item-assign-inline-size.html": [
|
||||||
{
|
{
|
||||||
"path": "css/flex-item-assign-inline-size.html",
|
"path": "css/flex-item-assign-inline-size.html",
|
||||||
|
|
14
tests/wpt/mozilla/tests/css/empty-keyframes.html
Normal file
14
tests/wpt/mozilla/tests/css/empty-keyframes.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Empty keyframes rule</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<style id=style>
|
||||||
|
@keyframes foo {}
|
||||||
|
</style>
|
||||||
|
<div id=log></div>
|
||||||
|
<script>
|
||||||
|
test(function() {
|
||||||
|
// Check that it is exposed in the CSSOM.
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue