Skip to content

Commit 6f575f5

Browse files
xiaochenghmoz-wptsync-bot
authored andcommitted
Bug 1734939 [wpt PR 31169] - [@layer] Change layer order from preorder to postorder, a=testonly
Automatic update from web-platform-tests [@layer] Change layer order from preorder to postorder This patch follows from a recent CSSWG resolution [1] that puts the default layer at the highest priority, and a subsequent spec edit [2] that changed the layer ordering from the preorder of the layer tree to the postorder. Most test changes just reflect this spec change. In some WPT tests, rule ordering is swapping so that the winning rule will appear first, so that we can verify layer is working. external/wpt/css/css-cascade/presentational-hints-cascade.html is moved from the stable test suite to a new disable-custom-element-default-style virtual test suite because this is the flag that actually makes the test result different on test and stable builds. We need to disable this flag while keeping cascade layers enabled to test the new test case in the file. [1] w3c/csswg-drafts#6284 (comment) [2] w3c/csswg-drafts@a6fc16e Fixed: 1257936 Change-Id: I899de8c8a921b0535296957ee1b0cca1f60a8c61 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3214603 Reviewed-by: Anders Hartvoll Ruud Reviewed-by: Xianzhu Wang Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#930689} -- wpt-commits: fd7a9e9a139e01cd5017b57b8d3123d3a9a1a7bb wpt-pr: 31169
1 parent e172990 commit 6f575f5

8 files changed

+61
-50
lines changed

testing/web-platform/tests/css/css-cascade/layer-basic.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656
title: 'A5 Anonymous layers',
5757
style: `
5858
@layer {
59-
target { color: red; }
59+
target { color: green; }
6060
@layer {
61-
target { color: green; }
61+
target { color: red; }
6262
}
6363
}
6464
`,
@@ -68,9 +68,9 @@
6868
style: `
6969
@layer {
7070
@layer {
71-
target { color: green; }
71+
target { color: red; }
7272
}
73-
target { color: red; }
73+
target { color: green; }
7474
}
7575
`,
7676
},
@@ -85,9 +85,9 @@
8585
}
8686
@layer {
8787
@layer {
88-
target { color: green; }
88+
target { color: red; }
8989
}
90-
target { color: red; }
90+
target { color: green; }
9191
}
9292
`,
9393
},
@@ -104,9 +104,9 @@
104104
}
105105
@layer {
106106
@layer {
107-
target { color: green; }
107+
target { color: red; }
108108
}
109-
target { color: red; }
109+
target { color: green; }
110110
}
111111
`,
112112
},
@@ -122,10 +122,10 @@
122122
@layer {
123123
@layer {
124124
@layer {
125-
target { color: green; }
125+
target { color: red; }
126126
}
127127
}
128-
target { color: red; }
128+
target { color: green; }
129129
}
130130
`,
131131
},
@@ -175,9 +175,9 @@
175175
title: 'B5 Named layers',
176176
style: `
177177
@layer A {
178-
target { color: red; }
178+
target { color: green; }
179179
@layer A {
180-
target { color: green; }
180+
target { color: red; }
181181
}
182182
}
183183
`,
@@ -362,11 +362,11 @@
362362
style: `
363363
@layer A {
364364
@layer {
365-
target { color: green; }
365+
target { color: red; }
366366
}
367367
}
368368
@layer A {
369-
target { color: red; }
369+
target { color: green; }
370370
}
371371
`,
372372
},

testing/web-platform/tests/css/css-cascade/layer-counter-style-override.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@
3535

3636
const testCases = [
3737
{
38-
title: '@counter-style layered overrides unlayered',
38+
title: '@counter-style unlayered overrides layered',
3939
style: `
4040
#target::before {
4141
content: counter(dont-care, custom-counter-style);
4242
}
4343
44+
@counter-style custom-counter-style {
45+
system: extends four;
46+
}
47+
4448
@layer {
4549
@counter-style custom-counter-style {
46-
system: extends four;
50+
system: extends three;
4751
}
4852
}
49-
50-
@counter-style custom-counter-style {
51-
system: extends three;
52-
}
5353
`
5454
},
5555

testing/web-platform/tests/css/css-cascade/layer-font-face-override.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
font-family: custom-font;
2525
}
2626
27+
@font-face {
28+
font-family: custom-font;
29+
src: url('/fonts/Ahem.ttf');
30+
}
31+
2732
@layer {
2833
@font-face {
2934
font-family: custom-font;
3035
src: url('/fonts/noto/noto-sans-v8-latin-regular.woff') format('woff');
3136
}
3237
}
33-
34-
@font-face {
35-
font-family: custom-font;
36-
src: url('/fonts/Ahem.ttf');
37-
}
3838
`
3939
},
4040

