[css2] Fixed table layout: width distribution between non-auto columns

In http://dev.w3.org/csswg/css2/tables.html#fixed-table-layout
> The width of the table is then the greater of the value of the
> 'width' property for the table element and the sum of the column
> widths (plus cell spacing or borders). If the table is wider than the
> columns, the extra space should be distributed over the columns.

This does not say *how* the space is distributed. I assumed it was 
equally, but Firefox, Chromium, Safari and IE seem to have interop to 
make it proportional to the widths of the columns “so far”.

Test case:

<table style="table-layout: fixed; width: 400px; border-spacing: 0">
   <td width="50" style="background: #ff0000; height: 100px">
   <td width="150" style="background: #00ff00; height: 100px">
</table>

https://rawgit.com/servo/servo/59cdce30010/tests/ref/table_specified_width_a.html

The sum of the column widths at the beginning of the quoted part of the 
algorithm is 200px, and the width of the table is 400px. If the extra 
space (200px) was distributed equally, the columns would gain 100px each 
and end up at 150px and 250px. Instead, in every browser, they gain 50px 
and 150px respectively and end up at 100px and 300px.


Context:

https://github.com/servo/servo/pull/4114
https://github.com/servo/servo/issues/4121


I did not find a test case in 
http://test.csswg.org/suites/css21_dev/nightly-unstable/html4/chapter-17.htm#s17.5.2.1 
that seemed relevant.

-- 
Simon Sapin

Received on Thursday, 27 November 2014 17:31:20 UTC