summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/gpu/pixel_css3d.html
blob: 3fa0fe4212ff0b4bfdb52f5d5dedff15f5dd29b5 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE HTML>
<html>
<head>
<title>CSS 3D Test: Projected Blue Box over Black Background</title>
<style type="text/css">
.nomargin {
  margin: 0px auto;
}

#container {
  -webkit-perspective: 500;
}

#container > div {
  position: relative;
  margin: 50px;
  width: 125px;
  height: 75px;
}

#container > :first-child {
  background-color: blue;
  -webkit-transform: rotateY(45deg);
}
</style>
<script>
var g_swapsBeforeAck = 15;
var g_targetWidth, g_targetHeight;

function onresized()
{
  if (g_targetWidth != window.outerWidth ||
      g_targetHeight != window.outerHeight)
    return;

  main();
}


function main()
{
  waitForFinish();
}

function waitForFinish()
{
  if (g_swapsBeforeAck == 0) {
    domAutomationController.setAutomationId(1);
    domAutomationController.send("resized");
  } else {
    g_swapsBeforeAck--;
    document.getElementById('blue_box').style.zIndex = g_swapsBeforeAck + 1;
    window.webkitRequestAnimationFrame(waitForFinish);
  }
}

function notifyLoadFinished()
{
  domAutomationController.setAutomationId(1);
  domAutomationController.send("ok");
}

function preCallResizeInChromium(targetWidth, targetHeight)
{
  g_targetWidth = targetWidth;
  g_targetHeight = targetHeight;
  window.onresize = onresized;

  // Call main() on a timeout in case the window did not resize for whatever
  // reason.
  setTimeout(main, 10000);
}
</script>
</head>
<body onload="notifyLoadFinished()">
<div style="position:relative; width:200px; height:200px; background-color:black; zindex-0">
</div>
<div id="container" style="position:absolute; top:0px; left:0px">
  <div id="blue_box"></div>
</div>
</body>
</html>