testing/web-platform/tests/css/css-cascade/layer-import.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@
145145
{
146146
title: 'C4 Named imports',
147147
style: `
148-
@import url(layer-green.css) layer(A);
148+
@import url(layer-red.css) layer(A);
149149
@layer A {
150-
target { color: red; }
150+
target { color: green; }
151151
}
152152
`
153153
},
@@ -192,8 +192,8 @@
192192
title: 'C9 Named imports',
193193
style: `
194194
@import url(basic-red.css) layer(A);
195-
@import url(basic-green.css) layer(B.A);
196-
@import url(basic-red.css) layer(B);
195+
@import url(basic-red.css) layer(B.A);
196+
@import url(basic-green.css) layer(B);
197197
`
198198
},
199199
{

testing/web-platform/tests/css/css-cascade/layer-keyframes-override.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
animation: anim 1s paused;
3030
}
3131
32+
@keyframes anim {
33+
from { background-color: green; }
34+
}
35+
3236
@layer {
3337
@keyframes anim {
3438
from { background-color: red; }
3539
}
3640
}
37-
38-
@keyframes anim {
39-
from { background-color: green; }
40-
}
4141
`
4242
},
4343

testing/web-platform/tests/css/css-cascade/layer-property-override.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@
2323

2424
const testCases = [
2525
{
26-
title: '@property layered overrides unlayered',
26+
title: '@property unlayered overrides layered',
2727
style: `
2828
#target {
2929
background-color: var(--foo);
3030
}
3131
32+
@property --foo {
33+
syntax: '';
34+
inherits: false;
35+
initial-value: green;
36+
}
37+
3238
@layer {
3339
@property --foo {
3440
syntax: '';
3541
inherits: false;
36-
initial-value: green;
42+
initial-value: red;
3743
}
3844
}
39-
40-
@property --foo {
41-
syntax: '';
42-
inherits: false;
43-
initial-value: red;
44-
}
45-
`
45+
`
4646
},
4747

4848
{

testing/web-platform/tests/css/css-cascade/layer-scroll-timeline-override.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,25 @@
4646

4747
const testCases = [
4848
{
49-
title: '@scroll-timeline layered overrides unlayered',
49+
title: '@scroll-timeline unlayered overrides layered',
5050
style: `
5151
#target {
5252
animation-timeline: timeline;
5353
}
5454
55+
@scroll-timeline timeline {
56+
source: selector(#scroller);
57+
start: 0px;
58+
end: 50px;
59+
}
60+
5561
@layer {
5662
@scroll-timeline timeline {
5763
source: selector(#scroller);
5864
start: 0px;
59-
end: 50px;
65+
end: 100px;
6066
}
6167
}
62-
63-
@scroll-timeline timeline {
64-
source: selector(#scroller);
65-
start: 0px;
66-
end: 100px;
67-
}
6868
`
6969
},
7070

testing/web-platform/tests/css/css-cascade/presentational-hints-cascade.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,17 @@
1212
#target1 {
1313
width: 100px;
1414
}
15+
16+
@layer {
17+
#target3 {
18+
width: 100px;
19+
}
20+
}
1521
style>
1622

1723
<img class=test id=target1 width=200>
1824
<img class=test id=target2 width=200 style="width: 100px">
25+
<img class=test id=target3 width=200>
1926

2027
<script>
2128
test(() => {
@@ -25,4 +32,8 @@
2532
test(() => {
2633
assert_equals(getComputedStyle(target2).width, '100px');
2734
}, 'Presentational hints have lower precedence than the style attribute');
35+
36+
test(() => {
37+
assert_equals(getComputedStyle(target3).width, '100px');
38+
}, 'Presentational hints have lower precedence than layered style');
2839
script>

0 commit comments

Comments
 (0)