Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / listbox-hit-test-zoomed.html
blobfa222d4c6a29e9d3a11743b0dea200192febd9e7
1 <html>
2 <head>
3 <style type="text/css" media="screen">
4 body { overflow: hidden; }
5 html {
6 zoom: 120%;
8 </style>
9 <script>
10 function setup() {
11 var results = document.createElement('div');
12 results.id = "res";
13 results.appendChild(document.createTextNode("Results:"));
14 document.body.appendChild(results);
16 function test() {
17 setup();
19 mouseDownOnSelect("sl1", 1);
20 var expectedSelectionResults = new Array(false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
21 testResults("sl1", expectedSelectionResults, 1);
23 mouseDownOnSelect("sl1", 6);
24 expectedSelectionResults = new Array(false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false);
25 testResults("sl1", expectedSelectionResults, 2);
28 function mouseDownOnSelect(selId, index) {
29 var sl = document.getElementById(selId);
30 var itemHeight = 14 * 1.2;
31 var borderPaddingTop = 20 * 1.2;
32 var borderPaddingLeft = 20 * 1.2;
33 var y = index * itemHeight - window.pageYOffset + borderPaddingTop + itemHeight / 2;
35 var clickX = sl.offsetLeft + borderPaddingLeft + 5;
36 var clickY = sl.offsetTop + y;
37 eventSender.mouseMoveTo(clickX, clickY);
38 eventSender.mouseDown();
39 eventSender.mouseUp();
42 function testResults(selId, expectedArr, testNum) {
43 var sl = document.getElementById(selId);
44 var res = document.getElementById('res');
45 var resultsArr = new Array(sl.options.length);
47 var i;
48 for (i=0; i < sl.options.length; i++) {
49 resultsArr[i] = sl.options[i].selected;
51 var successString = "Failed";
52 var success = false;
53 if (expectedArr.join() == resultsArr.join()) {
54 success = true;
55 successString = "Passed";
58 log("Test " + testNum + " " + successString);
59 if (!success) {
60 log("<pre> Expected: " + expectedArr.join() + "<br>" + " Actual: " + resultsArr.join() + "</pre>");
64 function log(msg) {
65 var r = document.getElementById('res');
66 r.innerHTML = r.innerHTML + "<br>" + msg;
68 </script>
69 </head>
70 <body onload="test()">
72 <select id="sl1" multiple style="height: 135px; border: 10px solid; padding: 10px;">
73 <option>one</option>
74 <option>two</option>
75 <option>three</option>
76 <option>four</option>
77 <option>five</option>
78 <option>six</option>
79 <option>seven</option>
80 <option>eight</option>
81 <option>nine</option>
82 <option>ten</option>
83 <option>eleven</option>
84 <option>twelve</option>
85 <option>thirteen</option>
86 <option>fourteen</option>
87 <option>fifteen</option>
88 <option>sixteen</option>
89 <option>seventeen</option>
90 </select>
92 </body>
93 </html>