mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibWeb: Define static position calculation separately for each FC
Static position of a box is defined by formatting context type it belongs to, so let's define this algorithm separately for each FC instead of assuming FormattingContext::calculate_static_position_rect() understands how to handle all of them. Also with this change calculate_static_position_rect() is no longer virtual function.
This commit is contained in:
parent
6ee1c4c634
commit
1a78edb8c9
Notes:
github-actions[bot]
2024-10-06 13:45:57 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 1a78edb8c9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1642
11 changed files with 73 additions and 49 deletions
|
@ -2508,6 +2508,18 @@ CSSPixels GridFormattingContext::calculate_minimum_contribution(GridItem const&
|
|||
return calculate_min_content_contribution(item, dimension);
|
||||
}
|
||||
|
||||
StaticPositionRect GridFormattingContext::calculate_static_position_rect(Box const& box) const
|
||||
{
|
||||
// Result of this function is only used when containing block is not a grid container.
|
||||
// If the containing block is a grid container then static position is a grid area rect and
|
||||
// layout_absolutely_positioned_element() defined for GFC knows how to handle this case.
|
||||
StaticPositionRect static_position;
|
||||
auto const& box_state = m_state.get(box);
|
||||
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, 0), { box_state.content_width(), box_state.content_height() } };
|
||||
return static_position;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue