layout: Include spanned gutters when laying out contents of table cell (#38290)

If a cell would e.g. span 2 columns, each 50px wide, separated by a 10px
gutter, then we used to lay out the contents of the cell with a 100px
wide containing block. Now we will include the size of the gutter.

Testing: Adding new test
Fixes: #38277

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-07-29 10:57:22 +02:00 committed by GitHub
parent 61273a4321
commit 7ce5de4e2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 1 deletions

View file

@ -1091,11 +1091,14 @@ impl<'a> TableLayout<'a> {
.padding(containing_block_for_table.style.writing_mode)
.percentages_relative_to(self.basis_for_cell_padding_percentage);
let inline_border_padding_sum = border.inline_sum() + padding.inline_sum();
let border_spacing_spanned =
self.table.border_spacing().inline * (cell.colspan - 1) as i32;
let mut total_cell_width: Au = (coordinate.x..coordinate.x + cell.colspan)
.map(|column_index| self.distributed_column_widths[column_index])
.sum::<Au>() -
inline_border_padding_sum;
inline_border_padding_sum +
border_spacing_spanned;
total_cell_width = total_cell_width.max(Au::zero());
let containing_block_for_children = ContainingBlock {