1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibWeb: Move layout box rect helpers into FormattingContext

These are only used during layout, and always within formatting context
code, so we might as well put them in FormattingContext and avoid having
to pass the LayoutState around all the time.
This commit is contained in:
Andreas Kling 2023-05-31 10:18:34 +02:00
parent 4f08fcde29
commit 42470d837e
10 changed files with 155 additions and 152 deletions

View file

@ -2187,8 +2187,8 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
auto static_position_offset = is_row_layout() ? CSSPixelPoint { main_offset, cross_offset } : CSSPixelPoint { cross_offset, main_offset };
auto absolute_position_of_flex_container = absolute_content_rect(flex_container(), m_state).location();
auto absolute_position_of_abspos_containing_block = absolute_content_rect(*box.containing_block(), m_state).location();
auto absolute_position_of_flex_container = absolute_content_rect(flex_container()).location();
auto absolute_position_of_abspos_containing_block = absolute_content_rect(*box.containing_block()).location();
auto diff = absolute_position_of_flex_container - absolute_position_of_abspos_containing_block;
return static_position_offset + diff;