summaryrefslogtreecommitdiffstats
path: root/ppapi/example/example.html
blob: 7faf8f9f09f6be3996c65bac4b9f8f270c7d02f5 (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
<body style="background-image:url(http://www.google.com/intl/en_ALL/images/logo.gif);
             background-repeat:repeat"
      onload="SetPluginSize(400, 400)">

<script type="text/javascript">
isPluginDefaultSize = true;

function Test() {
  var plugin = document.getElementById('plugin');
  // Confirm that this no longer segfaults.
  alert(plugin.toString(new Array(10)));

  // Confirm that the renderer doesn't crash when the plugin module goes away
  // while waiting for the reply to the HasPropery sync message.
  plugin.removePluginWhenHasPropertyCalled;
}

function SetPluginSize(width, height) {
  plugin = document.getElementById('plugin');
  size = document.getElementById('size');
  plugin.width = width;
  plugin.height = height;
  size.innerHTML = "Height: " + plugin.height + ' Width: ' + plugin.width;
}

function ToggleSize() {
  if (!isPluginDefaultSize) {
    SetPluginSize(400, 400);
    isPluginDefaultSize = true;
  } else {
    SetPluginSize(1000, 800);
    isPluginDefaultSize = false;
  }
}
</script>

  <button onclick='Test()'>Test</button>
  <button onclick='ToggleSize()'>Toggle Size</button>
  <div id="fps" style="background-color:white; font-weight:bold; padding:4px; width:200px;">FPS GOES HERE</div>
  <div id="size" style="background-color:white; font-weight:bold; padding:4px; width:200px;"></div>
  <object id="plugin" type="application/x-ppapi-example" width="400" height="400" border="2px"></object>
  <hr>
</body>