mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
LibWeb: Floating boxes follow normal containing block rules
I had guessed that floating boxes should somehow be hoisted up to the nearest block ancestor that creates a block formatting context, but that's just wrong. They move up to the nearest block ancestor like any other box that's not absolutely (or fixed) positioned. :^)
This commit is contained in:
parent
2f38d94c70
commit
65e430eee5
1 changed files with 0 additions and 10 deletions
|
@ -66,13 +66,6 @@ const BlockBox* Node::containing_block() const
|
|||
return downcast<BlockBox>(ancestor);
|
||||
};
|
||||
|
||||
auto nearest_block_ancestor_that_creates_a_block_formatting_context = [this] {
|
||||
auto* ancestor = parent();
|
||||
while (ancestor && (!is<Box>(*ancestor) || !FormattingContext::creates_block_formatting_context(downcast<Box>(*ancestor))))
|
||||
ancestor = ancestor->parent();
|
||||
return downcast<BlockBox>(ancestor);
|
||||
};
|
||||
|
||||
if (is_text())
|
||||
return nearest_block_ancestor();
|
||||
|
||||
|
@ -90,9 +83,6 @@ const BlockBox* Node::containing_block() const
|
|||
if (position == CSS::Position::Fixed)
|
||||
return &root();
|
||||
|
||||
if (is_floating())
|
||||
return nearest_block_ancestor_that_creates_a_block_formatting_context();
|
||||
|
||||
return nearest_block_ancestor();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue