summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authormartinfalisse <martinmotteditfalisse@gmail.com>2022-11-05 20:39:09 +0100
committerAndreas Kling <kling@serenityos.org>2022-11-06 13:23:33 +0100
commit03949296c7df16c0fee7b7358673994efc0b891f (patch)
tree759d88e46a40b4f6ec3c935d581390751139fe6b /Userland/Libraries/LibWeb/Layout
parent74748277477d34ef221dd2ed228404788065fa27 (diff)
downloadserenity-03949296c7df16c0fee7b7358673994efc0b891f.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r--Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp13
1 files changed, 1 insertions, 12 deletions
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<PositionedBox> positioned_boxes;
Vector<Box const&> 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: