Fix regression in sizing of tables with scrollable rowgroups. Bug 387344,

r=bernd, sr=roc
This commit is contained in:
bzbarsky@mit.edu 2007-07-12 13:54:18 -07:00
parent 0de7a6f973
commit 4e0e5d2463
4 changed files with 46 additions and 4 deletions

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<body>
<table>
<tbody style="height: 100px; overflow: scroll; font-size: 20px">
<tr><td>Test 1</td></tr>
<tr><td>Test 2</td></tr>
<tr><td>Test 3</td></tr>
<tr><td>Test 4</td></tr>
<tr><td>Test 5</td></tr>
<tr><td>Test 6</td></tr>
<tr><td>Test 7</td></tr>
</tbody>
</table>
This text should be right up against the table.
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<body>
<table>
<tbody style="height: 100px; overflow: scroll; font-size: 20px">
<tr><td>Test 1</td></tr>
<tr><td>Test 2</td></tr>
<tr><td>Test 3</td></tr>
<tr><td>Test 4</td></tr>
<tr><td>Test 5</td></tr>
<tr><td>Test 6</td></tr>
<tr><td>Test 7</td></tr>
<tr><td>Test 8</td></tr>
<tr><td>Test 9</td></tr>
</tbody>
</table>
This text should be right up against the table.
</body>
</html>

View File

@ -276,3 +276,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 379316-2.html 379316-2-ref.html # bug
== 382600-1.html 382600-1-ref.html
== 383551-1.html 383551-1-ref.html
== 384576-1.html 384576-1-ref.html
== 387344-1.html 387344-1-ref.html

View File

@ -3085,9 +3085,14 @@ nsTableFrame::CalcDesiredHeight(const nsHTMLReflowState& aReflowState, nsHTMLRef
nsMargin borderPadding = GetChildAreaOffset(&aReflowState);
// get the natural height based on the last child's (row group or scroll frame) rect
RowGroupArray rowGroups;
OrderRowGroups(rowGroups);
if (rowGroups.Length() == 0) {
FrameArray rowGroups;
PRUint32 numRowGroups;
{
// Scope for the dummies so we don't use them by accident
nsTableRowGroupFrame *dummy1, *dummy2;
numRowGroups = OrderRowGroups(rowGroups, &dummy1, &dummy2);
}
if (numRowGroups == 0) {
// tables can be used as rectangular items without content
nscoord tableSpecifiedHeight = CalcBorderBoxHeight(aReflowState);
if ((NS_UNCONSTRAINEDSIZE != tableSpecifiedHeight) &&
@ -3105,7 +3110,7 @@ nsTableFrame::CalcDesiredHeight(const nsHTMLReflowState& aReflowState, nsHTMLRef
nscoord desiredHeight = borderPadding.top + borderPadding.bottom;
if (rowCount > 0 && colCount > 0) {
desiredHeight += cellSpacingY;
for (PRUint32 rgX = 0; rgX < rowGroups.Length(); rgX++) {
for (PRUint32 rgX = 0; rgX < numRowGroups; rgX++) {
desiredHeight += rowGroups[rgX]->GetSize().height + cellSpacingY;
}
}