1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:57:44 +00:00

LibWeb: Use the parent container's y offset when finding static position

Fixes #18819.
This commit is contained in:
implicitfield 2024-03-08 14:09:42 +04:00 committed by Alexander Kalenik
parent bf06d5b634
commit 5da9f52b1f
5 changed files with 37 additions and 2 deletions

View file

@ -1204,9 +1204,10 @@ CSSPixelPoint FormattingContext::calculate_static_position(Box const& box) const
// Easy case: no previous sibling, we're at the top of the containing block.
}
} else {
x = m_state.get(box).margin_left;
auto const& box_state = m_state.get(box);
x = box_state.margin_left;
// We're among block siblings, Y can be calculated easily.
y = m_state.get(box).margin_top;
y = box_state.margin_top + box_state.vertical_offset_of_parent_block_container;
}
auto offset_to_static_parent = content_box_rect_in_static_position_ancestor_coordinate_space(box, *box.containing_block());
return offset_to_static_parent.location().translated(x, y);