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

Side by Side Diff: LayoutTests/fast/canvas/draw-focus-if-needed.html

Issue 237063002: Add StrictTypeChecking to CRC2D.{drawFocusIfNeeded,drawCustomFocusRing} (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/draw-focus-if-needed-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <head> 2 <head>
3 <title>Canvas test: drawFocusIfNeeded</title> 3 <title>Canvas test: drawFocusIfNeeded</title>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.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 <button id="button2"></button>
10 </canvas> 10 </canvas>
11 <script> 11 <script>
12 if (window.testRunner) 12 if (window.testRunner)
13 testRunner.dumpAsText(); 13 testRunner.dumpAsText();
14 14
15 document.getElementById("button1").focus(); 15 document.getElementById("button1").focus();
16 16
17 var canvas = document.getElementById("canvas").getContext("2d"); 17 var canvas = document.getElementById("canvas").getContext("2d");
18 18
19 shouldNotThrow('canvas.drawFocusIfNeeded(null);'); 19 shouldThrow('canvas.drawFocusIfNeeded(null);');
Justin Novosad 2014/04/14 14:33:31 This fixes a spec compliance bug, which should be
fs 2014/04/14 15:03:28 I figured that since this API was guarded by the E
20 shouldThrow('canvas.drawFocusIfNeeded();'); 20 shouldThrow('canvas.drawFocusIfNeeded();');
21 21
22 canvas.beginPath(); 22 canvas.beginPath();
23 canvas.rect(50, 50, 200, 100); 23 canvas.rect(50, 50, 200, 100);
24 canvas.fillStyle = "#ccf"; 24 canvas.fillStyle = "#ccf";
25 canvas.fill(); 25 canvas.fill();
26 // re-test null case after having defined a path (regression test for crbug.com/ 353248) 26 // re-test null case after having defined a path (regression test for crbug.com/ 353248)
27 shouldNotThrow('canvas.drawFocusIfNeeded(null);'); 27 shouldThrow('canvas.drawFocusIfNeeded(null);');
28 canvas.drawFocusIfNeeded(document.getElementById("button1")); 28 canvas.drawFocusIfNeeded(document.getElementById("button1"));
29 29
30 canvas.beginPath(); 30 canvas.beginPath();
31 canvas.rect(50, 200, 200, 100); 31 canvas.rect(50, 200, 200, 100);
32 canvas.fillStyle = "#cfc"; 32 canvas.fillStyle = "#cfc";
33 canvas.fill(); 33 canvas.fill();
34 canvas.drawFocusIfNeeded(document.getElementById("button2")); 34 canvas.drawFocusIfNeeded(document.getElementById("button2"));
35 35
36 // The top rect"s focus ring is tied to button1, which is focused. 36 // The top rect"s focus ring is tied to button1, which is focused.
37 // It should have an outline in some color other than the background color. 37 // It should have an outline in some color other than the background color.
38 var imageData = canvas.getImageData(49, 50, 1, 1); 38 var imageData = canvas.getImageData(49, 50, 1, 1);
39 var data = imageData.data; 39 var data = imageData.data;
40 shouldBe("data[0] != 0 || data[1] != 0 || data[2] != 0", "true"); 40 shouldBe("data[0] != 0 || data[1] != 0 || data[2] != 0", "true");
41 41
42 // The bottom rect"s focus ring is tied to button2, which is not focused. 42 // The bottom rect"s focus ring is tied to button2, which is not focused.
43 imageData = canvas.getImageData(49, 200, 1, 1); 43 imageData = canvas.getImageData(49, 200, 1, 1);
44 data = imageData.data; 44 data = imageData.data;
45 shouldBe("data[0] == 0 && data[1] == 0 && data[2] == 0", "true"); 45 shouldBe("data[0] == 0 && data[1] == 0 && data[2] == 0", "true");
46 </script> 46 </script>
47 </body> 47 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/draw-focus-if-needed-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698