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

Side by Side Diff: platform_tools/nacl/skhello/index.html

Issue 16904003: SkHello for NaCl (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « platform_tools/nacl/index.html ('k') | platform_tools/nacl/skhello/skhello.nmf » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <!-- 3 <!--
4 Copyright 2013 Google Inc. 4 Copyright 2013 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 --> 8 -->
9 <head> 9 <head>
10 10
11 <title>Skia Unit Tests</title> 11 <title>Skia Hello World</title>
12 12
13 <script type="text/javascript"> 13 <script type="text/javascript">
14 "use strict"; 14 "use strict";
15 15
16 var SkiaModule = null; // Global application object. 16 var SkiaModule = null; // Global application object.
17 17
18 // Force a re-draw of the given element. 18 // Force a re-draw of the given element.
19 function refresh(elem) { 19 function refresh(elem) {
20 var old_display_style = elem.style.display; 20 var old_display_style = elem.style.display;
21 elem.style.display = "none"; 21 elem.style.display = "none";
22 elem.style.display = old_display_style; 22 elem.style.display = old_display_style;
23 } 23 }
24 24
25 // When the module loads, begin running the application. 25 // When the module loads, begin running the application.
26 function moduleDidLoad() { 26 function moduleDidLoad() {
27 SkiaModule = document.getElementById("skia_nacl"); 27 SkiaModule = document.getElementById("skia_nacl");
28 run(); 28 run();
29 } 29 }
30 30
31 function handleMessage(message_event) { 31 function handleMessage(message_event) {
32 var skdebugf_cmd = "SkDebugf:"; 32 var skdebugf_cmd = "SkDebugf:";
33 if (message_event.data.indexOf(skdebugf_cmd) == 0) { 33 if (message_event.data.indexOf(skdebugf_cmd) == 0) {
34 var msg_contents = message_event.data.slice(skdebugf_cmd.length) 34 var msg_contents = message_event.data.slice(skdebugf_cmd.length)
35 //console.log("Skia: " + msg_contents); 35 console.log("Skia: " + msg_contents);
36 var log_textarea = document.getElementById("log_textarea")
37 log_textarea.value += msg_contents;
38 log_textarea.scrollTop = log_textarea.scrollHeight;
39 refresh(log_textarea);
40 } else { 36 } else {
41 alert(message_event.data); 37 alert(message_event.data);
42 } 38 }
43 } 39 }
44 40
45 // Run the application. 41 // Run the application.
46 function run() { 42 function run() {
47 if (SkiaModule) { 43 if (SkiaModule) {
48 var cmd = "init"; 44 var cmd = "init";
49 SkiaModule.postMessage(cmd); 45 SkiaModule.postMessage(cmd);
50 } else { 46 } else {
51 alert("The Skia module has not properly loaded..."); 47 alert("The Skia module has not properly loaded...");
52 } 48 }
53 } 49 }
54 </script> 50 </script>
55 </head> 51 </head>
56 <body> 52 <body>
57 53
58 <h1>Skia Unit Tests</h1> 54 <h1>Skia Hello World</h1>
59 <p>
60 <textarea id="log_textarea" rows="2" cols="2" readonly style="width:100%; height :500px; resize:none;"></textarea>
61 </p>
62 <p> 55 <p>
63 <div id="listener"> 56 <div id="listener">
64 <script type="text/javascript"> 57 <script type="text/javascript">
65 var listener = document.getElementById('listener'); 58 var listener = document.getElementById('listener');
66 listener.addEventListener('load', moduleDidLoad, true); 59 listener.addEventListener('load', moduleDidLoad, true);
67 listener.addEventListener('message', handleMessage, true); 60 listener.addEventListener('message', handleMessage, true);
68 </script> 61 </script>
69 62
70 <embed name="nacl_module" 63 <embed name="nacl_module"
71 id="skia_nacl" 64 id="skia_nacl"
72 width=0 height=0 65 width=300 height=300
73 src="tests.nmf" 66 src="skhello.nmf"
74 type="application/x-nacl" /> 67 type="application/x-nacl" />
75 </div> 68 </div>
76 </p> 69 </p>
77 </body> 70 </body>
78 </html> 71 </html>
OLDNEW
« no previous file with comments | « platform_tools/nacl/index.html ('k') | platform_tools/nacl/skhello/skhello.nmf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698