1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:07:34 +00:00

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.
This commit is contained in:
Andreas Kling 2023-08-28 19:24:12 +02:00
parent ad1853cbf5
commit ae3958f640

View file

@ -202,10 +202,7 @@ static void build_paint_tree(Node& node, Painting::Paintable* parent_paintable =
return; return;
auto& paintable = const_cast<Painting::Paintable&>(*node.paintable()); auto& paintable = const_cast<Painting::Paintable&>(*node.paintable());
if (parent_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. VERIFY(!paintable.parent());
if (auto* old_parent = paintable.parent()) {
old_parent->remove_child(paintable);
}
parent_paintable->append_child(paintable); parent_paintable->append_child(paintable);
} }
paintable.set_dom_node(node.dom_node()); paintable.set_dom_node(node.dom_node());