From ae3958f6408213ea0f504af16931ed7503155215 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 28 Aug 2023 19:24:12 +0200 Subject: [PATCH] LibWeb: Remove incorrect hack in build_paint_tree() If a paintable already has a parent when we're building a paint tree, that's a bug we should catch, not something that needs a workaround. --- Userland/Libraries/LibWeb/Layout/LayoutState.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp index b3f3fcf769..0ecfaac251 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp @@ -202,10 +202,7 @@ static void build_paint_tree(Node& node, Painting::Paintable* parent_paintable = return; auto& paintable = const_cast(*node.paintable()); if (parent_paintable) { - // In case this was a relayout of an existing tree, we need to remove the paintable from its old parent first. - if (auto* old_parent = paintable.parent()) { - old_parent->remove_child(paintable); - } + VERIFY(!paintable.parent()); parent_paintable->append_child(paintable); } paintable.set_dom_node(node.dom_node());