mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
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:
parent
bea7eec518
commit
863416e3ac
Notes:
github-actions[bot]
2024-09-12 05:37:23 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 863416e3ac
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1373
18 changed files with 299 additions and 86 deletions
|
@ -39,8 +39,6 @@ public:
|
|||
|
||||
void compute_height(Box const&, AvailableSpace const&);
|
||||
|
||||
void add_absolutely_positioned_box(Box const& box) { m_absolutely_positioned_boxes.append(box); }
|
||||
|
||||
SpaceUsedAndContainingMarginForFloats space_used_and_containing_margin_for_floats(CSSPixels y) const;
|
||||
[[nodiscard]] SpaceUsedByFloats intrusion_by_floats_into_box(Box const&, CSSPixels y_in_box) const;
|
||||
[[nodiscard]] SpaceUsedByFloats intrusion_by_floats_into_box(LayoutState::UsedValues const&, CSSPixels y_in_box) const;
|
||||
|
@ -170,8 +168,6 @@ private:
|
|||
FloatSideData m_left_floats;
|
||||
FloatSideData m_right_floats;
|
||||
|
||||
Vector<JS::NonnullGCPtr<Box const>> m_absolutely_positioned_boxes;
|
||||
|
||||
bool m_was_notified_after_parent_dimensioned_my_root_box { false };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue