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

LibWeb: Some improvements to absolute positioning

Absolutely positioned blocks now register themselves with their
containing block (and note that the containing block of an absolutely
positioned box is the nearest non-statically positioned block ancestor
or the ICB as fallback.)

Containing blocks then drive the layout of their tracked absolutely
positioned descendants as a separate layout pass.

This is very far from perfect but the general direction seems good.
This commit is contained in:
Andreas Kling 2020-06-12 13:27:28 +02:00
parent ff2c949d70
commit 260427f0ad
8 changed files with 166 additions and 24 deletions

View file

@ -145,6 +145,11 @@ void dump_tree(const LayoutNode& layout_node)
if (layout_node.is_block() && static_cast<const LayoutBlock&>(layout_node).children_are_inline()) {
auto& block = static_cast<const LayoutBlock&>(layout_node);
if (block.absolutely_positioned_descendant_count()) {
for (size_t i = 0; i < indent; ++i)
dbgprintf(" ");
dbgprintf(" %zu absolutely positioned descendant(s) tracked here\n", block.absolutely_positioned_descendant_count());
}
for (size_t i = 0; i < indent; ++i)
dbgprintf(" ");
dbgprintf(" Line boxes (%d):\n", block.line_boxes().size());