4 <script src=
"../../resources/js-test.js"></script>
8 description("An event generated on the edge of a table cell is not being consumed by the appropriate underlying element. This test verifies that the hittest result on the right edge of a table cell (with borders) returns the proper underlying element.");
11 ['tr1-td1', 'tr1-td2', 'tr1-td3', 'tr1-td4',
12 'tr2-td1', 'tr2-td2', 'tr2-td3', 'tr2-td4',
13 'tr3-td1', 'tr3-td2', 'tr3-td3', 'tr3-td4',
14 'tr4-td1', 'tr4-td2', 'tr4-td3', 'tr4-td4'].forEach(function(a
) {
15 ele
[a
] = document
.getElementById(a
);
17 ele
[a
].innerHTML
= '';
20 isSuccessfullyParsed();
22 function hittest(ele
, orgElement
, expected1
, expected2
)
24 edge
= ele
.getBoundingClientRect().right
;
25 middleY
= ele
.getBoundingClientRect().bottom
/ 2;
26 debug('Executing for element '+orgElement
+' on the right edge of the table cell:');
30 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr1-td1'");
31 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr1-td2'");
32 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr1-td2'");
35 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr1-td2'");
36 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr1-td3'");
37 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr1-td3'");
40 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr1-td3'");
41 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr1-td4'");
42 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr1-td4'");
45 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr1-td4'");
46 shouldBe("document.elementFromPoint(edge, middleY).id", "''");
47 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "''");
50 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr2-td1'");
51 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr2-td2'");
52 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr2-td2'");
55 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr2-td2'");
56 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr2-td3'");
57 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr2-td3'");
60 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr2-td3'");
61 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr2-td4'");
62 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr2-td4'");
65 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr2-td4'");
66 shouldBe("document.elementFromPoint(edge, middleY).id", "''");
67 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "''");
70 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "''");
71 shouldBe("document.elementFromPoint(edge, middleY).id", "''");
72 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "''");
76 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "''");
77 shouldBe("document.elementFromPoint(edge, middleY).id", "''");
78 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "''");
81 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "''");
82 shouldBe("document.elementFromPoint(edge, middleY).id", "''");
83 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "''");
86 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr4-td1'");
87 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr4-td2'");
88 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr4-td2'");
91 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr4-td2'");
92 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr4-td3'");
93 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr4-td3'");
96 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr4-td3'");
97 shouldBe("document.elementFromPoint(edge, middleY).id", "'tr4-td4'");
98 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "'tr4-td4'");
101 shouldBe("document.elementFromPoint(edge - 1, middleY).id", "'tr4-td4'");
102 shouldBe("document.elementFromPoint(edge, middleY).id", "''");
103 shouldBe("document.elementFromPoint(edge + 1, middleY).id", "''");
119 border:
1px solid black;
123 <body onload=
"test()">
124 <p>Test for Bugzilla
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=74864">Bug
74864</a>: There is additional space not belonged to a table between the table cells.
</p>
125 <table cellspacing=
0>
127 <td id=
"tr1-td1">1</td>
128 <td id=
"tr1-td2">1</td>
129 <td id=
"tr1-td3"></td>
130 <td id=
"tr1-td4">1</td>
133 <td id=
"tr2-td1">1</td>
134 <td id=
"tr2-td2">1</td>
135 <td id=
"tr2-td3"></td>
136 <td id=
"tr2-td4">1</td>
139 <td id=
"tr3-td1"></td>
140 <td id=
"tr3-td2"></td>
141 <td id=
"tr3-td3"></td>
142 <td id=
"tr3-td4"></td>
145 <td id=
"tr4-td1">1</td>
146 <td id=
"tr4-td2">1</td>
147 <td id=
"tr4-td3"></td>
148 <td id=
"tr4-td4">1</td>
151 <p id=
"description"></p>
152 <div id=
"console"></div>