mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03: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
Notes:
sideshowbarker
2024-07-19 01:02:51 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/65e430eee54
@ -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…
Reference in New Issue
Block a user