PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/image/test/reftest/apng/delaytest.html

http://github.com/zpao/v8monkey
HTML | 41 lines | 35 code | 6 blank | 0 comment | 0 complexity | c2c4268599183cf2a973bf0fc1013e50 MD5 | raw file
 1<!DOCTYPE HTML>
 2<html class="reftest-wait">
 3<head>
 4<title>Delayed image reftest wrapper</title>
 5</head>
 6<body>
 7<img id="image1">
 8<script>
 9// This loads a externally specified image, forces a draw (in case of
10// decode-on-draw), waits 100ms, and then triggers the reftest snapshot.
11// This allows the animation on the page to complete.
12//
13// Use as "delaytest.html?animation.png"
14//
15
16// Get the image URL from our URL
17var imgURL = document.location.search.substr(1);
18
19// Load the image
20var img = document.images[0];
21img.src = imgURL;
22img.onload = forceDecode;
23
24function forceDecode() {
25
26  // We need to force drawing of the image in an invisible context
27  var canvas = document.createElement("canvas");
28  var ctx = canvas.getContext("2d");
29  ctx.drawImage(img, 0, 0);
30
31  // We've force the decode. start the timer to trigger the reftest
32  startTimer();
33}
34
35function startTimer() {
36  const delay = 100;
37  setTimeout("document.documentElement.className = '';", delay);
38}
39</script>
40</body>
41</html>