image-rendering-script.html (1205B)
1 <!DOCTYPE HTML> 2 <!-- 3 Any copyright is dedicated to the Public Domain. 4 http://creativecommons.org/licenses/publicdomain/ 5 --> 6 <html reftest-zoom="2" class="reftest-wait"> 7 <head> 8 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 9 <title>test image-rendering script change</title> 10 <style> 11 canvas { position:absolute;left:0px;top:0px; } 12 </style> 13 <script type="text/javascript"> 14 document.addEventListener("MozReftestInvalidate", updateImageRendering); 15 16 function updateImageRendering() { 17 var canvas = document.getElementById("canvas"); 18 canvas.style.imageRendering = '-moz-crisp-edges'; 19 document.documentElement.removeAttribute('class'); 20 } 21 </script> 22 </head> 23 24 <body> 25 <canvas style="image-rendering: auto;" id="canvas" width="300" height="300"> 26 </canvas> 27 28 <script type="text/javascript"> 29 var canvas = document.getElementById("canvas"); 30 var ctx = canvas.getContext("2d"); 31 ctx.fillStyle = "rgb(255,0,0)"; 32 ctx.fillRect(25,25,100,100); 33 ctx.fillStyle = "rgb(0,255,0)"; 34 ctx.fillRect(25,25,50,50); 35 </script> 36 </body> 37 38 </html>