summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-12-05 23:11:31 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-05 23:12:29 +0100
commit65e430eee545d9272821a5a5a4f13f0de3786071 (patch)
tree4eb21d8be76a6431e928163b7bf75e771deb5671
parent2f38d94c702ef6ab67f4cdce5bf467860465eee0 (diff)
downloadserenity-65e430eee545d9272821a5a5a4f13f0de3786071.zip
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. :^)
-rw-r--r--Libraries/LibWeb/Layout/Node.cpp10
1 files changed, 0 insertions, 10 deletions
diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cpp
index b2c79b922c..cb2779ddf4 100644
--- a/Libraries/LibWeb/Layout/Node.cpp
+++ b/Libraries/LibWeb/Layout/Node.cpp
@@ -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();
}