blitz icon indicating copy to clipboard operation
blitz copied to clipboard

Tables: a column no cell starts in still takes a share of the width

Open devahschaefers opened this issue 1 week ago • 0 comments

If no cell starts in a column, because every cell that covers it is a colspan cell starting in an earlier column, browsers don't keep a column boundary there. That column is merged into its neighbour. Blitz still makes it a separate auto track, and the remaining width is split between the two. A cell in the first column alone then gets only half the table.

This is common in HTML email: a two-column table where every row is colspan=2 except one full-width image row. The image ends up at half width, or squeezed to nothing when it's a width:100% image with a small natural size.

<table style="width:600px" cellpadding="0" cellspacing="0">
<tr><td colspan="2">Heading text</td></tr>
<tr><td><div style="height:40px;background:#c33"></div></td></tr>
<tr><td colspan="2">More text</td></tr>
</table>

Blitz main vs Chromium

Chromium makes the red cell 600px wide; Blitz makes it 300px.

A possible fix, in build_table_context once the cells are collected:

  1. Find the set of columns in which some cell starts (plus column 0).
  2. If that set doesn't cover every column, renumber: a column becomes its rank in the set, and a cell's span becomes rank(start + span) - rank(start).
  3. Place the cells explicitly rather than with auto-placement, and drop the merged columns' <col> sizes or fold them into the surviving column.

Chromium calls these "effective columns".

🤖 Generated with Claude Code

devahschaefers avatar Nov 27 '26 21:11 devahschaefers