| <!DOCTYPE html> |
| <html> |
| <body> |
| <p>A green square should appear below this text.</p> |
| <canvas id="c" width="100" height="100"></canvas> |
| <script> |
| window.onload = function() { |
| var canvas = document.getElementById("c") |
| var ctx = canvas.getContext("2d") |
| ctx.fillStyle = 'red'; |
| ctx.fillRect(0, 0, 100, 100); |
| ctx.translate(100, 0); |
| |
| // If canvas was in diplay list mode, this will trigger a fallback |
| var dataUrl = canvas.toDataURL(); |
| // This should reset the current transform. crbug.com/445162 had to do with |
| // The fallback interfering with the mechanism that resets state when the canvas |
| // is cleared by resetting its size to the same value. |
| canvas.width = 100; |
| |
| ctx.fillStyle = 'green'; |
| ctx.fillRect(0, 0, 100, 100); |
| } |
| </script> |
| </body> |
| </html> |