Git init
[framework/web/webkit-efl.git] / LayoutTests / fast / writing-mode / table-hit-test.html
1 <style>
2     body { margin: 0; }
3     caption div { width: 50px; height: 50px; }
4     td { width: 50px; height: 25px; }
5     #console { margin: 8px; }
6 </style>
7 <table cellpadding="0" cellspacing="0" id="table">
8     <tbody>
9         <tr>
10             <td id="1-1-1"></td>
11             <td id="1-1-2"></td>
12             <td id="1-1-3"></td>
13         </tr>
14         <tr>
15             <td id="1-2-1"></td>
16             <td id="1-2-2"></td>
17             <td id="1-2-3"></td>
18         </tr>
19     </tbody>
20     <tbody>
21         <tr>
22             <td id="2-1-1"></td>
23             <td id="2-1-2"></td>
24             <td id="2-1-3"></td>
25         </tr>
26     </tbody>
27     <caption id="c">
28         <div></div>
29     </caption>
30 </table>
31 <pre id="console"></pre>
32 <script>
33     if (window.layoutTestController)
34         layoutTestController.dumpAsText();
35
36     function log(message)
37     {
38         document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
39     }
40
41     function checkElementAtPoint(x, y, id)
42     {
43         var actualID = document.elementFromPoint(x, y).id;
44         if (actualID === id)
45             log("PASS: " + id + " at (" + x + ", " + y + ")");
46         else
47             log("FAIL: " + actualID + " instead of " + id + " at (" + x + ", " + y + ")");
48     }
49
50     var style = document.getElementById("table").style;
51
52     checkElementAtPoint(1, 1, "c");
53     checkElementAtPoint(1, 51, "1-1-1");
54     checkElementAtPoint(51, 51, "1-1-2");
55     checkElementAtPoint(101, 51, "1-1-3");
56     checkElementAtPoint(1, 76, "1-2-1");
57     checkElementAtPoint(51, 76, "1-2-2");
58     checkElementAtPoint(101, 76, "1-2-3");
59     checkElementAtPoint(1, 101, "2-1-1");
60     checkElementAtPoint(51, 101, "2-1-2");
61     checkElementAtPoint(101, 101, "2-1-3");
62
63     log("\nTesting horizontal-bt:");
64     style.webkitWritingMode = "horizontal-bt";
65     checkElementAtPoint(1, 101, "c");
66     checkElementAtPoint(1, 51, "1-1-1");
67     checkElementAtPoint(51, 51, "1-1-2");
68     checkElementAtPoint(101, 51, "1-1-3");
69     checkElementAtPoint(1, 26, "1-2-1");
70     checkElementAtPoint(51, 26, "1-2-2");
71     checkElementAtPoint(101, 26, "1-2-3");
72     checkElementAtPoint(1, 1, "2-1-1");
73     checkElementAtPoint(51, 1, "2-1-2");
74     checkElementAtPoint(101, 1, "2-1-3");
75
76     log("\nTesting vertical-lr:");
77     style.webkitWritingMode = "vertical-lr";
78     checkElementAtPoint(1, 1, "c");
79     checkElementAtPoint(51, 1, "1-1-1");
80     checkElementAtPoint(51, 26, "1-1-2");
81     checkElementAtPoint(51, 51, "1-1-3");
82     checkElementAtPoint(101, 1, "1-2-1");
83     checkElementAtPoint(101, 26, "1-2-2");
84     checkElementAtPoint(101, 51, "1-2-3");
85     checkElementAtPoint(151, 1, "2-1-1");
86     checkElementAtPoint(151, 26, "2-1-2");
87     checkElementAtPoint(151, 51, "2-1-3");
88
89     log("\nTesting vertical-rl:");
90     style.webkitWritingMode = "vertical-rl";
91     checkElementAtPoint(151, 1, "c");
92     checkElementAtPoint(101, 1, "1-1-1");
93     checkElementAtPoint(101, 26, "1-1-2");
94     checkElementAtPoint(101, 51, "1-1-3");
95     checkElementAtPoint(51, 1, "1-2-1");
96     checkElementAtPoint(51, 26, "1-2-2");
97     checkElementAtPoint(51, 51, "1-2-3");
98     checkElementAtPoint(1, 1, "2-1-1");
99     checkElementAtPoint(1, 26, "2-1-2");
100     checkElementAtPoint(1, 51, "2-1-3");
101 </script>