Files
rust_browser/tests/goldens/fixtures/158-table-with-caption.html
Zachary D. Rowitsch f642f4f17c Fix tables with captions not rendering and add caption layout support
Tables with <caption> elements were invisible because normalize_children
treated TableRowGroup/TableRow/TableCell as inline-level, causing them to
be wrapped in anonymous blocks when mixed with the caption (Block). The
table layout algorithm then couldn't find row groups among direct children.

Three fixes:
- Add table-internal types to is_block_level in normalize_children and
  determine_formatting_context so they aren't incorrectly wrapped
- Add table-internal types to render_non_inline_descendants in the
  display list builder so they render when nested in inline contexts
- Implement caption layout in calculate_table_layout: captions are laid
  out as blocks above the table rows, with rows offset accordingly
- Add text-align: center to caption in UA stylesheet per CSS spec

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 00:24:29 -05:00

15 lines
298 B
HTML

<!DOCTYPE html>
<html>
<head><title>Table with caption</title></head>
<body>
<table>
<caption>Test Caption</caption>
<thead><tr><th>Header 1</th><th>Header 2</th></tr></thead>
<tbody>
<tr><td>Cell A</td><td>Cell B</td></tr>
<tr><td>Cell C</td><td>Cell D</td></tr>
</tbody>
</table>
</body>
</html>