blob: fcaa61a8da3481163bc9fb998d3360d5d7ad26aa [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../resources/runner.js"></script>
</head>
<body>
<div id="root"></div>
<script>
function createComposedTree(root, depth, branch, eachTreeHeight)
{
var node = root;
var i;
for (i = 0; i < eachTreeHeight; ++i) {
var child = document.createElement('div');
node.appendChild(child);
node = child;
}
if (depth == 1)
return;
for (i = 0; i < branch; ++i) {
var child = document.createElement('div');
node.appendChild(child);
var shadowRoot = child.createShadowRoot();
createComposedTree(shadowRoot, depth - 1, branch, eachTreeHeight);
}
}
function leftMostLeaf(root)
{
var node = root;
while (node.firstChild)
node = node.firstChild
if (!node.shadowRoot)
return node;
return leftMostLeaf(node.shadowRoot)
}
function rightMostLeaf(root)
{
var node = root;
while (node.lastChild)
node = node.lastChild
if (!node.shadowRoot)
return node;
return rightMostLeaf(node.shadowRoot)
}
var root = document.getElementById('root');
createComposedTree(root, 10, 2, 50);
var leaf1 = leftMostLeaf(root);
var leaf2 = rightMostLeaf(root);
function run()
{
leaf1.dispatchEvent(new MouseEvent('mousemove', {
relatedTarget: leaf2
}));
}
PerfTestRunner.measureRunsPerSecond({
description: "Measure mousemove events dispatching in shadow trees",
run: run
});
</script>
</body>
</html>