1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibHTML: Update the removed node's siblings in TreeNode::remove_child()

Oops, we forgot to update the node's siblings' sibling pointers when
removing a node from the tree.

Thanks to Owlinated for pointing this out! :^)
This commit is contained in:
Andreas Kling 2019-11-07 22:42:55 +01:00
parent 96c1e36ed3
commit 69883bea6f

View file

@ -121,6 +121,12 @@ inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node, bool ca
if (m_last_child == node)
m_last_child = node->m_previous_sibling;
if (node->m_next_sibling)
node->m_next_sibling->m_previous_sibling = node->m_previous_sibling;
if (node->m_previous_sibling)
node->m_previous_sibling->m_next_sibling = node->m_next_sibling;
node->m_next_sibling = nullptr;
node->m_previous_sibling = nullptr;
node->m_parent = nullptr;