diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2023-01-14 15:52:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-14 19:22:08 +0100 |
commit | 9b6fcd85913a7049041de6206aaa4cfcd535591c (patch) | |
tree | d067e895556e051458855be8faa2348a6dc8816a /Userland/Libraries/LibWeb | |
parent | b44d977bf868f454dd2384bdc2ec0507e15e466b (diff) | |
download | serenity-9b6fcd85913a7049041de6206aaa4cfcd535591c.zip |
LibWeb: Stop using percentage column widths in `compute_table_measures`
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp index 7f0f037bf2..ee375191a3 100644 --- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -127,7 +127,9 @@ void TableFormattingContext::compute_table_measures() if (!computed_values.min_width().is_auto()) min_width = max(min_width, computed_values.min_width().resolved(cell.box, width_of_containing_block_as_length).to_px(cell.box)); - CSSPixels max_width = computed_values.width().is_auto() ? max_content_width.value() : width; + // NOTE: percentage column width cannot be used because it cannot be resolved correctly + // when final table width is not known yet + CSSPixels max_width = !computed_values.width().is_length() ? max_content_width.value() : width; if (!computed_values.max_width().is_none()) max_width = min(max_width, computed_values.max_width().resolved(cell.box, width_of_containing_block_as_length).to_px(cell.box)); @@ -140,7 +142,11 @@ void TableFormattingContext::compute_table_measures() } cell.min_width = min_width + cell_intrinsic_offsets; - cell.max_width = max(max(width, min_width), max_width) + cell_intrinsic_offsets; + if (!computed_values.width().is_percentage()) { + cell.max_width = max(max(width, min_width), max_width) + cell_intrinsic_offsets; + } else { + cell.max_width = max(min_width, max_width) + cell_intrinsic_offsets; + } max_cell_column_span = max(max_cell_column_span, cell.column_span); } |