Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c32254dca34ad0f86962bcb81d101e368a6b1647
      
https://github.com/WebKit/WebKit/commit/c32254dca34ad0f86962bcb81d101e368a6b1647
  Author: Antti Koivisto <[email protected]>
  Date:   2026-09-02 (Wed, 02 Sep 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-mixins/functions/function-parameter-types.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-in-custom-function.tentative-expected.txt
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleLocalPropertyRegistry.cpp
    M Source/WebCore/style/StyleLocalPropertyRegistry.h
    M Source/WebCore/style/StyleSubstitutionResolver.cpp

  Log Message:
  -----------
  [css-mixins-1] A typed function parameter should keep its type
https://bugs.webkit.org/show_bug.cgi?id=323201
rdar://186439114

Reviewed by Alan Baradlay.

Per

https://github.com/w3c/csswg-drafts/issues/12315

something like

@function --f(--arg <color>) {
  result: if(
    style(--arg: red): 1;
    else: 2;
  );
}
--f(#f00) // red color

should return '1'.

The current implementation based on the spec text registers the parameters for 
result resolution as untyped.

Register them with the declared type instead. A body declaration assigning to 
the parameter name is then
computed against the type too, and style() compares computed values instead of 
token streams.

A parameter registration carries the type but is not an author registration, so 
a var() fallback for one
is no longer held to its syntax. Otherwise an invalid argument makes var(--arg, 
fallback) invalid instead
of using the fallback.

Also fix inheritance of the properties from calling context in nested function 
calls. LocalPropertyRegistry
chains to the enclosing frame, so a typed name keeps its type when a function 
is called from a function
body. Finding a registration and deciding which frame owns a name are separate 
now: get() chains,
declares() does not. applyCustomPropertyFromCallingContext uses declares(), 
since a name owned by an outer
frame is inherited from the calling context rather than resolved to its initial 
value.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-mixins/functions/function-parameter-types.tentative-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-in-custom-function.tentative-expected.txt:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyCustomPropertyFromCallingContext):
* Source/WebCore/style/StyleLocalPropertyRegistry.cpp:
(WebCore::Style::LocalPropertyRegistry::get const):
(WebCore::Style::LocalPropertyRegistry::declares const):
* Source/WebCore/style/StyleLocalPropertyRegistry.h:
(WebCore::Style::LocalPropertyRegistry::LocalPropertyRegistry):
* Source/WebCore/style/StyleSubstitutionResolver.cpp:
(WebCore::Style::SubstitutionResolver::substituteNamedValueOrFallback):
(WebCore::Style::SubstitutionResolver::resolveAndRegisterDashedFunctionArguments):
(WebCore::Style::SubstitutionResolver::substituteDashedFunction):

Canonical link: https://commits.webkit.org/320340@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to