From b9bbe4c1665c497ceb5e410b373c13a83e8c0815 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Tue, 23 Jan 2024 17:53:55 +0100 Subject: [PATCH] LibWeb: Remove unnecessary layout tree disconnection during teardown This code appears to be leftover from times when layout and paintable trees were not GC-allocated. --- Userland/Libraries/LibWeb/DOM/Document.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 39cc5158ee..190eccfa29 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -842,26 +842,7 @@ WebIDL::ExceptionOr Document::set_title(String const& title) void Document::tear_down_layout_tree() { - if (!m_layout_root) - return; - - // Gather up all the layout nodes in a vector and detach them from parents - // while the vector keeps them alive. - - Vector> layout_nodes; - - m_layout_root->for_each_in_inclusive_subtree([&](auto& layout_node) { - layout_nodes.append(layout_node); - return IterationDecision::Continue; - }); - - for (auto& layout_node : layout_nodes) { - if (layout_node->parent()) - layout_node->parent()->remove_child(*layout_node); - } - m_layout_root = nullptr; - m_paintable = nullptr; }