Bug 1692607 - Make table columns without an originating cell have cell spacing if their corresponding <col> has a non-zero definite computed size/min-size. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D105543
This commit is contained in:
Mats Palmgren 2021-02-18 20:41:40 +00:00
Родитель 49d84ca2c6
Коммит d69e62a8fd
9 изменённых файлов: 513 добавлений и 14 удалений

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

@ -1138,7 +1138,7 @@ fuzzy-if(skiaContent,0-1,0-3) == 442542-1.html 442542-1-ref.html
== 444375-1.html 444375-1-ref.html
== 444928-1.html 444928-1-ref.html
== 444928-2.html 444928-2-ref.html
!= 444928-3.html 444928-3-notref.html
== 444928-3.html 444928-3-ref.html
random == 445004-1.html 445004-1-ref.html # bug 472268
== 445142-1a.html 445142-1-ref.html
== 445142-1b.html 445142-1-ref.html

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

@ -3871,14 +3871,38 @@ void nsTableFrame::Dump(bool aDumpRows, bool aDumpCols, bool aDumpCellMap) {
#endif
bool nsTableFrame::ColumnHasCellSpacingBefore(int32_t aColIndex) const {
if (aColIndex == 0) {
return true;
}
// Since fixed-layout tables should not have their column sizes change
// as they load, we assume that all columns are significant.
if (LayoutStrategy()->GetType() == nsITableLayoutStrategy::Fixed) return true;
// the first column is always significant
if (aColIndex == 0) return true;
nsTableCellMap* cellMap = GetCellMap();
if (!cellMap) return false;
return cellMap->GetNumCellsOriginatingInCol(aColIndex) > 0;
auto* fif = static_cast<nsTableFrame*>(FirstInFlow());
if (fif->LayoutStrategy()->GetType() == nsITableLayoutStrategy::Fixed) {
return true;
}
nsTableCellMap* cellMap = fif->GetCellMap();
if (!cellMap) {
return false;
}
if (cellMap->GetNumCellsOriginatingInCol(aColIndex) > 0) {
return true;
}
// Check if we have a <col> element with a non-zero definite inline size.
// Note: percentages and calc(%) are intentionally not considered.
if (const auto* col = fif->GetColFrame(aColIndex)) {
const auto& iSize = col->StylePosition()->ISize(GetWritingMode());
if (iSize.ConvertsToLength() && iSize.ToLength() > 0) {
const auto& maxISize = col->StylePosition()->MaxISize(GetWritingMode());
if (!maxISize.ConvertsToLength() || maxISize.ToLength() > 0) {
return true;
}
}
const auto& minISize = col->StylePosition()->MinISize(GetWritingMode());
if (minISize.ConvertsToLength() && minISize.ToLength() > 0) {
return true;
}
}
return false;
}
/********************************************************************************

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

@ -1,7 +0,0 @@
[html5-table-formatting-2.html]
[Border-spacing is added between any two unmerged columns (1)]
expected: FAIL
[Border-spacing is added between any two unmerged columns (5)]
expected: FAIL

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

@ -0,0 +1,131 @@
<!doctype html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
<td style="border-color:white; border-style:solid"></td>
<td style="border-color:white; border-style:solid"></td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
<td style="border-color:white; border-style:solid"></td>
<td style="border-color:white; border-style:solid"></td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
<td style="border-color:white; border-style:solid"></td>
<td style="border-color:white; border-style:solid"></td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="width:40px">
<col style="width:40px">
<col style="width:40px">
<col style="width:40px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>

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

@ -0,0 +1,172 @@
<!doctype html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#missing-cells-fixup">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#total-horizontal-border-spacing">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#outer-max-content">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1692607">
<link rel="match" href="col-definite-max-size-001-ref.html">
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:0; width:100px">
<col style="max-width:0; width:100px">
<col style="max-width:0; width:100px">
<col style="max-width:0; width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:0; min-width:100px">
<col style="max-width:0; min-width:100px">
<col style="max-width:0; min-width:100px">
<col style="max-width:0; min-width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:10%; width:100px">
<col style="max-width:10%; width:100px">
<col style="max-width:10%; width:100px">
<col style="max-width:10%; width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:calc(100px + 1%); width:100px">
<col style="max-width:calc(100px + 1%); width:100px">
<col style="max-width:calc(100px + 1%); width:100px">
<col style="max-width:calc(100px + 1%); width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:0; width:calc(100px + 1%)">
<col style="max-width:0; width:calc(100px + 1%)">
<col style="max-width:0; width:calc(100px + 1%)">
<col style="max-width:0; width:calc(100px + 1%)">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:0; width:50%">
<col style="max-width:0; width:50%">
<col style="max-width:0; width:50%">
<col style="max-width:0; width:50%">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col>
<col>
<col style="max-width:0">
<col style="max-width:0">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:40px; width:100px">
<col style="max-width:40px; width:100px">
<col style="max-width:40px; width:100px">
<col style="max-width:40px; width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:40px; width:calc(100px + 1%)">
<col style="max-width:40px; width:calc(100px + 1%)">
<col style="max-width:40px; width:calc(100px + 1%)">
<col style="max-width:40px; width:calc(100px + 1%)">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="max-width:40px; width:50%">
<col style="max-width:40px; width:50%">
<col style="max-width:40px; width:50%">
<col style="max-width:40px; width:50%">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col>
<col>
<col style="max-width:40px">
<col style="max-width:40px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>

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

@ -0,0 +1,67 @@
<!doctype html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#missing-cells-fixup">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#total-horizontal-border-spacing">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#outer-max-content">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1692607">
<link rel="match" href="col-definite-size-001-ref.html">
<table border="1" cellspacing="10">
<colgroup>
<col style="min-width:100px">
<col style="min-width:100px">
<col style="min-width:100px">
<col style="min-width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="min-width:calc(100px + 1%)">
<col style="min-width:calc(100px + 1%)">
<col style="min-width:calc(100px + 1%)">
<col style="min-width:calc(100px + 1%)">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="min-width:50%">
<col style="min-width:50%">
<col style="min-width:50%">
<col style="min-width:50%">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col>
<col>
<col style="min-width:0">
<col style="min-width:0">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>

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

@ -0,0 +1,45 @@
<!doctype html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<table border="1" cellspacing="10">
<colgroup>
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
<td style="border-color:white; border-style:solid"></td>
<td style="border-color:white; border-style:solid"></td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>

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

@ -0,0 +1,67 @@
<!doctype html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#missing-cells-fixup">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#total-horizontal-border-spacing">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#outer-max-content">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1692607">
<link rel="match" href="col-definite-size-001-ref.html">
<table border="1" cellspacing="10">
<colgroup>
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
<col style="width:100px">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="width:calc(100px + 1%)">
<col style="width:calc(100px + 1%)">
<col style="width:calc(100px + 1%)">
<col style="width:calc(100px + 1%)">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col style="width:50%">
<col style="width:50%">
<col style="width:50%">
<col style="width:50%">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>
<table border="1" cellspacing="10">
<colgroup>
<col>
<col>
<col style="width:0">
<col style="width:0">
</colgroup>
<thead>
<tr>
<td>1</td>
<td>2</td>
</tr>
</thead>
</table>