Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/alignment/parse-alignment-of-root-elements.html

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed repaint tests. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <html>
4 <body>
5 <div id="host">
6 <div id="slotted" slot="s1"></div>
7 </div>
8 <script src="resources/alignment-parsing-utils.js"></script>
9 <script>
10 description('Test to verify auto value resolution works as expected in root elem ents (eg. document root / shadow roots / slotted elements / elements inside<slot >)');
11
12 var block = document.getElementById("host");
13
14 debug("");
15 debug("*** Test 'auto' value resolution for the document root node. ***");
16
17 debug("");
18 debug("Check out how the DOM's root element resolves the align-self 'auto' value s.");
19 document.documentElement.style.alignSelf = "center";
20 checkValues(document.documentElement, "alignSelf", "align-self", "center", "cent er");
21 document.documentElement.style.alignSelf = "auto";
22 checkValues(document.documentElement, "alignSelf", "align-self", "auto", "normal ");
23
24 debug("");
25 debug("Check out how the DOM's root element align-items's value is used to resol ve its children's align-self 'auto' values.");
26 document.documentElement.style.alignItems = "center";
27 checkValues(document.documentElement, "alignItems", "align-items", "center", "ce nter");
28 document.body.style.alignItems = "auto"; // The 'auto' value is not valid for al ign-items.
29 document.body.style.alignSelf = "auto";
30 checkValues(document.body, "alignItems", "align-items", "", "normal");
31 checkValues(document.body, "alignSelf", "align-self", "auto", "center");
32 block.style.alignItems = ""; // Default value is 'normal' for align-items.
33 block.style.alignSelf = "auto";
34 checkValues(block, "alignItems", "align-items", "", "normal");
35 checkValues(block, "alignSelf", "align-self", "auto", "normal");
36
37 debug("");
38 debug("Check out how the DOM's root element deals with 'auto' value in align-ite ms.");
39 document.documentElement.style.alignItems = "auto"; // The 'auto' value is not v alid for align-items.
40 checkValues(document.documentElement, "alignItems", "align-items", "center", "ce nter");
41 document.documentElement.style.alignItems = ""; // Default value is 'normal' for align-items.
42 checkValues(document.documentElement, "alignItems", "align-items", "", "normal") ;
43
44 debug("");
45 debug("Check out how the DOM's root element resolves the justify-self 'auto' val ues.");
46 document.documentElement.style.justifySelf = "left";
47 checkValues(document.documentElement, "justifySelf", "justify-self", "left", "le ft");
48 document.documentElement.style.justifySelf = "auto";
49 checkValues(document.documentElement, "justifySelf", "justify-self", "auto", "no rmal");
50
51 debug("");
52 debug("Check out how the DOM's root element align-items's value is used to resol ve its children's align-self 'auto' values.");
53 document.documentElement.style.justifyItems = "center";
54 checkValues(document.documentElement, "justifyItems", "justify-items", "center", "center");
55 document.body.style.justifyItems = "auto";
56 document.body.style.justifySelf = "auto";
57 checkValues(document.body, "justifyItems", "justify-items", "auto", "normal");
58 checkValues(document.body, "justifySelf", "justify-self", "auto", "center");
59 block.style.justifyItems = "auto";
60 block.style.justifySelf = "auto";
61 checkValues(block, "justifyItems", "justify-items", "auto", "normal");
62 checkValues(block, "justifySelf", "justify-self", "auto", "normal");
63
64 debug("");
65 debug("Check out how the DOM's root element deals with 'auto' value in justify-i tems.");
66 document.documentElement.style.justifyItems = "auto";
67 checkValues(document.documentElement, "justifyItems", "justify-items", "auto", " normal");
68 checkValues(document.body, "justifySelf", "justify-self", "auto", "normal");
69 checkValues(block, "justifySelf", "justify-self", "auto", "normal");
70
71 debug("");
72 debug("Check out how the DOM's root element justify-items's value with 'legacy' keyword is used to resolve any descendant's justify-items 'auto' values.");
73 document.documentElement.style.justifyItems = "legacy center";
74 checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
75 document.body.style.justifyItems = "auto";
76 document.body.style.justifySelf = "auto";
77 checkValues(document.body, "justifyItems", "justify-items", "auto", "legacy cen ter");
78 checkValues(document.body, "justifySelf", "justify-self", "auto", "center");
79 block.style.justifyItems = "auto";
80 block.style.justifySelf = "auto";
81 checkValues(block, "justifyItems", "justify-items", "auto", "legacy center");
82 checkValues(block, "justifySelf", "justify-self", "auto", "center");
83
84 debug("");
85 debug("Check out how the DOM's root element recomputes its descendant's style wh en 'legacy' keyword is removed from its justify-items value.");
86 document.documentElement.style.justifyItems = "auto";
87 checkValues(document.body, "justifyItems", "justify-items", "auto", "normal");
88 checkValues(document.body, "justifySelf", "justify-self", "auto", "normal");
89 checkValues(block, "justifyItems", "justify-items", "auto", "normal");
90 checkValues(block, "justifySelf", "justify-self", "auto", "normal");
91
92 debug("");
93 debug("*** Test 'auto' value resolution for the shadow DOM root node. ***");
94
95 var shadowHost = document.getElementById("host")
96 var shadowRoot = shadowHost.attachShadow({mode:"open"});
97 var shadowNode = document.createElement('div');
98 shadowRoot.appendChild(shadowNode);
99
100 debug("");
101 debug("Shadow Node inherits from ShadowHost to resolve the 'auto' values.");
102
103 shadowHost.style.alignItems = "center";
104 shadowNode.style.alignItems = "right";
105
106 checkValues(shadowHost, "alignItems", "align-items", "center", "center");
107 checkValues(shadowNode, "alignItems", "align-items", "right", "right");
108 shadowNode.style.alignItems = "";
109 checkValues(shadowNode, "alignItems", "align-items", "", "normal");
110 shadowNode.style.alignSelf = "auto";
111 checkValues(shadowNode, "alignSelf", "align-self", "auto", "center");
112
113 shadowHost.style.justifyItems = "center";
114 shadowNode.style.justifyItems = "right";
115
116 checkValues(shadowHost, "justifyItems", "justify-items", "center", "center");
117 checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
118 shadowNode.style.justifyItems = "";
119 checkValues(shadowNode, "justifyItems", "justify-items", "", "normal");
120 shadowNode.style.justifySelf = "auto";
121 checkValues(shadowNode, "justifySelf", "justify-self", "auto", "center");
122
123 debug("");
124 debug("Check out how the 'legacy' keyword from propagates from the DOM Tree to t he Shadow Node.");
125
126 shadowHost.style.justifyItems = "auto";
127 shadowNode.style.justifyItems = "right";
128 shadowNode.style.justifySelf = "auto";
129 checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
130 checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
131 checkValues(shadowNode, "justifySelf", "justify-self", "auto", "normal");
132
133 checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
134 document.documentElement.style.justifyItems = "legacy center";
135 checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
136 checkValues(shadowHost, "justifyItems", "justify-items", "auto", "legacy center ");
137 checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
138 checkValues(shadowNode, "justifySelf", "justify-self", "auto", "center");
139 shadowNode.style.justifyItems = "auto";
140 checkValues(shadowNode, "justifyItems", "justify-items", "auto", "legacy center" );
141 document.documentElement.style.justifyItems = "auto";
142
143 debug("");
144 debug("*** Test 'auto' value resolution for the shadow DOM 'slotted' elements. * **");
145
146 var slotted = document.getElementById("slotted");
147
148 debug("");
149 debug("The 'slotted' element's parent is 'shadowHost' while 'slot' is not assign ed.")
150
151 shadowHost.style.alignItems = "center";
152 shadowNode.style.alignItems = "right";
153
154 slotted.style.alignItems = "left";
155 checkValues(slotted, "alignItems", "align-items", "left", "left");
156 slotted.style.alignItems = "";
157 checkValues(slotted, "alignItems", "align-items", "", "normal");
158 slotted.style.alignSelf = "start";
159 checkValues(slotted, "alignSelf", "align-self", "start", "start");
160 slotted.style.alignSelf = "auto";
161 checkValues(slotted, "alignSelf", "align-self", "auto", "center");
162
163 shadowHost.style.justifyItems = "center";
164 shadowNode.style.justifyItems = "right";
165
166 slotted.style.justifyItems = "left";
167 checkValues(slotted, "justifyItems", "justify-items", "left", "left");
168 slotted.style.justifyItems = "";
169 checkValues(slotted, "justifyItems", "justify-items", "", "normal");
170 slotted.style.justifySelf = "start";
171 checkValues(slotted, "justifySelf", "justify-self", "start", "start");
172 slotted.style.justifySelf = "auto";
173 checkValues(slotted, "justifySelf", "justify-self", "auto", "center");
174
175 debug("");
176 debug("Check out how the 'legacy' keyword affects the 'slotted' elements while ' slot' is not assigned.");
177
178 shadowHost.style.justifyItems = "auto";
179 shadowNode.style.justifyItems = "right";
180
181 checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
182 checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
183 document.documentElement.style.justifyItems = "legacy center";
184 checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
185 checkValues(shadowHost, "justifyItems", "justify-items", "auto", "legacy center ");
186 slotted.style.justifyItems = "auto";
187 checkValues(slotted, "justifyItems", "justify-items", "auto", "legacy center");
188 slotted.style.justifySelf = "auto";
189 checkValues(slotted, "justifySelf", "justify-self", "auto", "center");
190 shadowNode.style.justifyItems = "auto";
191 checkValues(shadowNode, "justifyItems", "justify-items", "auto", "legacy center" );
192 checkValues(slotted, "justifyItems", "justify-items", "auto", "legacy center");
193 checkValues(slotted, "justifySelf", "justify-self", "auto", "center");
194 document.documentElement.style.justifyItems = "auto";
195
196 var slot = document.createElement('slot');
197 slot.setAttribute('name', 's1');
198 shadowNode.appendChild(slot);
199
200 debug("");
201 debug("The 'slotted' element uses the 'slot' element's parent (Shadow Node) afte r the 'slot' is assigned.");
202
203 shadowHost.style.alignItems = "center";
204 shadowNode.style.alignItems = "right";
205
206 slotted.style.alignItems = "left";
207 checkValues(slotted, "alignItems", "align-items", "left", "left");
208 slotted.style.alignItems = "";
209 checkValues(slotted, "alignItems", "align-items", "", "normal");
210 slotted.style.alignSelf = "start";
211 checkValues(slotted, "alignSelf", "align-self", "start", "start");
212 slotted.style.alignSelf = "auto";
213 checkValues(slotted, "alignSelf", "align-self", "auto", "right");
214
215 shadowHost.style.justifyItems = "center";
216 shadowNode.style.justifyItems = "right";
217
218 slotted.style.justifyItems = "left";
219 checkValues(slotted, "justifyItems", "justify-items", "left", "left");
220 slotted.style.justifyItems = "";
221 checkValues(slotted, "justifyItems", "justify-items", "", "normal");
222 slotted.style.justifySelf = "start";
223 checkValues(slotted, "justifySelf", "justify-self", "start", "start");
224 slotted.style.justifySelf = "auto";
225 checkValues(slotted, "justifySelf", "justify-self", "auto", "right");
226
227 debug("");
228 debug("Check out how the 'legacy' keyword affects the 'slotted' elements after t he 'slot' is assigned.");
229
230 shadowHost.style.justifyItems = "auto";
231 shadowNode.style.justifyItems = "right";
232
233 checkValues(shadowHost, "justifyItems", "justify-items", "auto", "normal");
234 checkValues(shadowNode, "justifyItems", "justify-items", "right", "right");
235 document.documentElement.style.justifyItems = "legacy center";
236 checkValues(document.documentElement, "justifyItems", "justify-items", "legacy center", "legacy center");
237 checkValues(shadowHost, "justifyItems", "justify-items", "auto", "legacy center" );
238 slotted.style.justifyItems = "auto";
239 checkValues(slotted, "justifyItems", "justify-items", "auto", "normal"); // Shad ow host is not the parent now, but ShadowNode.
240 slotted.style.justifySelf = "auto";
241 checkValues(slotted, "justifySelf", "justify-self", "auto", "right"); // Shadow host is not the parent now, but ShadowNode.
242 shadowNode.style.justifyItems = "auto";
243 checkValues(shadowNode, "justifyItems", "justify-items", "auto", "legacy center" );
244 checkValues(slotted, "justifyItems", "justify-items", "auto", "legacy center"); // Now that shadowNode is auto, 'legacy' applies.
245 checkValues(slotted, "justifySelf", "justify-self", "auto", "center"); // Now th at shadowNode is auto, 'legacy' applies.
246 document.documentElement.style.justifyItems = "auto";
247
248 debug("");
249 debug("The 'slot' element uses its parent inside the ShadowDOM tree to resolve t he 'auto' values .");
250
251 shadowHost.style.alignItems = "center";
252 shadowNode.style.alignItems = "right";
253
254 slot.style.alignItems = "left";
255 checkValues(slot, "alignItems", "align-items", "left", "left");
256 slot.style.alignItems = "";
257 checkValues(slot, "alignItems", "align-items", "", "normal");
258
259 slot.style.alignSelf = "left";
260 checkValues(slot, "alignSelf", "align-self", "left", "left");
261 slot.style.alignSelf = "auto";
262 checkValues(slot, "alignSelf", "align-self", "auto", "right");
263
264 shadowHost.style.justifyItems = "center";
265 shadowNode.style.justifyItems = "right";
266
267 slot.style.justifyItems = "left";
268 checkValues(slot, "justifyItems", "justify-items", "left", "left");
269 slot.style.justifyItems = "auto";
270 checkValues(slot, "justifyItems", "justify-items", "auto", "normal");
271 slot.style.justifySelf = "left";
272 checkValues(slot, "justifySelf", "justify-self", "left", "left");
273 slot.style.justifySelf = "auto";
274 checkValues(slot, "justifySelf", "justify-self", "auto", "right");
275
276 </script>
277
278 </body>
279 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698