Bug 1652384 - When inserting a col frame, invalidate all subsequent column BC borders. r=mats

This is the same fix as the fix for bug 711359, basically... We don't
shift the damage area otherwise which means that we would incorrectly
miss computing some borders.

Differential Revision: https://phabricator.services.mozilla.com/D84920
This commit is contained in:
Emilio Cobos Álvarez 2020-07-26 19:02:12 +00:00
parent 33defe2786
commit 00e140a8f8
3 changed files with 99 additions and 1 deletions

View File

@ -593,7 +593,8 @@ void nsTableFrame::InsertCol(nsTableColFrame& aColFrame, int32_t aColIndex) {
}
// for now, just bail and recalc all of the collapsing borders
if (IsBorderCollapse()) {
TableArea damageArea(aColIndex, 0, 1, GetRowCount());
TableArea damageArea(aColIndex, 0, GetColCount() - aColIndex,
GetRowCount());
AddBCDamageArea(damageArea);
}
}

View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Test Reference</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<style>
table {
border-collapse: collapse;
border-spacing: 0;
}
td {
padding: 10px;
border: 1px solid;
}
</style>
<table>
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Test: Border collapsed table with a dynamic &lt;col&gt; insertion</title>
<link rel="help" href="https://drafts.csswg.org/css-tables/#border-collapsing">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1652384">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="match" href="border-collapse-dynamic-col-001-ref.html">
<style>
table {
border-collapse: collapse;
border-spacing: 0;
}
td {
padding: 10px;
border: 1px solid;
}
</style>
<table>
<colgroup>
<col>
<col>
<col>
</colgroup>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<script>
document.querySelector("table").getBoundingClientRect();
// Insert a column at the second position.
var trs = document.querySelectorAll("tr");
var col = document.querySelector("col");
col.parentNode.insertBefore(col.cloneNode(true), col.nextSibling);
for (var i = 0; i < trs.length; ++i) {
var row = trs[i];
var firstCell = row.querySelector("td");
firstCell.parentNode.insertBefore(firstCell.cloneNode(true), firstCell.nextSibling);
}
</script>