From 03949296c7df16c0fee7b7358673994efc0b891f Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Sat, 5 Nov 2022 20:39:09 +0100 Subject: LibWeb: Calculate grid content height using column width Should use the min_content_height function for calculating the height of content. Thanks to previous commits, are able to use the width of the column for this calculation. --- Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'Userland/Libraries/LibWeb/Layout') diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp index 4bd495923e..a301cf2485 100644 --- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp @@ -67,7 +67,6 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const int row_span { 1 }; int column { 0 }; int column_span { 1 }; - float computed_height { 0 }; }; Vector positioned_boxes; Vector boxes_to_place; @@ -657,16 +656,6 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const // FIXME: 4.2. For dense packing: } - for (auto& positioned_box : positioned_boxes) { - auto& child_box_state = m_state.get_mutable(positioned_box.box); - if (child_box_state.content_height() > positioned_box.computed_height) - positioned_box.computed_height = child_box_state.content_height(); - if (child_box_state.content_height() > positioned_box.computed_height) - positioned_box.computed_height = child_box_state.content_height(); - if (auto min_content_height = calculate_min_content_height(positioned_box.box, available_space.width); min_content_height > positioned_box.computed_height) - positioned_box.computed_height = min_content_height; - } - // https://drafts.csswg.org/css-grid/#overview-sizing // 2.3. Sizing the Grid // Once the grid items have been placed, the sizes of the grid tracks (rows and columns) are @@ -1370,7 +1359,7 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const // the size of the item’s content, it is considered a type of intrinsic size contribution. float grid_row_height = 0; for (auto& positioned_box : positioned_boxes_of_row) - grid_row_height = max(grid_row_height, positioned_box.computed_height); + grid_row_height = max(grid_row_height, calculate_min_content_height(positioned_box.box, AvailableSize::make_definite(m_grid_columns[positioned_box.column].base_size))); grid_row.base_size = grid_row_height; // - For min-content maximums: -- cgit v1.2.3