Skip to content

Commit 5974e94

Browse files
andruudmoz-wptsync-bot
authored andcommitted
Bug 1950076 [wpt PR 50903] - [functions] Parameters with defaults need not be trailing (WPT), a=testonly
Automatic update from web-platform-tests [functions] Parameters with defaults need not be trailing (WPT) It's syntactically valid to define a function where a parameter without a default appears after a parameter with a default, for example: @function --foo(--x:1px, --y, --z:2px) { ... } There is currently no way to actually invoke such a function while making use of the non-trailing defaults, but apparently this may change in the future if we rework how IACVT works for arguments. Invoking --foo(var(--unknown), 42px) would make the containing declaration invalid at computed-value time, but in the future the argument may "capture" this invalid state, and instead trigger the default. Bug: 389974127 Change-Id: I8d7c41bde2401ac89ec0a011f098e6051772f7b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6281007 Commit-Queue: Anders Hartvoll Ruud <[email protected]> Reviewed-by: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1423827} -- wpt-commits: f2615dc6260757b8eb634d19383184031c6e7022 wpt-pr: 50903
1 parent 4bfcb7d commit 5974e94

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

testing/web-platform/tests/css/css-mixins/at-function-parsing.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
test_valid_prelude('@function --foo(--x, --y <length>: 10px)');
6666
test_valid_prelude('@function --foo(--x type(<length> | auto): auto)');
6767
test_valid_prelude('@function --foo(--x type(<length> | auto) : auto)');
68+
// A parameter without a default may appear after a parameter with
69+
// a default, even though there's no way to actually call --foo()
70+
// with just --y:
71+
test_valid_prelude('@function --foo(--x:1px, --y, --z:2px)');
6872
// The value does not have to match the type during @function parsing:
6973
test_valid_prelude('@function --foo(--x <angle>: 10px)');
7074

testing/web-platform/tests/css/css-mixins/dashed-function-eval.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,20 @@
678678
</style>
679679
</template>
680680

681+
<template data-name="Unknown var() in argument makes declaration IACVT">
682+
<!-- Note: In the future, this may be changed to instead trigger
683+
the default for --x. -->
684+
<style>
685+
@function --f(--x:1px) {
686+
result: var(--x);
687+
}
688+
#target {
689+
--actual: --f(var(--unknown));
690+
/* --expected: <guaranteed-invalid> */
691+
}
692+
</style>
693+
</template>
694+
681695
<!--
682696
{}-wrappers.
683697

0 commit comments

Comments
 (0)