Remove outdated list style types
[chromium-blink-merge.git] / third_party / WebKit / PerformanceTests / Events / EventsDispatchingInDeeplyNestedShadowTrees.html
blobbee2ef22e88c2d1ce2426c80afbaf9115778a1cf
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script type="text/javascript" src="../resources/runner.js"></script>
5 </head>
6 <body>
7 <div id="root"><div id="child1"></div><div id="child2"></div></div>
8 <script>
9 function createTreeOfTrees(root, depth, eachTreeHeight)
11 var node = root;
12 var i;
13 for (i = 0; i < eachTreeHeight; ++i) {
14 var child = document.createElement('div');
15 node.appendChild(child);
16 node = child;
18 if (depth == 1)
19 return;
20 var child = document.createElement('div');
21 node.appendChild(child);
22 var shadowRoot = child.createShadowRoot();
23 createTreeOfTrees(shadowRoot, depth - 1, eachTreeHeight);
26 function leftMostLeaf(root)
28 var node = root;
29 while (node.firstChild)
30 node = node.firstChild
31 if (!node.shadowRoot)
32 return node;
33 return leftMostLeaf(node.shadowRoot)
36 function rightMostLeaf(root)
38 var node = root;
39 while (node.lastChild)
40 node = node.lastChild
41 if (!node.shadowRoot)
42 return node;
43 return rightMostLeaf(node.shadowRoot)
46 var root = document.getElementById('root');
47 createTreeOfTrees(document.getElementById('child1'), 50, 20);
48 createTreeOfTrees(document.getElementById('child2'), 50, 20);
49 var leaf1 = leftMostLeaf(root);
50 var leaf2 = rightMostLeaf(root);
52 function run()
54 leaf1.dispatchEvent(new MouseEvent('mousemove', {
55 relatedTarget: leaf2
56 }));
59 PerfTestRunner.measureRunsPerSecond({
60 description: "Measure mousemove events dispatching in shadow trees",
61 run: run
62 });
63 </script>
64 </body>
65 </html>