You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LibWeb: Resolve percentage and explicit cell widths in fixed tables
In fixed table layouts, cell percentage widths were incorrectly being
resolved against the containing block of the table wrapper (the page)
instead of the table's computed width. This caused cells with
percentage widths to evaluate to incorrect absolute dimensions and throw
off the table column distribution logic.
This commit properly queries the table's computed width first and uses
that as the reference width when resolving percentage widths in
TableFormattingContext::compute_cell_measures(), ensuring that the math
adheres to the CSS Tables Level 3 Specification. Test baselines have
been updated to match the correct output.
Additionally, this commit follows explicit cell widths when calculating
fixed table layouts.
// 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.
135
+
if (computed_values.width().is_length() && (!use_fixed_mode_layout() || cell.row_index == 0)) {
// 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.
// 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.
333
+
if (fixed_layout && cell.row_index != 0)
334
+
continue;
335
+
}
307
336
auto cell_span_value = cell_span<RowOrColumn>(cell);
// 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.
// 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.
431
+
if (fixed_layout && cell.row_index != 0)
432
+
continue;
433
+
}
392
434
auto cell_span_value = cell_span<RowOrColumn>(cell);
393
435
if (cell_span_value == current_span) {
394
436
// Define the baseline max-content size as the sum of the max-content sizes based on cells of span up to N-1 of all columns that the cell spans.
// 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.
2009
+
if (fixed_layout && cell.row_index != 0)
2010
+
continue;
2011
+
}
1959
2012
auto cell_span_value = cell_span<RowOrColumn>(cell);
1960
2013
auto cell_start_rc_index = cell_index<RowOrColumn>(cell);
1961
2014
auto cell_end_rc_index = cell_start_rc_index + cell_span_value;
0 commit comments