diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-11-07 22:42:55 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-11-07 22:45:12 +0100 |
commit | 69883bea6f0b447b3abfd63bc7289ced87526675 (patch) | |
tree | 27db79fed33d433513de61dc996f1950d00bfeb5 | |
parent | 96c1e36ed3d5a09459cd7cdb9dc1bfe89a6b93da (diff) | |
download | serenity-69883bea6f0b447b3abfd63bc7289ced87526675.zip |
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! :^)
-rw-r--r-- | Libraries/LibHTML/TreeNode.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibHTML/TreeNode.h b/Libraries/LibHTML/TreeNode.h index ae84db165b..4459e4cfc0 100644 --- a/Libraries/LibHTML/TreeNode.h +++ b/Libraries/LibHTML/TreeNode.h @@ -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; |