4 <script type=
"text/javascript" src=
"../resources/runner.js"></script>
7 <div id=
"root"><div id=
"child1"></div><div id=
"child2"></div></div>
9 function createTreeOfTrees(root
, depth
, eachTreeHeight
)
13 for (i
= 0; i
< eachTreeHeight
; ++i
) {
14 var child
= document
.createElement('div');
15 node
.appendChild(child
);
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
)
29 while (node
.firstChild
)
30 node
= node
.firstChild
33 return leftMostLeaf(node
.shadowRoot
)
36 function rightMostLeaf(root
)
39 while (node
.lastChild
)
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
);
54 leaf1
.dispatchEvent(new MouseEvent('mousemove', {
59 PerfTestRunner
.measureRunsPerSecond({
60 description
: "Measure mousemove events dispatching in shadow trees",