OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <head> | 2 <head> |
3 <title>Canvas test: drawSystemFocusRing</title> | 3 <title>Canvas test: drawSystemFocusRing</title> |
4 <script src="../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body style="padding: 0; margin: 0"> | 6 <body style="padding: 0; margin: 0"> |
7 <canvas id="canvas" class="output" width="300" height="350"> | 7 <canvas id="canvas" class="output" width="300" height="350"> |
8 <button id="button1"></button> | 8 <button id="button1"></button> |
9 <button id="button2"></button> | 9 <div id="container"> |
| 10 <button id="button2"></button> |
| 11 </div> |
10 </canvas> | 12 </canvas> |
11 <script> | 13 <script> |
12 if (window.testRunner) | 14 if (window.testRunner) |
13 testRunner.dumpAsText(); | 15 testRunner.dumpAsText(); |
14 | 16 |
15 if (window.accessibilityController) { | 17 if (window.accessibilityController) { |
16 window.axButton1 = window.accessibilityController.accessibleElementById("but
ton1"); | 18 window.axButton1 = window.accessibilityController.accessibleElementById("but
ton1"); |
| 19 window.axContainer = window.accessibilityController.accessibleElementById("c
ontainer"); |
17 window.axButton2 = window.accessibilityController.accessibleElementById("but
ton2"); | 20 window.axButton2 = window.accessibilityController.accessibleElementById("but
ton2"); |
18 } | 21 } |
19 | 22 |
20 var canvas = document.getElementById("canvas").getContext("2d"); | 23 var canvas = document.getElementById("canvas").getContext("2d"); |
| 24 canvas.save(); |
| 25 canvas.translate(50, 50); |
| 26 |
21 canvas.beginPath(); | 27 canvas.beginPath(); |
22 canvas.rect(50, 50, 200, 100); | 28 canvas.rect(0, 0, 200, 100); |
23 canvas.fillStyle = '#ccf'; | 29 canvas.fillStyle = '#ccf'; |
24 canvas.fill(); | 30 canvas.fill(); |
25 canvas.drawCustomFocusRing(document.getElementById('button1')); | 31 canvas.drawCustomFocusRing(document.getElementById('button1')); |
26 | 32 |
27 canvas.beginPath(); | 33 canvas.beginPath(); |
28 canvas.rect(50, 200, 200, 100); | 34 canvas.rect(0, 150, 200, 100); |
29 canvas.fillStyle = '#cfc'; | 35 canvas.fillStyle = '#cfc'; |
30 canvas.fill(); | 36 canvas.fill(); |
31 canvas.drawCustomFocusRing(document.getElementById('button2')); | 37 canvas.drawCustomFocusRing(document.getElementById('button2')); |
32 | 38 |
| 39 canvas.restore(); |
| 40 |
33 shouldBe("axButton1.x", "50"); | 41 shouldBe("axButton1.x", "50"); |
34 shouldBe("axButton1.y", "50"); | 42 shouldBe("axButton1.y", "50"); |
35 shouldBe("axButton1.width", "200"); | 43 shouldBe("axButton1.width", "200"); |
36 shouldBe("axButton1.height", "100"); | 44 shouldBe("axButton1.height", "100"); |
37 | 45 |
| 46 shouldBe("axContainer.x", "50"); |
| 47 shouldBe("axContainer.y", "200"); |
| 48 shouldBe("axContainer.width", "200"); |
| 49 shouldBe("axContainer.height", "100"); |
| 50 |
38 shouldBe("axButton2.x", "50"); | 51 shouldBe("axButton2.x", "50"); |
39 shouldBe("axButton2.y", "200"); | 52 shouldBe("axButton2.y", "200"); |
40 shouldBe("axButton2.width", "200"); | 53 shouldBe("axButton2.width", "200"); |
41 shouldBe("axButton2.height", "100"); | 54 shouldBe("axButton2.height", "100"); |
42 </script> | 55 </script> |
43 <script src="../fast/js/resources/js-test-post.js"></script> | 56 <script src="../fast/js/resources/js-test-post.js"></script> |
44 </body> | 57 </body> |
OLD | NEW |