diff --git a/Tests/LibWeb/Layout/expected/grid/abspos-item-with-grid-area-and-percentage-size-2.txt b/Tests/LibWeb/Layout/expected/grid/abspos-item-with-grid-area-and-percentage-size-2.txt new file mode 100644 index 00000000000..44b5cbf48f4 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/grid/abspos-item-with-grid-area-and-percentage-size-2.txt @@ -0,0 +1,11 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (1,1) content-size 798x220 [BFC] children: not-inline + BlockContainer at (10,10) content-size 780x202 children: not-inline + Box at (11,11) content-size 200x200 positioned [GFC] children: not-inline + BlockContainer at (112,12) content-size 50x100 positioned [BFC] children: not-inline + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x222] + PaintableWithLines (BlockContainer) [9,9 782x204] + PaintableBox (Box
.grid) [10,10 202x202] + PaintableWithLines (BlockContainer
.abspos-item) [111,11 52x102] diff --git a/Tests/LibWeb/Layout/input/grid/abspos-item-with-grid-area-and-percentage-size-2.html b/Tests/LibWeb/Layout/input/grid/abspos-item-with-grid-area-and-percentage-size-2.html new file mode 100644 index 00000000000..372b4edaecc --- /dev/null +++ b/Tests/LibWeb/Layout/input/grid/abspos-item-with-grid-area-and-percentage-size-2.html @@ -0,0 +1,24 @@ +
\ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index b4cbec91b6c..4aff93f8e5e 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -1639,19 +1639,10 @@ CSSPixels FormattingContext::calculate_inner_width(Layout::Box const& box, Avail return width.resolved(box, width_of_containing_block).to_px(box); } -CSSPixels FormattingContext::calculate_inner_height(Layout::Box const& box, AvailableSize const&, CSS::Size const& height) const +CSSPixels FormattingContext::calculate_inner_height(Layout::Box const& box, AvailableSize const& available_height, CSS::Size const& height) const { VERIFY(!height.is_auto()); - - auto const* containing_block = box.non_anonymous_containing_block(); - auto const& containing_block_state = m_state.get(*containing_block); - auto height_of_containing_block = containing_block_state.content_height(); - if (box.computed_values().position() == CSS::Positioning::Absolute) { - // https://www.w3.org/TR/css-position-3/#def-cb - // If the box has position: absolute, then the containing block is formed by the padding edge of the ancestor - height_of_containing_block += containing_block_state.padding_top + containing_block_state.padding_bottom; - } - + auto height_of_containing_block = available_height.to_px_or_zero(); auto& computed_values = box.computed_values(); if (computed_values.box_sizing() == CSS::BoxSizing::BorderBox) { auto width_of_containing_block = containing_block_width_for(box);