Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html

Issue 300223009: Implement basic parts of hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <head>
3 <title>Canvas Hit Regions: accessibility test</title>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body style="padding : 0; margin : 0;">
fs 2014/06/03 11:47:01 Probably would be good to have these be != 0 - eit
7 <canvas id="canvas" class="output" width="300" height="350">
8 <button id="button1"></button>
9 <div id="container">
10 <button id="button2"></button>
11 </div>
12 </canvas>
13 <script>
14
15 if (window.accessibilityController) {
16 window.axButton1 = window.accessibilityController.accessibleElementById("but ton1");
dmazzoni 2014/06/03 17:26:10 You don't need "window." anywhere in this test - l
fs 2014/06/04 08:13:40 "local" variables in this scope will be on the glo
17 window.axContainer = window.accessibilityController.accessibleElementById("c ontainer");
18 window.axButton2 = window.accessibilityController.accessibleElementById("but ton2");
19 }
20
21 var canvas = document.getElementById("canvas");
22 var context = canvas.getContext("2d");
23
24 context.save();
25 context.translate(50, 50);
26
27 context.beginPath();
28 context.rect(0, 0, 200, 100);
29 context.fillStyle = '#ccf';
30 context.fill();
31 context.addHitRegion({ id : "button1", control : document.getElementById('butt on1') });
32
33 context.beginPath();
34 context.rect(0, 150, 200, 100);
35 context.fillStyle = '#cfc';
36 context.fill();
37 context.addHitRegion({ id : "button2", control : document.getElementById('butt on2') });
38
39 context.restore();
40
41 shouldBe("axButton1.x", "50");
42 shouldBe("axButton1.y", "50");
43 shouldBe("axButton1.width", "200");
44 shouldBe("axButton1.height", "100");
45
46 shouldBe("axContainer.x", "50");
47 shouldBe("axContainer.y", "200");
48 shouldBe("axContainer.width", "200");
49 shouldBe("axContainer.height", "100");
50
51 shouldBe("axButton2.x", "50");
52 shouldBe("axButton2.y", "200");
53 shouldBe("axButton2.width", "200");
54 shouldBe("axButton2.height", "100");
55
56 </script>
57 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698