9 border-collapse: collapse;
13 border:
1px solid black;
21 <script src=
"../../resources/js-test.js"></script>
24 <table id=
"main" cellspacing=
"0" border=
"0" cellpadding=
"0">
28 <td>rect.bottom - rect.top
</td>
30 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
31 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
32 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
33 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
34 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
35 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
36 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
37 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
38 <tr><td>a
</td><td>b
</td><td>c
</td></tr>
41 This tests whether table row heights are stable by measuring the
42 height of a row, assigning that height to another row and then
44 For each row the numbers in the three cells should be the same.
47 <a href=
"https://bugs.webkit.org/show_bug.cgi?id=88813">Bug
88813</a>
50 <table id=
"measure" cellspacing=
"0" border=
"0" cellpadding=
"0">
51 <tr><td>Measurement
</td><td>table
</td><td>...
</td></tr>
55 var mainTable
= document
.getElementById('main');
56 var measureTable
= document
.getElementById('measure');
60 return Math
.round(n
* 1000) / 1000;
63 function computeHeights()
65 rowHeights
.length
= 0;
66 var rowElement
= measureTable
.tBodies
[0].rows
[0];
67 for (var i
= 0; i
< mainTable
.tBodies
[0].rows
.length
; i
++) {
68 // Set the size to a subpixel value, the exact value isn't
69 // important but each row should have a different height.
70 var height
= r((20 + i
) * 0.93 + i
);
71 rowElement
.style
.height
= height
+ 'px';
72 rect
= rowElement
.getBoundingClientRect();
73 rowHeights
.push(rect
.bottom
- rect
.top
);
78 function testHeights(zoom
)
80 document
.body
.style
.zoom
= zoom
;
83 var rows
= mainTable
.tBodies
[0].rows
;
84 for (var i
= 0; i
< rows
.length
; i
++) {
85 var rowElement
= rows
[i
];
86 rowElement
.style
.height
= rowHeights
[i
] + 'px';
87 var rect
= rowElement
.getBoundingClientRect();
89 rowElement
.cells
[0].firstChild
.nodeValue
= r(rowHeights
[i
]);
90 rowElement
.cells
[1].firstChild
.nodeValue
= r(rect
.height
);
91 rowElement
.cells
[2].firstChild
.nodeValue
= r(rect
.bottom
- rect
.top
);
96 for (var i
= 0; i
< rows
.length
; i
++) {
97 var rect
= rows
[i
].getBoundingClientRect();
98 if (r(rowHeights
[i
]) != r(rect
.height
)) {
99 testFailed('At ' + r(zoom
* 100) + '% zoom getBoundingClientRect returned a height of ' + r(rect
.height
) + ', expected ' + r(rowHeights
[i
]) + '.');
102 if (r(rowHeights
[i
]) != r(rect
.bottom
- rect
.top
)) {
103 testFailed('At ' + r(zoom
* 100) + '% zoom getBoundingClientRect returned a rect with bottom - top of ' + (rect
.bottom
- rect
.top
) + ', expected ' + rowHeights
[i
] + '.');
108 testPassed('At ' + r(zoom
* 100) + '% zoom all heights matched.');
122 if (window
.testRunner
)
123 document
.getElementById('main').style
.display
= 'none';