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

LibWeb: Add the cloning steps in clone_node

This will be used in HTMLTemplateElement later to clone template
contents.

This makes the clone functions non-const in the process, as the cloning
steps can have side effects.
This commit is contained in:
Luke 2021-07-05 05:30:24 +01:00 committed by Andreas Kling
parent e4ae1cdd1f
commit f3f2170ac6
2 changed files with 8 additions and 5 deletions

View file

@ -85,8 +85,8 @@ public:
ExceptionOr<NonnullRefPtr<Node>> replace_child(NonnullRefPtr<Node> node, NonnullRefPtr<Node> child);
NonnullRefPtr<Node> clone_node(Document* document = nullptr, bool clone_children = false) const;
ExceptionOr<NonnullRefPtr<Node>> clone_node_binding(bool deep) const;
NonnullRefPtr<Node> clone_node(Document* document = nullptr, bool clone_children = false);
ExceptionOr<NonnullRefPtr<Node>> clone_node_binding(bool deep);
// NOTE: This is intended for the JS bindings.
bool has_child_nodes() const { return has_children(); }
@ -134,6 +134,7 @@ public:
virtual void removed_from(Node*) { }
virtual void children_changed() { }
virtual void adopted_from(const Document&) { }
virtual void cloned(Node&, bool) {};
const Layout::Node* layout_node() const { return m_layout_node; }
Layout::Node* layout_node() { return m_layout_node; }