зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1220621. When removing a <col>, only create an anonymous colframe to replace it if one is really needed. r=dbaron
This commit is contained in:
Родитель
9ecf8df931
Коммит
187d95cc83
|
@ -622,7 +622,24 @@ nsTableFrame::RemoveCol(nsTableColGroupFrame* aColGroupFrame,
|
|||
if (aRemoveFromCellMap) {
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) {
|
||||
AppendAnonymousColFrames(1);
|
||||
// If we have some anonymous cols at the end already, we just
|
||||
// add a new anonymous col.
|
||||
if (!mColFrames.IsEmpty() &&
|
||||
mColFrames.LastElement() && // XXXbz is this ever null?
|
||||
mColFrames.LastElement()->GetColType() == eColAnonymousCell) {
|
||||
AppendAnonymousColFrames(1);
|
||||
} else {
|
||||
// All of our colframes correspond to actual <col> tags. It's possible
|
||||
// that we still have at least as many <col> tags as we have logical
|
||||
// columns from cells, but we might have one less. Handle the latter
|
||||
// case as follows: First ask the cellmap to drop its last col if it
|
||||
// doesn't have any actual cells in it. Then call
|
||||
// MatchCellMapToColCache to append an anonymous column if it's needed;
|
||||
// this needs to be after RemoveColsAtEnd, since it will determine the
|
||||
// need for a new column frame based on the width of the cell map.
|
||||
cellMap->RemoveColsAtEnd();
|
||||
MatchCellMapToColCache(cellMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
// for now, just bail and recalc all of the collapsing borders
|
||||
|
@ -2534,10 +2551,30 @@ nsTableFrame::DoRemoveFrame(ChildListID aListID,
|
|||
}
|
||||
}
|
||||
|
||||
int32_t numAnonymousColsToAdd = GetColCount() - mColFrames.Length();
|
||||
if (numAnonymousColsToAdd > 0) {
|
||||
// this sets the child list, updates the col cache and cell map
|
||||
AppendAnonymousColFrames(numAnonymousColsToAdd);
|
||||
// If we have some anonymous cols at the end already, we just
|
||||
// add more of them.
|
||||
if (!mColFrames.IsEmpty() &&
|
||||
mColFrames.LastElement() && // XXXbz is this ever null?
|
||||
mColFrames.LastElement()->GetColType() == eColAnonymousCell) {
|
||||
int32_t numAnonymousColsToAdd = GetColCount() - mColFrames.Length();
|
||||
if (numAnonymousColsToAdd > 0) {
|
||||
// this sets the child list, updates the col cache and cell map
|
||||
AppendAnonymousColFrames(numAnonymousColsToAdd);
|
||||
}
|
||||
} else {
|
||||
// All of our colframes correspond to actual <col> tags. It's possible
|
||||
// that we still have at least as many <col> tags as we have logical
|
||||
// columns from cells, but we might have one less. Handle the latter case
|
||||
// as follows: First ask the cellmap to drop its last col if it doesn't
|
||||
// have any actual cells in it. Then call MatchCellMapToColCache to
|
||||
// append an anonymous column if it's needed; this needs to be after
|
||||
// RemoveColsAtEnd, since it will determine the need for a new column
|
||||
// frame based on the width of the cell map.
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) { // XXXbz is this ever null?
|
||||
cellMap->RemoveColsAtEnd();
|
||||
MatchCellMapToColCache(cellMap);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<td>One</td>
|
||||
<td>Two</td>
|
||||
<td>Three</td>
|
||||
</table>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
<td>Two</td>
|
||||
<td>Three</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the first col
|
||||
document.querySelector("col").remove();
|
||||
</script>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
<td>Two</td>
|
||||
<td>Three</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the first col
|
||||
document.querySelector("col").remove();
|
||||
</script>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
<td>Two</td>
|
||||
<td>Three</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the first col
|
||||
document.querySelector("col").remove();
|
||||
</script>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
<td>Two</td>
|
||||
<td>Three</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the first colgroup
|
||||
document.querySelector("colgroup").remove();
|
||||
</script>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
<td>Two</td>
|
||||
<td>Three</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the one colgroup
|
||||
document.querySelector("colgroup").remove();
|
||||
</script>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
<td>Two</td>
|
||||
<td>Three</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the one colgroup
|
||||
document.querySelector("colgroup").remove();
|
||||
</script>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the first col
|
||||
document.querySelector("col").remove();
|
||||
</script>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
}
|
||||
td {
|
||||
background: yellow;
|
||||
border: 1px solid purple;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<td>One</td>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var t = document.querySelector("table");
|
||||
// Flush layout
|
||||
var width = t.offsetWidth;
|
||||
// Remove the first col
|
||||
document.querySelector("colgroup").remove();
|
||||
</script>
|
|
@ -1 +1,9 @@
|
|||
== 1031934.html 1031934-ref.html
|
||||
== 1220621-1a.html 1220621-1-ref.html
|
||||
== 1220621-1b.html 1220621-1-ref.html
|
||||
== 1220621-1c.html 1220621-1-ref.html
|
||||
== 1220621-1d.html 1220621-1-ref.html
|
||||
== 1220621-1e.html 1220621-1-ref.html
|
||||
== 1220621-1f.html 1220621-1-ref.html
|
||||
== 1220621-2a.html 1220621-2-ref.html
|
||||
== 1220621-2b.html 1220621-2-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче