1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibWeb: Make separate functions for calculating min/max content sizes

At first, these are just wrappers around calculate_intrinsic_sizes().
Eventually, we'll make them do only the work necessary for their
specific size.
This commit is contained in:
Andreas Kling 2022-07-08 00:40:53 +02:00
parent 1690d88887
commit 496cf39cf5
4 changed files with 35 additions and 30 deletions

View file

@ -123,7 +123,8 @@ void TableFormattingContext::calculate_column_widths(Box const& row, CSS::Length
(void)layout_inside(cell, LayoutMode::Normal);
if (cell.colspan() == 1) {
auto [min_width, max_width] = calculate_min_and_max_content_width(cell);
auto min_width = calculate_min_content_width(cell);
auto max_width = calculate_max_content_width(cell);
min_width = max(min_width, cell_state.border_box_width());
max_width = max(max_width, cell_state.border_box_width());
column_widths[column_index].min = max(column_widths[column_index].min, min_width);
@ -137,7 +138,8 @@ void TableFormattingContext::calculate_column_widths(Box const& row, CSS::Length
size_t colspan = cell.colspan();
if (colspan > 1) {
auto& cell_state = m_state.get_mutable(cell);
auto [min_width, max_width] = calculate_min_and_max_content_width(cell);
auto min_width = calculate_min_content_width(cell);
auto max_width = calculate_max_content_width(cell);
float missing_min = max(min_width, cell_state.border_box_width());
float missing_max = max(max_width, cell_state.border_box_width());
for (size_t i = 0; i < colspan; ++i) {