aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/keyframes.rs6
-rw-r--r--tests/wpt/mozilla/meta/MANIFEST.json6
-rw-r--r--tests/wpt/mozilla/tests/css/empty-keyframes.html14
3 files changed, 25 insertions, 1 deletions
diff --git a/components/style/keyframes.rs b/components/style/keyframes.rs
index cbfa35b78c4..7d219758848 100644
--- a/components/style/keyframes.rs
+++ b/components/style/keyframes.rs
@@ -154,8 +154,12 @@ fn get_animated_properties(keyframe: &Keyframe) -> Vec<TransitionProperty> {
impl KeyframesAnimation {
pub fn from_keyframes(keyframes: &[Keyframe]) -> Option<Self> {
+ if keyframes.is_empty() {
+ return None;
+ }
+
let animated_properties = get_animated_properties(&keyframes[0]);
- if keyframes.is_empty() || animated_properties.is_empty() {
+ if animated_properties.is_empty() {
return None;
}
diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json
index 80f6462e081..2fcfe5ff25b 100644
--- a/tests/wpt/mozilla/meta/MANIFEST.json
+++ b/tests/wpt/mozilla/meta/MANIFEST.json
@@ -6072,6 +6072,12 @@
]
},
"testharness": {
+ "css/empty-keyframes.html": [
+ {
+ "path": "css/empty-keyframes.html",
+ "url": "/_mozilla/css/empty-keyframes.html"
+ }
+ ],
"css/flex-item-assign-inline-size.html": [
{
"path": "css/flex-item-assign-inline-size.html",
diff --git a/tests/wpt/mozilla/tests/css/empty-keyframes.html b/tests/wpt/mozilla/tests/css/empty-keyframes.html
new file mode 100644
index 00000000000..9f8935fb7f5
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/empty-keyframes.html
@@ -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>