Skip to content

Commit 9c72d75

Browse files
committed
Bug 1950096 [wpt PR 50907] - [functions] Let parameter defaults reference other parameters, a=testonly
Automatic update from web-platform-tests [functions] Let parameter defaults reference other parameters Per "evaluate a custom function" [1], the default value of a parameter may "see" other parameters, e.g. function --f(--x, --y:var(--x)). Before this CL, that var(--x) would resolve in the outer scope, but now it's supposed to resolve against the actual argument value passed for --x. At the same time, default values should not have access to the actual *locals* of the function body, meaning that they resolve in some gray area *between* the outer scope and inner scope. In this CL, that "gray area" is implemented by using a disposable FunctionContext with the unresolved defaults set as the unresolved locals. This is convenient, because we get all the needed "dependency handling" (including cycle detection) for free. Since various things now need to parse against a type (arguments, defaults, and the 'result' descriptor), and because these various things differ in how they are represented (some CSSVariableData, some StringView), this CL aligns all of those things to use CSSVariableData, and adjusts ResolveFunctionExpression accordingly. This would be needed anyway, to actually transport various tainting information, though that is not explicit handled/tested in this CL. Finally, note that there is a drive-by fix in this CL: the "already applied" branch of ApplyLocalVariables now actually skips the work if it's already applied. This should ideally have a performance test, which is tracked as a follow-up task (Issue 397164440). [1] https://drafts.csswg.org/css-mixins-1/#evaluate-a-custom-function Fixed: 397459622 Bug: 325504770, 397164440 Change-Id: Ic705209d25f4bee6149f2397bda78e1224b16901 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276516 Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org> Reviewed-by: Steinar H Gunderson <sessechromium.org> Cr-Commit-Position: refs/heads/main{#1423855} -- wpt-commits: b5045d03a5a6963f8af68d403e24bb325f2ce2e6 wpt-pr: 50907 UltraBlame original commit: dc2d690887ee4c501ace605d59beda6f7c8f6e6f
1 parent 7250d7c commit 9c72d75

File tree

2 files changed

+1016
-170
lines changed

2 files changed

+1016
-170
lines changed

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

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,200 @@
20622062
template
20632063
>
20642064
<
2065+
template
2066+
data
2067+
-
2068+
name
2069+
=
2070+
"
2071+
Function
2072+
in
2073+
a
2074+
cycle
2075+
with
2076+
its
2077+
own
2078+
default
2079+
"
2080+
>
2081+
<
2082+
style
2083+
>
2084+
function
2085+
-
2086+
-
2087+
f
2088+
(
2089+
-
2090+
-
2091+
x
2092+
-
2093+
-
2094+
y
2095+
:
2096+
-
2097+
-
2098+
f
2099+
(
2100+
13px
2101+
)
2102+
)
2103+
{
2104+
result
2105+
:
2106+
10px
2107+
;
2108+
}
2109+
#
2110+
target
2111+
{
2112+
-
2113+
-
2114+
tmp
2115+
:
2116+
-
2117+
-
2118+
f
2119+
(
2120+
42px
2121+
)
2122+
;
2123+
-
2124+
-
2125+
actual
2126+
:
2127+
var
2128+
(
2129+
-
2130+
-
2131+
tmp
2132+
PASS
2133+
)
2134+
;
2135+
-
2136+
-
2137+
expected
2138+
:
2139+
PASS
2140+
;
2141+
}
2142+
<
2143+
/
2144+
style
2145+
>
2146+
<
2147+
/
2148+
template
2149+
>
2150+
<
2151+
template
2152+
data
2153+
-
2154+
name
2155+
=
2156+
"
2157+
Cyclic
2158+
defaults
2159+
"
2160+
>
2161+
<
2162+
style
2163+
>
2164+
function
2165+
-
2166+
-
2167+
f
2168+
(
2169+
-
2170+
-
2171+
x
2172+
-
2173+
-
2174+
y
2175+
:
2176+
var
2177+
(
2178+
-
2179+
-
2180+
z
2181+
)
2182+
-
2183+
-
2184+
z
2185+
:
2186+
var
2187+
(
2188+
-
2189+
-
2190+
y
2191+
)
2192+
)
2193+
{
2194+
result
2195+
:
2196+
var
2197+
(
2198+
-
2199+
-
2200+
x
2201+
FAIL
2202+
)
2203+
var
2204+
(
2205+
-
2206+
-
2207+
y
2208+
PASS
2209+
-
2210+
y
2211+
)
2212+
var
2213+
(
2214+
-
2215+
-
2216+
z
2217+
PASS
2218+
-
2219+
z
2220+
)
2221+
;
2222+
}
2223+
#
2224+
target
2225+
{
2226+
-
2227+
-
2228+
actual
2229+
:
2230+
-
2231+
-
2232+
f
2233+
(
2234+
42px
2235+
)
2236+
;
2237+
-
2238+
-
2239+
expected
2240+
:
2241+
42px
2242+
PASS
2243+
-
2244+
y
2245+
PASS
2246+
-
2247+
z
2248+
;
2249+
}
2250+
<
2251+
/
2252+
style
2253+
>
2254+
<
2255+
/
2256+
template
2257+
>
2258+
<
20652259
script
20662260
>
20672261
test_all_templates

0 commit comments

Comments
 (0)