forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayers_overlap_2d.html
54 lines (52 loc) · 1.8 KB
/
layers_overlap_2d.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<title>Performance tester for non-overlaping 2D layers</title>
<style>
.container {
position: relative;
width: 20px;
height: 20px;
border: 1px solid #AAA;
margin: 0 auto 5px;
}
.box {
width: 100%;
height: 100%;
position: absolute;
background: red;
}
.composited {
-webkit-transform: translateZ(1px);
}
</style>
<script src="../resources/runner.js"></script>
</head>
<body>
<pre id="log"></pre>
<script>
function createTestFunction(count) {
return function() {
var container = document.createElement("div");
for(i = 0; i < count; ++i) {
var outer = document.createElement('div');
outer.className = 'container';
var inner = document.createElement('div');
inner.className = 'box';
if (i == 0) {
// Use at least one 3D layer to trigger the overlap map checking.
inner.className += " composited";
}
outer.appendChild(inner);
container.appendChild(outer);
}
document.body.appendChild(container);
// Force a layout update.
document.body.clientHeight;
container.remove();
}
}
PerfTestRunner.measureTime({run: createTestFunction(5000)});
</script>
</body>
</html>