mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb/CSS: Implement env() as an arbitrary substitution function
Technically, env() should not be an ASF. (😱) This is why some tests
still fail - env() as specced is expected to have its syntax checked
fully at parse-time, whereas ASFs are not properly syntax-checked until
later. However, I think this approach was worth doing for a few reasons:
- env() behaves like an ASF otherwise. (It is replaced with a set of
arbitrary component-values that are not known until computed-value
time.)
- env() was defined before the ASF concept existed, so I strongly
suspect it will be updated in the future to match that definition,
with a couple of adjustments. (eg, env() is allowed in some extra
places compared to var() and attr().)
- This was much quicker and easier to implement (under 3 hours in total)
compared to the greater amount of work to implement a whole separate
system just for env().
- Most of these tests are marked tentative, and the spec definition of
env() is still somewhat in flux, so failing some is not a huge deal.
If in the future I turn out to be wrong on this, we can convert it to
its own special thing.
This commit is contained in:
committed by
Alexander Kalenik
parent
22e00451b9
commit
89b59cb5c3
Notes:
github-actions[bot]
2025-08-07 14:41:43 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/89b59cb5c37 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5736 Reviewed-by: https://github.com/kalenikaliaksandr
@@ -2,23 +2,23 @@ Harness status: OK
|
||||
|
||||
Found 18 tests
|
||||
|
||||
4 Pass
|
||||
14 Fail
|
||||
15 Pass
|
||||
3 Fail
|
||||
Pass rgb(0, 128, 0)
|
||||
Fail background-color: env(test) rgba(0, 0, 0, 0)
|
||||
Fail background-color: ENV(test) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(test) !important rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(test, 10px) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(test, blue) rgb(0, 0, 255)
|
||||
Fail background-color: env(test, env(another)) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(test, env(another, blue)) rgb(0, 0, 255)
|
||||
Fail background-color: env(-test) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(--test) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(10px) rgb(0, 128, 0)
|
||||
Pass background-color: env(env(test)) rgb(0, 128, 0)
|
||||
Fail background-color: env( test) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(test ) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env( test ) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(test /**/, blue) rgb(0, 0, 255)
|
||||
Fail background-color: env(test, {}) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(test, {) rgb(0, 128, 0)
|
||||
Pass background-color: env(test) rgba(0, 0, 0, 0)
|
||||
Pass background-color: ENV(test) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(test) !important rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(test, 10px) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(test, blue) rgb(0, 0, 255)
|
||||
Pass background-color: env(test, env(another)) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(test, env(another, blue)) rgb(0, 0, 255)
|
||||
Pass background-color: env(-test) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(--test) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(10px) rgb(0, 128, 0)
|
||||
Fail background-color: env(env(test)) rgb(0, 128, 0)
|
||||
Pass background-color: env( test) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(test ) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env( test ) rgba(0, 0, 0, 0)
|
||||
Pass background-color: env(test /**/, blue) rgb(0, 0, 255)
|
||||
Pass background-color: env(test, {}) rgba(0, 0, 0, 0)
|
||||
Fail background-color: env(test, {) rgb(0, 128, 0)
|
||||
Reference in New Issue
Block a user