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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js

Issue 1675163002: Rename ComposedTree to FlatTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 4 years, 10 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
1 function createShadowRoot() 1 function createShadowRoot()
2 { 2 {
3 var children = Array.prototype.slice.call(arguments); 3 var children = Array.prototype.slice.call(arguments);
4 if ((children[0] instanceof Object) && !(children[0] instanceof Node)) 4 if ((children[0] instanceof Object) && !(children[0] instanceof Node))
5 return attachShadow.apply(null, children); 5 return attachShadow.apply(null, children);
6 return {'isShadowRoot': true, 6 return {'isShadowRoot': true,
7 'children': children}; 7 'children': children};
8 } 8 }
9 9
10 // TODO(kochi): This is not pure attachShadow wrapper, but also handles createSh adowRoot() 10 // TODO(kochi): This is not pure attachShadow wrapper, but also handles createSh adowRoot()
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 { 249 {
250 for (var i = 0; i + 1 < elements.length; ++i) 250 for (var i = 0; i + 1 < elements.length; ++i)
251 shouldNavigateFocus(elements[i], elements[i + 1], 'backward'); 251 shouldNavigateFocus(elements[i], elements[i + 1], 'backward');
252 } 252 }
253 253
254 function dumpComposedShadowTree(node, indent) 254 function dumpComposedShadowTree(node, indent)
255 { 255 {
256 indent = indent || ""; 256 indent = indent || "";
257 var output = indent + dumpNode(node) + "\n"; 257 var output = indent + dumpNode(node) + "\n";
258 var child; 258 var child;
259 for (child = internals.firstChildInComposedTree(node); child; child = intern als.nextSiblingInComposedTree(child)) 259 for (child = internals.firstChildInFlatTree(node); child; child = internals. nextSiblingInFlatTree(child))
260 output += dumpComposedShadowTree(child, indent + "\t"); 260 output += dumpComposedShadowTree(child, indent + "\t");
261 return output; 261 return output;
262 } 262 }
263 263
264 function lastNodeInComposedTree(root) 264 function lastNodeInFlatTree(root)
265 { 265 {
266 var lastNode = root; 266 var lastNode = root;
267 while (internals.lastChildInComposedTree(lastNode)) 267 while (internals.lastChildInFlatTree(lastNode))
268 lastNode = internals.lastChildInComposedTree(lastNode); 268 lastNode = internals.lastChildInFlatTree(lastNode);
269 return lastNode; 269 return lastNode;
270 } 270 }
271 271
272 function showComposedShadowTreeByTraversingInForward(root) 272 function showComposedShadowTreeByTraversingInForward(root)
273 { 273 {
274 var node = root; 274 var node = root;
275 var last = lastNodeInComposedTree(root); 275 var last = lastNodeInFlatTree(root);
276 while (node) { 276 while (node) {
277 debug(dumpNode(node)); 277 debug(dumpNode(node));
278 if (node == last) 278 if (node == last)
279 break; 279 break;
280 node = internals.nextInComposedTree(node); 280 node = internals.nextInFlatTree(node);
281 } 281 }
282 } 282 }
283 283
284 function showComposedShadowTreeByTraversingInBackward(root) 284 function showComposedShadowTreeByTraversingInBackward(root)
285 { 285 {
286 var node = lastNodeInComposedTree(root); 286 var node = lastNodeInFlatTree(root);
287 while (node) { 287 while (node) {
288 debug(dumpNode(node)); 288 debug(dumpNode(node));
289 if (node == root) 289 if (node == root)
290 break; 290 break;
291 node = internals.previousInComposedTree(node); 291 node = internals.previousInFlatTree(node);
292 } 292 }
293 } 293 }
294 294
295 function showComposedShadowTree(node) 295 function showComposedShadowTree(node)
296 { 296 {
297 debug('Composed Shadow Tree:'); 297 debug('Composed Shadow Tree:');
298 debug(dumpComposedShadowTree(node)); 298 debug(dumpComposedShadowTree(node));
299 299
300 debug('Traverse in forward.'); 300 debug('Traverse in forward.');
301 showComposedShadowTreeByTraversingInForward(node); 301 showComposedShadowTreeByTraversingInForward(node);
302 302
303 debug('Traverse in backward.'); 303 debug('Traverse in backward.');
304 showComposedShadowTreeByTraversingInBackward(node); 304 showComposedShadowTreeByTraversingInBackward(node);
305 305
306 debug(''); 306 debug('');
307 } 307 }
308 308
309 function showNextNode(node) 309 function showNextNode(node)
310 { 310 {
311 var next = internals.nextInComposedTree(node); 311 var next = internals.nextInFlatTree(node);
312 debug('Next node of [' + dumpNode(node) + '] is [' + dumpNode(next) + ']'); 312 debug('Next node of [' + dumpNode(node) + '] is [' + dumpNode(next) + ']');
313 } 313 }
314 314
315 function backgroundColorOf(selector) 315 function backgroundColorOf(selector)
316 { 316 {
317 return window.getComputedStyle(getNodeInTreeOfTrees(selector)).backgroundCol or; 317 return window.getComputedStyle(getNodeInTreeOfTrees(selector)).backgroundCol or;
318 } 318 }
319 319
320 function backgroundColorShouldBe(selector, expected) 320 function backgroundColorShouldBe(selector, expected)
321 { 321 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return node; 354 return node;
355 } 355 }
356 356
357 return null; 357 return null;
358 }; 358 };
359 359
360 if (!window.internals) 360 if (!window.internals)
361 return null; 361 return null;
362 return iter(root, id); 362 return iter(root, id);
363 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698