LibWeb: Make FC of containing block responsible for abspos layout

Before this change, a formatting context was responsible for layout of
absolutely positioned boxes whose FC root box was their parent (either
directly or indirectly). This only worked correctly when the containing
block of the absolutely positioned child did not escape the FC root.
This is because the width and height of an absolutely positioned box are
resolved based on the size of its containing block, so we needed to
ensure that the containing block's layout was completed before laying
out an absolutely positioned box.

With this change, the layout of absolutely positioned boxes is delayed
until the FC responsible for the containing block's layout is complete.
This has affected the way we calculate the static position. It is no
longer possible to ask the FC for a box's static position, as this FC's
state might be gone by the time the layout for absolutely positioned
elements occurs. Instead, the "static position rectangle" (a concept
from the spec) is saved in the layout state, along with information on
how to align the box within this rectangle when its width and height are
resolved.
This commit is contained in:
Aliaksandr Kalenik 2024-09-10 19:02:03 +02:00 committed by Andreas Kling
commit 863416e3ac
Notes: github-actions[bot] 2024-09-12 05:37:23 +00:00
18 changed files with 299 additions and 86 deletions

View file

@ -28,7 +28,13 @@ Box::~Box()
{
}
// https://www.w3.org/TR/css-overflow-3/#overflow-control
void Box::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_contained_abspos_children);
}
// https://www.w37.org/TR/css-overflow-3/#overflow-control
static bool overflow_value_makes_box_a_scroll_container(CSS::Overflow overflow)
{
switch (overflow) {