[csswg-drafts] [css-tables-3] Need clarification on column widths for fixed width table (#4512)

atotic has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-tables-3] Need clarification on column widths for fixed width table ==
Consider this table, fixed width, where thead has fewer columns than body.

```html
    <table style="table-layout: fixed; width: 100px;">
      <thead>
          <tr>
              <td>head 0,0</td>
          </tr>
      </thead>
      <tbody>
      <tr>
          <td>0,0</td>
          <td>1,0</td>
      </tr>
      </tbody>
    </table>
```
What should the width of the 2nd column be?

Current implementations divide 100px evenly between 1st and 2nd column.
This means that even in fixed mode, we have to traverse the entire table at least twice during layout: 
- first time, compute column widths from 1st cell, and then traverse the rest of the table to compute how many columns table has.
- second time, to compute row heights based upon column widths.

Which is a bummer, because the entire purpose of fixed width table was to make layout "single pass". We do avoid computing column constraints for each cell, but we have to perform traversal just to find table's dimensions.

Relevant part of the spec:
https://drafts.csswg.org/css-tables-3/#computing-column-measures

For the purpose of measuring a column when laid out in fixed mode, only cells which originate in the first row of the table (after reordering the header and footer) will be considered, if any. In addition, the min-content and max-content width of cells is considered zero unless they are directly specified as a length-percentage, in which case they are resolved based on the table width (if it is definite, otherwise use 0).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4512 using your GitHub account

Received on Saturday, 16 November 2019 01:11:19 UTC