Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: ppapi/example/example.html

Issue 6156004: Add ability to toggle the size of the plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/example/example.html
diff --git a/ppapi/example/example.html b/ppapi/example/example.html
index f6fdc526f0912589e84c6f5277f5122433984068..7146b3f93dfbbe45761628b7d9b1a76a83390a0a 100644
--- a/ppapi/example/example.html
+++ b/ppapi/example/example.html
@@ -1,17 +1,39 @@
<body style="background-image:url(http://www.google.com/intl/en_ALL/images/logo.gif);
- background-repeat:repeat">
+ background-repeat:repeat"
+ onload="SetPluginSize(400, 400)">
<script type="text/javascript">
+isPluginDefaultSize = true;
+
function Test() {
plugin = document.getElementById('plugin');
// Confirm that this no longer segfaults.
alert(plugin.toString(new Array(10)));
}
+function SetPluginSize(width, height) {
+ plugin = document.getElementById('plugin');
+ size = document.getElementById('size');
+ plugin.width = width;
+ plugin.height = height;
+ size.innerHTML = "Height: " + plugin.width + ' Width: ' + plugin.height;
+}
+
+function ToggleSize() {
+ if (!isPluginDefaultSize) {
+ SetPluginSize(400, 400);
+ isPluginDefaultSize = true;
+ } else {
+ SetPluginSize(1000, 800);
+ isPluginDefaultSize = false;
+ }
+}
</script>
<button onclick='Test()'>Test</button>
- <div id="fps" style="background-color:white; font-weight:bold; padding:4px;">FPS GOES HERE</div>
- <object id="plugin" type="application/x-ppapi-example" width="400" height="400" />
+ <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>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698