Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / images / imagemap-scroll.html
blob36d389ab291a61d59cba911f37d4bed5b4fc1b5d
1 <html>
2 <head>
3 <script>
4 function log(message)
6 var element = document.createElement("p");
7 element.appendChild(document.createTextNode(message));
8 document.getElementById("results").appendChild(element);
10 function runTest()
12 if (window.testRunner)
13 testRunner.dumpAsText();
14 if (document.scrollingElement.scrollTop == 0)
15 log("PASS: Document is starting scrolled to top.");
16 else
17 log("FAIL: Document is starting scrolled to " + document.scrollingElement.scrollTop + ".");
18 document.getElementById("area").focus();
19 if (document.scrollingElement.scrollTop > 4000 && document.scrollingElement.scrollTop < 6000)
20 log("PASS: Focusing area element caused the image to scroll into view.");
21 else
22 log("FAIL: Document is scrolled to " + document.scrollingElement.scrollTop + " after focusing area element.");
23 document.scrollingElement.scrollTop = 0;
24 if (document.scrollingElement.scrollTop == 0)
25 log("PASS: Document is scrolled to top once again.");
26 else
27 log("FAIL: Document should be scrolled to top but is scrolled to " + document.scrollingElement.scrollTop + ".");
28 document.getElementById("area").blur();
29 if (document.scrollingElement.scrollTop == 0)
30 log("PASS: Document is still scrolled to top after removing focus from area element.");
31 else
32 log("FAIL: Document is scrolled to " + document.scrollingElement.scrollTop + " after removing focus from area element.");
33 document.scrollingElement.scrollTop = 0;
34 document.body.removeChild(document.getElementById("test"));
35 log("TEST COMPLETE");
37 </script>
38 </head>
39 <body onload="runTest()">
40 <div id="results">
41 <p>This tests to be sure that focusing an area element triggers scrolling and removing focus from it does not.</p>
42 </div>
43 <div id="test">
44 <div style="height:5000px"></div>
45 <map name="imagemap">
46 <area id="area" shape="rect" coords="0,0,128,128" href="#dummy">
47 </map>
48 <img src="resources/mu.png" width="128" height="128" usemap="#imagemap" ismap>
49 <div style="height:5000px"></div>
50 <div>
51 </body>
52 </head>
53 </html>