1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-12 02:30:30 +09:00

LibWeb: Correctly calculate static position rect when absolutely

positioned element is a descendant of inline-block

Sets inline block offsets in InlineFormattingContext.cpp, but this is
not enough. When static position rect is calculated during layout,
not all ancestors of abspos box may have their offsets calculated yet
(more info here: https://github.com/LadybirdBrowser/ladybird/pull/2583#issuecomment-2507140272).
So now static position rect is calculated relative to static containing
block during layout and calculation relative to actual containing block
is done later in
FormattingContext::layout_absolutely_positioned_element.

Fixes wpt/css/CSS2/abspos/static-inside-inline-block.html
This commit is contained in:
stasoid 2025-03-06 18:10:38 +05:00 committed by Alexander Kalenik
parent 1821896ecf
commit a6935299eb
Notes: github-actions[bot] 2025-03-17 14:56:06 +00:00
11 changed files with 45 additions and 16 deletions

View file

@ -672,8 +672,7 @@ void BlockFormattingContext::layout_block_level_box(Box const& box, BlockContain
if (box.is_absolutely_positioned()) {
StaticPositionRect static_position;
auto offset_to_static_parent = content_box_rect_in_static_position_ancestor_coordinate_space(box, *box.containing_block());
static_position.rect = { offset_to_static_parent.location().translated(0, m_y_offset_of_current_block_container.value()), { 0, 0 } };
static_position.rect = { { 0, m_y_offset_of_current_block_container.value() }, { 0, 0 } };
box_state.set_static_position_rect(static_position);
return;
}