Bug 1031934 - Handle collapsing a row / row-group with no cell frames inside it. r=roc

This commit is contained in:
Mats Palmgren 2014-07-01 17:58:13 +00:00
parent 37720865c9
commit c28f9e7e6f
7 changed files with 123 additions and 15 deletions

View File

@ -299,6 +299,8 @@ include table-overflow/reftest.list
# table-width/
include table-width/reftest.list
include ../tables/reftests/reftest.list
# text/
include text/reftest.list

View File

@ -0,0 +1,18 @@
<html>
<head>
</head>
<body>
<table>
<tbody style="visibility: collapse;">
<tr><td hidden=""></td></tr>
</tbody>
</table>
<table>
<tbody>
<tr style="visibility: collapse;"><td hidden=""></td></tr>
</tbody>
</table>
</body>
</html>

View File

@ -140,3 +140,4 @@ load 710098-1.html
load 759249-1.html
load 759249-2.html
load 814713.html
load 1031934.html

View File

@ -1142,23 +1142,28 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
nscoord shift = 0;
if (aCollapseGroup || collapseRow) {
nsTableCellFrame* cellFrame = GetFirstCell();
aDidCollapse = true;
int32_t rowIndex;
cellFrame->GetRowIndex(rowIndex);
shift = rowRect.height + tableFrame->GetCellSpacingY(rowIndex);
while (cellFrame) {
nsRect cRect = cellFrame->GetRect();
// If aRowOffset != 0, there's no point in invalidating the cells, since
// we've already invalidated our overflow area. Note that we _do_ still
// need to invalidate if our row is not moving, because the cell might
// span out of this row, so invalidating our row rect won't do enough.
if (aRowOffset == 0) {
InvalidateFrame();
shift = rowRect.height;
nsTableCellFrame* cellFrame = GetFirstCell();
if (cellFrame) {
int32_t rowIndex;
cellFrame->GetRowIndex(rowIndex);
shift += tableFrame->GetCellSpacingY(rowIndex);
while (cellFrame) {
nsRect cRect = cellFrame->GetRect();
// If aRowOffset != 0, there's no point in invalidating the cells, since
// we've already invalidated our overflow area. Note that we _do_ still
// need to invalidate if our row is not moving, because the cell might
// span out of this row, so invalidating our row rect won't do enough.
if (aRowOffset == 0) {
InvalidateFrame();
}
cRect.height = 0;
cellFrame->SetRect(cRect);
cellFrame = cellFrame->GetNextCell();
}
cRect.height = 0;
cellFrame->SetRect(cRect);
cellFrame = cellFrame->GetNextCell();
} else {
shift += tableFrame->GetCellSpacingY(GetRowIndex());
}
rowRect.height = 0;
}

View File

@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title>Testcase for bug 1031934</title>
</head>
<body>
<table border="1">
<tbody style="visibility: collapse;">
</tbody>
<tbody>
<tr><td>Hello</td></tr>
</tbody>
<tbody style="visibility: collapse;">
</tbody>
</table>
<table border="1">
<tbody></tbody>
<tbody>
<tr><td>Hello</td></tr>
</tbody>
<tbody></tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title>Testcase for bug 1031934</title>
<style type="text/css">
td { display:none; }
</style>
</head>
<body>
<table border="1">
<tbody style="visibility: collapse;">
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
</tbody>
<tbody>
<tr><td></td></tr>
<tr><td style="display:table-cell">Hello</td></tr>
<tr><td></td></tr>
</tbody>
<tbody style="visibility: collapse;">
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
</tbody>
</table>
<table border="1">
<tbody>
<tr style="visibility: collapse;"><td></td></tr>
<tr style="visibility: collapse;"><td></td></tr>
<tr style="visibility: collapse;"><td></td></tr>
</tbody>
<tbody>
<tr><td></td></tr>
<tr><td style="display:table-cell">Hello</td></tr>
<tr><td></td></tr>
</tbody>
<tbody style="visibility: collapse;">
<tr style="visibility: collapse;"><td></td></tr>
<tr style="visibility: collapse;"><td></td></tr>
<tr style="visibility: collapse;"><td></td></tr>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1 @@
== 1031934.html 1031934-ref.html