Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / draw-focus-if-needed-scrolls.html
blob58648f03b73af9b20c449235d50fd4f3e1c2a8ea
1 <!DOCTYPE HTML>
2 <head>
3 <title>Canvas test: drawFocusIfNeeded scrolls</title>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body style="padding: 0; margin: 0">
7 <div style="border: 1px solid #000; height: 1000px;">1000-pixel box</div>
8 <canvas id="canvas" width="300" height="5000">
9 <button id="top_button"></button>
10 <button id="bottom_button"></button>
11 </canvas>
12 <script>
13 if (window.testRunner)
14 testRunner.dumpAsText();
16 var canvas = document.getElementById("canvas");
17 var context = canvas.getContext("2d");
19 var TOP_BUTTON_Y_POS = 50;
20 var BOTTOM_BUTTON_Y_POS = 4850;
22 function draw() {
23 context.beginPath();
24 context.rect(50, TOP_BUTTON_Y_POS, 200, 100);
25 context.fillStyle = "#ccf";
26 context.fill();
27 context.drawFocusIfNeeded(document.getElementById("top_button"));
29 context.beginPath();
30 context.rect(50, BOTTOM_BUTTON_Y_POS, 200, 100);
31 context.fillStyle = "#fcc";
32 context.fill();
33 context.drawFocusIfNeeded(document.getElementById("bottom_button"));
36 document.getElementById("bottom_button").focus();
37 window.scrollTo(0, 0);
38 shouldBe("window.pageYOffset", "0");
39 draw();
41 var minYOffset = BOTTOM_BUTTON_Y_POS + canvas.offsetTop - window.innerHeight;
42 var maxYOffset = BOTTOM_BUTTON_Y_POS + canvas.offsetTop;
43 shouldBeGreaterThanOrEqual("window.pageYOffset", "minYOffset");
44 shouldBeGreaterThanOrEqual("maxYOffset", "window.pageYOffset");
46 document.getElementById("top_button").focus();
47 shouldBeGreaterThanOrEqual("window.pageYOffset", "minYOffset");
48 shouldBeGreaterThanOrEqual("maxYOffset", "window.pageYOffset");
50 draw();
51 minYOffset = TOP_BUTTON_Y_POS + canvas.offsetTop - window.innerHeight;
52 maxYOffset = TOP_BUTTON_Y_POS + canvas.offsetTop;
53 shouldBeGreaterThanOrEqual("window.pageYOffset", "minYOffset");
54 shouldBeGreaterThanOrEqual("maxYOffset", "window.pageYOffset");
56 </script>
57 </body>