mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:07:45 +00:00
LibWeb: Add a way to opt out of TreeNode::append_child() notifications
This will be used temporarily by the new HTML parser while we're bringing it up.
This commit is contained in:
parent
5d332c1f11
commit
6c409310a8
1 changed files with 7 additions and 5 deletions
|
@ -109,7 +109,7 @@ public:
|
||||||
bool is_ancestor_of(const TreeNode&) const;
|
bool is_ancestor_of(const TreeNode&) const;
|
||||||
|
|
||||||
void prepend_child(NonnullRefPtr<T> node);
|
void prepend_child(NonnullRefPtr<T> node);
|
||||||
void append_child(NonnullRefPtr<T> node);
|
void append_child(NonnullRefPtr<T> node, bool notify = true);
|
||||||
NonnullRefPtr<T> remove_child(NonnullRefPtr<T> node);
|
NonnullRefPtr<T> remove_child(NonnullRefPtr<T> node);
|
||||||
void donate_all_children_to(T& node);
|
void donate_all_children_to(T& node);
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ inline NonnullRefPtr<T> TreeNode<T>::remove_child(NonnullRefPtr<T> node)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void TreeNode<T>::append_child(NonnullRefPtr<T> node)
|
inline void TreeNode<T>::append_child(NonnullRefPtr<T> node, bool notify)
|
||||||
{
|
{
|
||||||
ASSERT(!node->m_parent);
|
ASSERT(!node->m_parent);
|
||||||
|
|
||||||
|
@ -244,9 +244,11 @@ inline void TreeNode<T>::append_child(NonnullRefPtr<T> node)
|
||||||
m_last_child = node.ptr();
|
m_last_child = node.ptr();
|
||||||
if (!m_first_child)
|
if (!m_first_child)
|
||||||
m_first_child = m_last_child;
|
m_first_child = m_last_child;
|
||||||
|
if (notify)
|
||||||
node->inserted_into(static_cast<T&>(*this));
|
node->inserted_into(static_cast<T&>(*this));
|
||||||
(void)node.leak_ref();
|
(void)node.leak_ref();
|
||||||
|
|
||||||
|
if (notify)
|
||||||
static_cast<T*>(this)->children_changed();
|
static_cast<T*>(this)->children_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue