canvas-outside-document-invalidate-01.html 745 B

12345678910111213141516171819202122232425262728293031
  1. <!--
  2. Any copyright is dedicated to the Public Domain.
  3. http://creativecommons.org/licenses/publicdomain/
  4. Test that painting in an out-of-document canvas causes a repaint.
  5. -->
  6. <!DOCTYPE html>
  7. <html class="reftest-wait">
  8. <body style="background: -moz-element(#e) darkred">
  9. <script>
  10. var canvas = document.createElement("canvas");
  11. canvas.width = canvas.height = 1;
  12. var ctx = canvas.getContext('2d');
  13. ctx.fillStyle = "red";
  14. ctx.fillRect(0, 0, 1, 1);
  15. window.addEventListener("MozReftestInvalidate", function () {
  16. setTimeout(function () {
  17. ctx.fillStyle = "white";
  18. ctx.fillRect(0, 0, 1, 1);
  19. document.documentElement.className = "";
  20. }, 0);
  21. }, false);
  22. document.mozSetImageElement("e", canvas);
  23. </script>
  24. </body>
  25. </html>