1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

LibWeb: Move absolute positioning up to FormattingContext

It seems like both BFC and IFC can have absolutely positioned children.
It's a bit strange, but consider the following HTML:

<html><body>foobar<img style="position: absolute"></body></html>

In such a document, the <img> element is an absolutely positioned child
of a block-level element (<body>) with no block-level children.
An IFC is established for <body>, and needs to handle layout for <img>.
This commit is contained in:
Andreas Kling 2021-01-06 18:18:46 +01:00
parent 4c98d00bef
commit 0ecefbff57
5 changed files with 281 additions and 215 deletions

View file

@ -63,6 +63,14 @@ protected:
ShrinkToFitResult calculate_shrink_to_fit_widths(Box&);
void layout_absolutely_positioned_element(Box&);
void compute_width_for_absolutely_positioned_element(Box&);
void compute_width_for_absolutely_positioned_non_replaced_element(Box&);
void compute_width_for_absolutely_positioned_replaced_element(ReplacedBox&);
void compute_height_for_absolutely_positioned_element(Box&);
void compute_height_for_absolutely_positioned_non_replaced_element(Box&);
void compute_height_for_absolutely_positioned_replaced_element(ReplacedBox&);
FormattingContext* m_parent { nullptr };
Box* m_context_box { nullptr };
};