commit fbd8d3c77c19fefd2d37fa1f7e19ad6532956ead
parent b53a52d5303288bcdebff9de771eb1448af1c6e2
Author: Kevin Babbitt <kbabbitt@microsoft.com>
Date: Wed, 15 Oct 2025 09:14:25 +0000
Bug 1994290 [wpt PR 55430] - Update at-rule() implementation and test to match CSSWG resolutions, a=testonly
Automatic update from web-platform-tests
Update at-rule() implementation and test to match CSSWG resolutions
https://github.com/w3c/csswg-drafts/issues/6966#issuecomment-3205037703
- Cut down the at-rule test to just `at-rule(@foo)` (no descriptor
testing)
https://github.com/w3c/csswg-drafts/issues/11116#issuecomment-3205061108
- at-rule(@charset) is invalid, but at-rule(@import) is allowed
https://github.com/w3c/csswg-drafts/issues/11117#issuecomment-3205069621
- at-rule() can test for at-rules that are only valid inside other
at-rules (like at-rule(@swash))
Bug: 40211832
Change-Id: I6493d61fbd89394935b62459cae4166795c5a0da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7037634
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1529694}
--
wpt-commits: ebec4906ada3390311451da2b224ce0d87ac153c
wpt-pr: 55430
Diffstat:
2 files changed, 31 insertions(+), 80 deletions(-)
diff --git a/testing/web-platform/tests/css/css-conditional/js/supports-at-rule.html b/testing/web-platform/tests/css/css-conditional/js/supports-at-rule.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<title>@supports at-rule</title>
+<link rel="help" href="https://www.w3.org/TR/css-conditional-4/#the-css-namespace">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ function test_supports(rule, expected, desc) {
+ test(() => {
+ assert_equals(CSS.supports(rule), expected, 'CSS.supports(' + rule + ')');
+ }, desc);
+ }
+
+ // Basic at-rule support.
+ test_supports("at-rule(@supports)", true);
+ test_supports("at-rule( @supports)", true);
+ test_supports("at-rule(@supports )", true);
+ test_supports("at-rule(@media)", true);
+ test_supports("at-rule(@counter-style)", true);
+ test_supports("at-rule(@doesnotexist)", false);
+
+ // At-rules with special positioning requirements.
+ test_supports("at-rule(@import)", true);
+ test_supports("at-rule(@swash)", true);
+ test_supports("at-rule(@starting-style)", true);
+
+ // @charset is not an at-rule.
+ test_supports("at-rule(@charset)", false);
+
+ // Descriptors are not accepted.
+ test_supports("at-rule(@counter-style; system: fixed)", false);
+</script>
diff --git a/testing/web-platform/tests/css/css-conditional/js/supports-at-rule.tentative.html b/testing/web-platform/tests/css/css-conditional/js/supports-at-rule.tentative.html
@@ -1,80 +0,0 @@
-<!doctype html>
-<title>@supports at-rule</title>
-<link rel="help" href="https://www.w3.org/TR/css-conditional-4/#the-css-namespace">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script>
- function test_supports(rule, expected, desc) {
- test(() => {
- assert_equals(CSS.supports(rule), expected, 'CSS.supports(' + rule + ')');
- }, desc);
- }
-
- // Basic at-rule support.
- test_supports("at-rule(@supports)", true);
- test_supports("at-rule( @supports)", true);
- test_supports("at-rule(@supports )", true);
- test_supports("at-rule(@media)", true);
- test_supports("at-rule(@counter-style)", true);
- test_supports("at-rule(@doesnotexist)", false);
-
- // With descriptors.
- test_supports("at-rule(@counter-style; system: fixed)", true);
- test_supports("at-rule(@counter-style;system: fixed )", true);
- test_supports("at-rule(@counter-style;system: fixed )", true);
- test_supports("at-rule(@counter-style; system:)", false, "missing value 1");
- test_supports("at-rule(@counter-style; system: )", false, "missing value 2");
- test_supports("at-rule(@counter-style; system: doesnotexist)", false, "invalid value");
- test_supports("at-rule(@counter-style; system: fixed junk)", false, "junk after value");
- test_supports("at-rule(@counter-style; system)", false, "missing value 3");
- test_supports("at-rule(@counter-style! system: fixed)", false, "invalid separator");
- test_supports("at-rule(@counter-style; suffix: \"abc\")", true, "quoted value is OK");
- test_supports("at-rule(@counter-style; suffix: \"abc\";)", false, "semicolon after value");
- test_supports("at-rule(@counter-style; suffix: \"abc\"", true, "implicit end parenthesis");
- test_supports("at-rule(@counter-style; system: fixed; system: fixed)", false, "multiple descriptors");
- test_supports("at-rule(@supports; system: fixed)", false, "descriptor invalid in context");
-
- // Properties are not descriptors.
- test_supports("at-rule(@supports; color: red)", false);
- test_supports("at-rule(@media; color: red)", false);
- test_supports("at-rule(@counter-style; color: red)", false);
- test_supports("at-rule(@font-fact; color: red)", false);
- test_supports("at-rule(@property; color: red)", false);
- test_supports("at-rule(@font-palette-values; color: red)", false);
- test_supports("at-rule(@view-transition; color: red)", false);
-
- // More descriptors.
- test_supports("at-rule(@font-face; font-family: 'Ariana Grande')", true);
- test_supports("at-rule(@font-face; font-style: italic)", true);
- test_supports("at-rule(@font-face; font-weight: normal)", true);
- test_supports("at-rule(@font-face; font-feature-settings: \"kern\" 1)", true);
- test_supports("at-rule(@font-face; font-display: swap)", true);
- test_supports("at-rule(@font-face; font-variant: small-caps)", true);
- test_supports("at-rule(@font-face; src: url(/foo.ttf))", true);
- test_supports("at-rule(@font-face; unicode-range: U+41-5A)", true);
- test_supports("at-rule(@font-face; ascent-override: 80%)", true);
- test_supports("at-rule(@font-face; descent-override: 20%)", true);
- test_supports("at-rule(@font-face; line-gap-override: normal)", true);
- test_supports("at-rule(@font-face; size-adjust: 150%)", true);
- test_supports("at-rule(@property; syntax: \"*\")", true);
- test_supports("at-rule(@property; syntax: \"<unknown>\")", false);
- test_supports("at-rule(@property; initial-value: #fff)", true);
- test_supports("at-rule(@property; inherits: true)", true);
- test_supports("at-rule(@counter-style; system: extends upper-roman)", true);
- test_supports("at-rule(@counter-style; negative: '(' ')'", true);
- test_supports("at-rule(@counter-style; prefix: \"a\")", true);
- test_supports("at-rule(@counter-style; suffix: \"b\")", true);
- test_supports("at-rule(@counter-style; range: infinite infinite", true);
- test_supports("at-rule(@counter-style; pad: 3 '0')", true);
- test_supports("at-rule(@counter-style; fallback: foo)", true);
- test_supports("at-rule(@counter-style; symbols: 'X')", true);
- test_supports("at-rule(@counter-style; additive-symbols: 1 'I', calc(-1) 'X')", true);
- test_supports("at-rule(@counter-style; speak-as: words)", true);
- test_supports("at-rule(@font-palette-values; font-family: 'Fontfontfont')", true);
- test_supports("at-rule(@font-palette-values; base-palette: 7)", true);
- test_supports("at-rule(@font-palette-values; override-colors: 3 blue, 1 brown)", true);
- test_supports("at-rule(@view-transition; navigation: auto)", true);
- test_supports("at-rule(@view-transition; types: check)", true);
-
- // TODO: Should we include e.g. @page; page-orientation?
-</script>