1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

LibWeb: Respect box-sizing in min-height calculation of grid container

This commit is contained in:
Aliaksandr Kalenik 2023-12-26 02:58:53 +01:00 committed by Andreas Kling
parent 92ae90085d
commit ed42b12123
3 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,9 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x300 children: not-inline
Box <div.box> at (8,208) content-size 784x100 [GFC] children: not-inline
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x300]
PaintableBox (Box<DIV>.box) [8,8 784x300]

View file

@ -0,0 +1,9 @@
<style type="text/css">
.box {
display: grid;
min-height: 300px;
padding-top: 200px;
box-sizing: border-box;
background-color: magenta;
}
</style><div class="box"></div>

View file

@ -1924,7 +1924,8 @@ void GridFormattingContext::run(Box const&, LayoutMode, AvailableSpace const& av
auto const& containing_block_state = m_state.get(*grid_container().containing_block());
auto height_of_containing_block = containing_block_state.content_height();
auto min_height = grid_container().computed_values().min_height().to_px(grid_container(), height_of_containing_block);
auto height_of_container_block_as_available_size = AvailableSize::make_definite(height_of_containing_block);
auto min_height = calculate_inner_height(grid_container(), height_of_container_block_as_available_size, grid_computed_values.min_height()).to_px(grid_container());
// If automatic grid container height is less than min-height, we need to re-run the track sizing algorithm
if (m_automatic_content_height < min_height) {