Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE> | |
| 2 <html> | |
| 3 <head> | |
| 4 <!-- Check for compositing WebGL layer and accelerated background-color layer. - -> | |
| 5 <!-- On load, there is not WebGL layer. WebGL layer is created on the fly. --> | |
| 6 <style type="text/css" media="screen"> | |
|
jamesr
2013/11/26 06:08:00
the 'type' and 'media' attributes here aren't stri
| |
| 7 #background { | |
| 8 width: 200px; | |
| 9 height: 200px; | |
| 10 display: block; | |
| 11 } | |
| 12 #canvas { | |
| 13 width: 200px; | |
| 14 height: 200px; | |
| 15 display: block; | |
| 16 } | |
| 17 .blue { | |
| 18 width: 50px; | |
| 19 height: 50px; | |
| 20 background-color: rgba(0, 0, 255, 0.5); | |
| 21 display: block; | |
| 22 top: 50px; | |
| 23 position: absolute; | |
| 24 } | |
| 25 .composited { | |
| 26 -webkit-transform: translateZ(0); | |
| 27 } | |
| 28 </style> | |
| 29 <script type="text/javascript" charset="utf-8"> | |
| 30 if (window.testRunner) { | |
| 31 testRunner.waitUntilDone(); | |
| 32 testRunner.dumpAsTextWithPixelResults(); | |
| 33 } | |
| 34 | |
| 35 function doTest() | |
| 36 { | |
| 37 window.setTimeout(function() { | |
| 38 makeWebGLLayer(); | |
| 39 if (window.testRunner) { | |
| 40 window.setTimeout(function() { | |
| 41 testRunner.notifyDone(); | |
| 42 }, 0); | |
| 43 } | |
| 44 }, 0); | |
| 45 } | |
| 46 | |
| 47 function initWebGL(vshader, fshader, attribs, clearColor, clearDepth) | |
| 48 { | |
| 49 var canvas = document.getElementById('canvas'); | |
| 50 var gl = canvas.getContext("experimental-webgl"); | |
| 51 if (!gl) { | |
| 52 alert("No WebGL context found"); | |
| 53 return null; | |
| 54 } | |
| 55 | |
| 56 gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3] ); | |
| 57 gl.clearDepth(clearDepth); | |
| 58 | |
| 59 gl.enable(gl.DEPTH_TEST); | |
| 60 gl.enable(gl.BLEND); | |
| 61 gl.blendFunc(gl.SRC_ALPHA, gl.ONE); | |
| 62 | |
| 63 return gl; | |
| 64 } | |
| 65 | |
| 66 function makeWebGLLayer() | |
| 67 { | |
| 68 var gl = initWebGL("", "", [], [ 0, 0, 0, 0 ], 1); | |
| 69 gl.viewport(0, 0, 200, 200); | |
| 70 gl.clearColor(1.0, 0.0, 0.0, 1.0); | |
| 71 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | |
| 72 } | |
| 73 | |
| 74 window.addEventListener('load', doTest, false); | |
| 75 </script> | |
| 76 </head> | |
| 77 <body> | |
| 78 <div id="background"> | |
| 79 <canvas id="canvas"></canvas> | |
| 80 <div class="blue composited"></div> | |
| 81 </div> | |
| 82 </body> | |
| 83 </html> | |
| OLD | NEW |