From 65e430eee545d9272821a5a5a4f13f0de3786071 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 5 Dec 2020 23:11:31 +0100 Subject: [PATCH] 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. :^) --- Libraries/LibWeb/Layout/Node.cpp | 10 ---------- 1 file changed, 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(ancestor); }; - auto nearest_block_ancestor_that_creates_a_block_formatting_context = [this] { - auto* ancestor = parent(); - while (ancestor && (!is(*ancestor) || !FormattingContext::creates_block_formatting_context(downcast(*ancestor)))) - ancestor = ancestor->parent(); - return downcast(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(); }