Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
'animation-foo' declarations in @Keyframes should be parse error
https://bugs.webkit.org/show_bug.cgi?id=243537 <rdar://98503617> Reviewed by Antti Koivisto. The family of animation-* properties, including the animation shorthand, are invalid in a @Keyframes rule. We import the relevant WPT test which used to fail but now passes as of this change. Some other existing tests need rebasing since we changed the serialization to not output the vendor prefix, and also because they are passing thanks to this change. * LayoutTests/http/tests/css/shared-stylesheet-mutation-preconstruct-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/keyframes-allowed-properties-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/keyframes-allowed-properties.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/js/001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSKeyframesRule-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/rule-restrictions-expected.txt: * Source/WebCore/css/CSSKeyframesRule.cpp: (WebCore::CSSKeyframesRule::cssText const): * Source/WebCore/css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseValue): (WebCore::CSSPropertyParser::parseKeyframeDescriptor): * Source/WebCore/css/parser/CSSPropertyParser.h: Canonical link: https://commits.webkit.org/254468@main
- Loading branch information
Showing
9 changed files
with
82 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PASS @keyframes allows all non-animation properties and animation-timing-function | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<title>Tests which properties are allowed in @keyframes</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-animations/#typedef-keyframe-block"> | ||
<link rel="author" href="mailto:xiaochengh@chromium.org"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style id=sheet> | ||
@keyframes foo { | ||
from { | ||
/* Non-animation properties are allowed */ | ||
margin-top: 10px; | ||
/* animation-timing-function is specially allowed */ | ||
animation-timing-function: ease; | ||
/* All other animation properties are not allowed */ | ||
animation-name: none; | ||
animation-duration: 1s; | ||
animation-iteration-count: 1; | ||
animation-direction: normal; | ||
animation-play-state: running; | ||
animation-delay: 0s; | ||
animation-fill-mode: none; | ||
/* The animation shorthand is also not allowed */ | ||
animation: bar 1s infinite; | ||
} | ||
} | ||
</style> | ||
<script> | ||
test(() => { | ||
const keyframe = sheet.sheet.cssRules[0].cssRules[0]; | ||
const style = keyframe.style; | ||
assert_equals(style.length, 2); | ||
assert_equals(style.marginTop, '10px'); | ||
assert_equals(style.animationTimingFunction, 'ease'); | ||
}, '@keyframes allows all non-animation properties and animation-timing-function'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL CSSOM - CSSKeyframesRule interface assert_equals: CSSKeyframesRule cssText attribute expected "@keyframesbar{}" but got "@-webkit-keyframesbar{}" | ||
FAIL CSSOM - CSSKeyframesRule interface assert_equals: CSSKeyframesRule cssText attribute with CSS-wide keyword name expected "@keyframes\"initial\"{}" but got "@keyframesinitial{}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
FAIL @page assert_equals: Transform doesn't quite apply to pages expected 1 but got 2 | ||
FAIL @keyframe assert_equals: animation-name doesn't apply to keyframes expected 1 but got 2 | ||
PASS @keyframe | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters