LibWeb: Add metadata to children update steps invocation

Currently, this metadata is only provided on the insertion steps,
though I believe it would be useful to extend to the other cases
as well. This metadata can aid in making optimizations for these
steps by providing extra context into the type of change which
was made on the child.
This commit is contained in:
Shannon Booth 2025-01-27 01:16:33 +13:00 committed by Andrew Kaster
commit 903c8860f8
Notes: github-actions[bot] 2025-01-30 20:56:50 +00:00
27 changed files with 52 additions and 40 deletions

View file

@ -745,7 +745,8 @@ void Node::insert_before(GC::Ref<Node> node, GC::Ptr<Node> child, bool suppress_
}
// 9. Run the children changed steps for parent.
children_changed();
ChildrenChangedMetadata metadata { ChildrenChangedMetadata::Type::Inserted, node };
children_changed(&metadata);
// 10. Let staticNodeList be a list of nodes, initially « ».
// Spec-Note: We collect all nodes before calling the post-connection steps on any one of them, instead of calling
@ -977,7 +978,7 @@ void Node::remove(bool suppress_observers)
}
// 21. Run the children changed steps for parent.
parent->children_changed();
parent->children_changed(nullptr);
document().bump_dom_tree_version();
}