Skip to content

Commit

Permalink
Bug 1839141 [wpt PR 40616] - [css-nesting] Support nested layer rules…
Browse files Browse the repository at this point in the history
…, a=testonly

Automatic update from web-platform-tests
[css-nesting] Support nested layer rules

This CL adds support for nested layer rules, using the same boilerplate
we use for other rules (media, etc).

This was not part of the initial release of css-nesting, because it was
added to the specification too late in the process. However, the intent
of the spec is to allow nesting of all at-rules that contain style rules
in their body [1].

Renamed AllowedRulesType::kConditionalGroupRules to kNestedGroupRules,
since it's not just conditional rules that are allowed to nest anymore.

[1] https://drafts.csswg.org/css-nesting/#nested-group-rules

Fixed: 1455887
Bug: 1451088
Change-Id: I76a9463442bec3e7e6425ddc851ddbf14690604b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4624568
Reviewed-by: Steinar H Gunderson <sessechromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruudchromium.org>
Cr-Commit-Position: refs/heads/main{#1160192}

--

wpt-commits: ac7d2531184610cced5432fdcfdf2564ab54f053
wpt-pr: 40616

UltraBlame original commit: 5c64c9dbf0a130ad4d691b76672df783b0a9abc4
  • Loading branch information
marco-c committed Jul 1, 2023
1 parent 945410c commit 1340e39
Showing 1 changed file with 335 additions and 0 deletions.
335 changes: 335 additions & 0 deletions testing/web-platform/tests/css/css-nesting/nesting-layer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
<
!
DOCTYPE
html
>
<
title
>
Nested
layers
<
/
title
>
<
link
rel
=
"
help
"
href
=
"
https
:
/
/
drafts
.
csswg
.
org
/
css
-
nesting
/
#
nested
-
group
-
rules
"
>
<
link
rel
=
"
help
"
href
=
"
https
:
/
/
drafts
.
csswg
.
org
/
css
-
cascade
-
5
/
#
layering
"
>
<
script
src
=
"
/
resources
/
testharness
.
js
"
>
<
/
script
>
<
script
src
=
"
/
resources
/
testharnessreport
.
js
"
>
<
/
script
>
<
style
>
.
a
{
/
*
This
should
have
no
effect
.
Only
at
-
rules
containing
style
rules
are
vaild
when
nested
.
*
/
layer
theme
base
;
}
/
*
The
theme
layer
wins
over
the
base
layer
.
*
/
layer
base
theme
;
.
a
{
layer
theme
{
&
{
z
-
index
:
1
;
}
.
b
{
background
-
color
:
green
;
}
}
}
layer
base
{
.
a
{
z
-
index
:
0
;
}
.
a
.
b
{
background
-
color
:
red
;
}
}
<
/
style
>
<
main
>
<
div
class
=
"
a
"
>
<
div
class
=
"
b
"
>
<
/
div
>
<
/
div
>
<
/
main
>
<
script
>
test
(
(
)
=
>
{
let
a
=
document
.
querySelector
(
"
main
>
.
a
"
)
;
let
b
=
document
.
querySelector
(
"
main
>
.
a
>
.
b
"
)
;
assert_equals
(
getComputedStyle
(
a
)
.
zIndex
"
1
"
)
;
assert_equals
(
getComputedStyle
(
b
)
.
backgroundColor
"
rgb
(
0
128
0
)
"
)
;
}
'
layer
can
be
nested
'
)
;
<
/
script
>

0 comments on commit 1340e39

Please sign in to comment.