.abspos-item) [136,36 50x50]
diff --git a/Tests/LibWeb/Layout/input/grid/abspos-item-with-grid-area-aligned-in-center.html b/Tests/LibWeb/Layout/input/grid/abspos-item-with-grid-area-aligned-in-center.html
new file mode 100644
index 00000000000..5208fd84e6e
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/abspos-item-with-grid-area-aligned-in-center.html
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
index 8e357a2ee91..500df930d43 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
@@ -1936,8 +1936,7 @@ void GridFormattingContext::layout_absolutely_positioned_element(Box const& box)
compute_height_for_absolutely_positioned_element(box, available_space, BeforeOrAfterInsideLayout::After);
if (computed_values.inset().left().is_auto() && computed_values.inset().right().is_auto()) {
- auto containing_block_width = containing_block_state.content_width();
- auto width_left_for_alignment = containing_block_width - box_state.margin_box_width();
+ auto width_left_for_alignment = grid_area_rect.width() - box_state.margin_box_width();
switch (justification_for_item(box)) {
case CSS::JustifyItems::Normal:
case CSS::JustifyItems::Stretch:
@@ -1962,8 +1961,7 @@ void GridFormattingContext::layout_absolutely_positioned_element(Box const& box)
}
if (computed_values.inset().top().is_auto() && computed_values.inset().bottom().is_auto()) {
- auto containing_block_height = containing_block_state.content_height();
- auto height_left_for_alignment = containing_block_height - box_state.margin_box_height();
+ auto height_left_for_alignment = grid_area_rect.height() - box_state.margin_box_height();
switch (alignment_for_item(box)) {
case CSS::AlignItems::Baseline:
// FIXME: Not implemented