|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=414190 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 414190</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 </head> |
|
11 <body> |
|
12 |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414190">Mozilla Bug 414190</a> |
|
14 <p id="display"></p> |
|
15 |
|
16 <table id="table" border="0" cellspacing="0" cellpadding="0" |
|
17 style="width:100px; border:10px solid silver;"> |
|
18 <tr><td id="cell" style="height:100px;"></td></tr> |
|
19 <caption id="caption" style="caption-side:bottom; width:50px; height:70px; background:yellow;"></caption> |
|
20 </table> |
|
21 |
|
22 <div id="content" style="display: none"> |
|
23 |
|
24 </div> |
|
25 <pre id="test"> |
|
26 <script class="testbody" type="text/javascript"> |
|
27 |
|
28 function isEqualRect(r1, r2, r1border, s) { |
|
29 is(r1.left + r1border, r2.left, s + " (left)"); |
|
30 is(r1.right - r1border, r2.right, s + " (right)"); |
|
31 is(r1.top + r1border, r2.top, s + " (top)"); |
|
32 is(r1.bottom - r1border, r2.bottom, s + " (bottom)"); |
|
33 } |
|
34 |
|
35 var table = document.getElementById("table"); |
|
36 var cell = document.getElementById("cell"); |
|
37 var caption = document.getElementById("caption"); |
|
38 var tableRects = table.getClientRects(); |
|
39 var tableBoundingRect = table.getBoundingClientRect(); |
|
40 var cellBoundingRect = cell.getBoundingClientRect(); |
|
41 var captionBoundingRect = caption.getBoundingClientRect(); |
|
42 |
|
43 is(tableRects.length, 2, "Table should have rects for body and caption"); |
|
44 isEqualRect(tableRects[0], cellBoundingRect, 10, |
|
45 "Table first rect should be cell rect"); |
|
46 isEqualRect(tableRects[1], captionBoundingRect, 0, |
|
47 "Table second rect should be caption rect"); |
|
48 is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width"); |
|
49 is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height"); |
|
50 is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width"); |
|
51 is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height"); |
|
52 is(captionBoundingRect.top, cellBoundingRect.bottom + 10, "Discontiguous vertical geometry"); |
|
53 |
|
54 is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error"); |
|
55 is(tableBoundingRect.left, cellBoundingRect.left - 10, "Table left error"); |
|
56 is(tableBoundingRect.bottom, captionBoundingRect.bottom, "Table bottom error"); |
|
57 is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error"); |
|
58 |
|
59 caption.style.captionSide = "left"; |
|
60 |
|
61 tableRects = table.getClientRects(); |
|
62 tableBoundingRect = table.getBoundingClientRect(); |
|
63 cellBoundingRect = cell.getBoundingClientRect(); |
|
64 captionBoundingRect = caption.getBoundingClientRect(); |
|
65 |
|
66 is(tableRects.length, 2, "Table should have rects for body and caption"); |
|
67 isEqualRect(tableRects[0], cellBoundingRect, 10, |
|
68 "Table first rect should be cell rect plus border"); |
|
69 isEqualRect(tableRects[1], captionBoundingRect, 0, |
|
70 "Table second rect should be caption rect"); |
|
71 is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width"); |
|
72 is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height"); |
|
73 is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width"); |
|
74 is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height"); |
|
75 is(captionBoundingRect.right + 10, cellBoundingRect.left, "Discontiguous horizontal geometry"); |
|
76 is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error"); |
|
77 is(tableBoundingRect.left, captionBoundingRect.left, "Table left error"); |
|
78 is(tableBoundingRect.bottom, cellBoundingRect.bottom + 10, "Table bottom error"); |
|
79 is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error"); |
|
80 |
|
81 </script> |
|
82 </pre> |
|
83 </body> |
|
84 |
|
85 </html> |