OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>drawSystemFocusRing() dirty rect test</title> | |
5 <script src="../../resources/js-test.js"></script> | |
6 </head> | |
7 <body> | |
8 <p>This test is passed if result1 is exactly the same with result2.</p> | |
9 <p> | |
10 <button id="result1">Result1</button> | |
11 <button id="result2">Result2</button> | |
12 </p> | |
13 <canvas id="canvas" class="output" width="300" height="300"> | |
14 <button id="button"></button> | |
15 </canvas> | |
16 <script> | |
17 | |
18 var canvas = document.getElementById("canvas"); | |
19 var context = canvas.getContext("2d"); | |
20 var button = document.getElementById("button"); | |
21 var result1 = document.getElementById("result1"); | |
22 var result2 = document.getElementById("result2"); | |
23 | |
24 function drawResult(delayed) { | |
25 | |
26 context.beginPath(); | |
27 context.rect(0, 0, 300, 300); | |
28 context.fillStyle = "black"; | |
29 context.fill(); | |
30 | |
31 context.beginPath(); | |
32 context.rect(50, 50, 200, 100); | |
33 context.fillStyle = "blue"; | |
34 context.fill(); | |
35 | |
36 button.focus(); | |
37 | |
38 if (delayed) { | |
39 setTimeout(function() { | |
40 context.drawSystemFocusRing(button); | |
41 }, 500); | |
Justin Novosad
2014/03/20 19:27:38
Does the timeout need to be this long? If you wan
| |
42 } else { | |
43 context.drawSystemFocusRing(button); | |
44 } | |
45 } | |
46 | |
47 result1.addEventListener("click", function() { | |
48 drawResult(false); | |
49 }, false); | |
50 | |
51 result2.addEventListener("click", function() { | |
52 drawResult(true); | |
53 }, false); | |
54 | |
55 </script> | |
56 </body> | |
57 </html> | |
OLD | NEW |