When inserting a col into a colgroup after a col with span, insert it after the last columnframe spanned by the span. Bug 404301, r=bernd, sr=roc, a=schrep

This commit is contained in:
bzbarsky@mit.edu 2007-11-19 20:29:40 -08:00
Родитель c712e87488
Коммит 6378bc4809
4 изменённых файлов: 75 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<style>
table { background: white }
col[span] { background: green }
td { color: white }
</style>
</head>
<body>
<table>
<colgroup id="x">
<col span="2"></col>
<col></col>
<col id="y"></col>
</colgroup>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
</tr>
</table>
</body>
</html>

Просмотреть файл

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<style>
table { background: white }
col[span] { background: green }
td { color: white }
</style>
</head>
<body onload="runTest()">
<table>
<colgroup id="x">
<col span="2"></col>
<col id="y"></col>
</colgroup>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
</tr>
</table>
<script>
function runTest() {
document.body.offsetWidth;
document.getElementById("x").insertBefore(document.createElement("col"),
document.getElementById("y"));
}
</script>
</body>
</html>

Просмотреть файл

@ -472,3 +472,4 @@ fails == 386310-1d.html 386310-1-ref.html
== 404030-1.html 404030-1-ref.html
!= 404030-1-notref.html 404030-1.html
!= 404030-1-notref2.html 404030-1.html
+== 404301-1.html 404301-1-ref.html

Просмотреть файл

@ -215,7 +215,9 @@ nsTableColGroupFrame::AppendFrames(nsIAtom* aListName,
nsTableColFrame* nextCol;
while (col && col->GetColType() == eColAnonymousColGroup) {
// this colgroup spans one or more columns but now that there is a
// real column below, spanned anonymous columns should be removed
// real column below, spanned anonymous columns should be removed,
// since the HTML spec says to ignore the span of a colgroup if it
// has content columns in it.
nextCol = col->GetNextCol();
RemoveFrame(nsnull, col);
col = nextCol;
@ -241,13 +243,25 @@ nsTableColGroupFrame::InsertFrames(nsIAtom* aListName,
nsTableColFrame* col = GetFirstColumn();
nsTableColFrame* nextCol;
while (col && col->GetColType() == eColAnonymousColGroup) {
// this colgroup spans one or more columns but now that there is
// real column below, spanned anonymous columns should be removed
// this colgroup spans one or more columns but now that there is a
// real column below, spanned anonymous columns should be removed,
// since the HTML spec says to ignore the span of a colgroup if it
// has content columns in it.
nextCol = col->GetNextCol();
RemoveFrame(nsnull, col);
col = nextCol;
}
if (aPrevFrame) {
col = GetNextColumn(aPrevFrame);
while (col && col->GetColType() == eColAnonymousCol) {
// This is a column frame from a <col span="N">. We want to
// insert our new frame after the end of this span
aPrevFrame = col;
col = col->GetNextCol();
}
}
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
nsIFrame* prevFrame = nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame,
nsGkAtoms::tableColFrame);