Empty columns doesn't apply CSS border-spacing (cellspacing)
Categories
(Core :: Layout: Tables, defect, P4)
Tracking
()
Tracking | Status | |
---|---|---|
firefox87 | --- | fixed |
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
Details
(Keywords: testcase)
Attachments
(2 files)
Kudos to atotic@chromium.org for finding this bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1173766#c5
The two tables in Testcase #1 should have the same border-box width.
I'm guessing we're missing to apply border-spacing
between empty columns.
https://drafts.csswg.org/css-tables-3/#total-horizontal-border-spacing
Comment 1•4 years ago
|
||
I've developed a comprehensive test case for column-track merging in wpt.
If you are fixing issues with it, it might come in useful:
https://wpt.fyi/results/css/css-tables/column-track-merging.html?label=experimental&label=master&aligned
Assignee | ||
Comment 2•4 years ago
|
||
Nice, thanks Aleks.
Assignee | ||
Comment 3•4 years ago
|
||
So, we actually skip cell-spacing for empty columns intentionally:
https://searchfox.org/mozilla-central/rev/bf03edd45ee0804f382c1f05ec88a05f5d88833c/layout/tables/nsTableFrame.cpp#3873
I wonder if the spec said something different in the past?
Returning true
there makes the testcase renders as expected.
I guess we should change it to check for <col>
with an explicit size instead.
Comment 4•4 years ago
|
||
I see. You explicitly return false if COL is inside auto table, and has no originating cells.
I think explicit size is a better criteria, since that matches what happens in fixed. It would also make sense to developers: if you specify column widths, you do not want table to change size when you add cells later.
I do not think that standard is explicit about this. Every browser did something different: Chrome/Safari/IE just merged COLs without originating cells, whether they had widths or not. That was clearly against the standard. FF was the most standard compliant.
I'd like to ship "COLs have border-spacing" in Chrome if it is web compatible. My code will be in M91 for sure, and maybe M90.
I think FF will be happy with the new Chrome tables implementation, it is closer to FF that Chrome Legacy. I wrote a bunch of tests testing what I believe standard should be, and am slowly landing them in css/css-tables/tentative.
Also thank you for having the most standard-compliant implementation. Without it, my job would have been much harder.
Assignee | ||
Comment 5•4 years ago
|
||
Assignee | ||
Comment 6•4 years ago
|
||
Aleks, I think the check should be non-zero definite size, so width:10%
, width:calc(100px + 1%)
and width:0
should all be ignored when there's no originating cell. Firefox, Safari and Chrome (Legacy) all agree on that. Chrome TablesNG is incompatible. I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1179497 about that.
Comment 9•4 years ago
|
||
I can do this. Just want to make sure this is what we want.
Usually, these questions are resolved by csswg. Tables have been shipping since '95 and standard is still very incomplete.
For example, for mergeable tracks, this is what we get:
track is mergeable if "there is no table-column/table-row box defining the said track explicitly".
0px widths, %ge vs px, none of that is covered by the standard.
Is merging %ge columns the right thing to do?
Browser implementor viewpoint:
- FF does it, and FF was the most standard compliant, rational, table implementation of all browsers. For me, this is the best supporting argument.
- Safari/LegacyChrome do it, but they also merge all columns.
Developer viewpoint:
When would a developer care about mergeable columns? The best use case I could come up with is this:
I have a table whose data has not loaded yet. I'd like table columns to keep the same width after data is loaded.
My header columns have colspan>1 cells, defining several mergeable columns. N
<th colspan=2>Foo</th>
<th colspan=2>Bar</th>
I've split the Foo and Bar field into two cells in the data part of the table, so a data line looks something like this:
<td>Phooey</td>
<td>Fooey</td>
<td>Barsky</td>
<td>Zbasky</td>
And I'd like my data columns to have following widths: 20% 30% 20% 30%, so I add these tags:
<col style="width:20%">
<col style="width:30%">
<col style="width:20%">
<col style="width:30%">
Your proposal is to ignore the %ges. I feel that the developer would expect the %ges to behave like pixels.
No browser does this today, but they all do something different.
I am not sure whether not ignoring %ges is even an option, whether it is web compatible.
I am already concerned about not merging pixel columns, because only FF does it..
I'll have more data about any web compatibility problems once TablesNG enter beta.
My feeling is that because empty column widths were so incompatible, developers did not rely on them behaving in any particular way.
Comment 10•4 years ago
|
||
Wait, I just took a look at my column merging test:
http://wpt.live/css/css-tables/column-track-merging.html
Here, Firefox does not merge %ge columns in test #12.
I thought that <col span=5> might be the problem, but 5 cols behave the same way.
Comment 11•4 years ago
|
||
Backed out changeset 5085098b5d9a (bug 1692607) for WPT failures incss/css-tables/column-track-merging.html. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer?job_id=330437076&repo=autoland&lineNumber=2214
Push with failures:
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&revision=5085098b5d9a37601ef2b2a708fb23a224a2ff00
Backout:
https://hg.mozilla.org/integration/autoland/rev/e1a62d5ace129ba9e58b452e37bcb5a2ddf08dbc
Assignee | ||
Comment 13•4 years ago
|
||
The failure is TEST-UNEXPECTED-PASS, fwiw. It's odd that it only failed on Android given that we don't have any platform specific code in table layout. Maybe this change tickles an existing incremental reflow bug on this platform only?
Anyway, the failure doesn't indicate that anything is wrong with the patch per se, so I'll just annotate that test as random on that platform for now and reland it...
Comment 14•4 years ago
|
||
Comment 15•4 years ago
|
||
Comment 16•4 years ago
|
||
Comment 18•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c4132e0c4149
https://hg.mozilla.org/mozilla-central/rev/40ce0fdd47c0
Assignee | ||
Comment 19•4 years ago
|
||
(In reply to Aleks Totic from comment #9)
My feeling is that because empty column widths were so incompatible, developers did not rely on them behaving in any particular way.
Yeah, I don't feel strongly either way. In this bug I'm only addressing the issue that we failed to add in the border spacing for the non-zero columns that were there, which is clearly wrong.
FYI, I haven't been involved in the css-tables spec discussions so I don't know how much consensus there is on this particular issue. I just filed the Chromium issue since it seemed Firefox and the spec agreed on that test. Reading the spec again, I'm less sure what the intent of the spec really is regarding merging columns... Perhaps it would be simpler to just merge all columns that don't have an originating cell (in auto mode)? And not merge any columns in fixed mode.
I filed https://github.com/w3c/csswg-drafts/issues/6023 to sort this out.
Comment 20•4 years ago
|
||
bugherder |
Description
•