diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp index 036b89221a..a2c15ce779 100644 --- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -91,9 +91,26 @@ void TableFormattingContext::calculate_column_widths(Box const& row, Vector([&](auto& cell) { + auto& cell_state = m_state.get_mutable(cell); + size_t colspan = cell.colspan(); + if (colspan != 1) { + float missing = cell_state.border_box_width(); + for (size_t i = 0; i < colspan; ++i) + missing -= column_widths[column_index + i]; + if (missing > 0) { + float extra = missing / (float)colspan; + for (size_t i = 0; i < colspan; ++i) + column_widths[column_index + i] += extra; + } + } + column_index += colspan; + }); } void TableFormattingContext::layout_row(Box const& row, Vector& column_widths)