Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html class="reftest-wait"> |
michael@0 | 3 | <head> |
michael@0 | 4 | <style type="text/css"> |
michael@0 | 5 | #one { |
michael@0 | 6 | position:absolute; |
michael@0 | 7 | left:0px; top:0px; |
michael@0 | 8 | z-index:4; |
michael@0 | 9 | } |
michael@0 | 10 | #two { |
michael@0 | 11 | position:absolute; |
michael@0 | 12 | top:100px; left:100px; |
michael@0 | 13 | background-color:rgb(0,0,0,0); |
michael@0 | 14 | z-index:3; |
michael@0 | 15 | } |
michael@0 | 16 | #three { |
michael@0 | 17 | position:absolute; |
michael@0 | 18 | left:100px; top:100px; |
michael@0 | 19 | width:200px; height:200px; |
michael@0 | 20 | background-color: rgb(255,0,0); |
michael@0 | 21 | opacity:0.6; |
michael@0 | 22 | z-index:2; |
michael@0 | 23 | } |
michael@0 | 24 | #four { |
michael@0 | 25 | position:absolute; |
michael@0 | 26 | top:100px; left:100px; |
michael@0 | 27 | z-index:1; |
michael@0 | 28 | } |
michael@0 | 29 | </style> |
michael@0 | 30 | <script type="text/javascript"> |
michael@0 | 31 | var plugin, div, canvas; |
michael@0 | 32 | function start() { |
michael@0 | 33 | plugin = document.getElementById("four"); |
michael@0 | 34 | div = document.getElementById("three"); |
michael@0 | 35 | canvas = document.getElementById("two"); |
michael@0 | 36 | paintCanvas(); |
michael@0 | 37 | |
michael@0 | 38 | mozRequestAnimationFrame(moveSomething); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function paintCanvas() { |
michael@0 | 42 | var ctx = canvas.getContext("2d"); |
michael@0 | 43 | ctx.fillStyle = "rgba(255,0,0, 0.6)"; |
michael@0 | 44 | ctx.fillRect(0,0, 200,200); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | var i = 0, numLoops = 20; |
michael@0 | 48 | var pluginIn = true, divIn = true, canvasIn = true; |
michael@0 | 49 | function moveSomething() { |
michael@0 | 50 | var didSomething = (0 === (i % 2)) ? moveSomethingOut() : moveSomethingIn(); |
michael@0 | 51 | if (!didSomething && ++i >= numLoops) { |
michael@0 | 52 | return finish(); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | mozRequestAnimationFrame(moveSomething); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | function finish() { |
michael@0 | 59 | document.documentElement.removeAttribute("class"); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | function moveSomethingOut() { |
michael@0 | 63 | if (pluginIn) { |
michael@0 | 64 | plugin.style.left = "400px"; |
michael@0 | 65 | pluginIn = false; |
michael@0 | 66 | } else if (divIn) { |
michael@0 | 67 | div.style.left = "400px"; |
michael@0 | 68 | divIn = false; |
michael@0 | 69 | } else if (canvasIn) { |
michael@0 | 70 | canvas.style.left = "400px"; |
michael@0 | 71 | canvasIn = false; |
michael@0 | 72 | } else { |
michael@0 | 73 | return false; |
michael@0 | 74 | } |
michael@0 | 75 | return true; |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | function moveSomethingIn() { |
michael@0 | 79 | if (!pluginIn) { |
michael@0 | 80 | plugin.style.left = "100px"; |
michael@0 | 81 | pluginIn = true; |
michael@0 | 82 | } else if (!divIn) { |
michael@0 | 83 | div.style.left = "100px"; |
michael@0 | 84 | divIn = true; |
michael@0 | 85 | } else if (!canvasIn) { |
michael@0 | 86 | canvas.style.left = "100px"; |
michael@0 | 87 | canvasIn = true; |
michael@0 | 88 | } else { |
michael@0 | 89 | return false; |
michael@0 | 90 | } |
michael@0 | 91 | return true; |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | function reset() { |
michael@0 | 95 | |
michael@0 | 96 | } |
michael@0 | 97 | </script> |
michael@0 | 98 | </style> |
michael@0 | 99 | </head> |
michael@0 | 100 | <body onload="start();"> |
michael@0 | 101 | <embed id="four" type="application/x-test" width="200" height="200" |
michael@0 | 102 | drawmode="solid" color="FFFF0000"></embed> |
michael@0 | 103 | <div id="three"></div> |
michael@0 | 104 | <canvas id="two" width="200" height="200"></canvas> |
michael@0 | 105 | <embed id="one" type="application/x-test" width="400" height="400" |
michael@0 | 106 | drawmode="solid" color="9900FF00"></embed> |
michael@0 | 107 | </body> |
michael@0 | 108 | </html> |
michael@0 | 109 |