LibWeb: Make node cloning methods const

This commit is contained in:
Tim Ledbetter 2025-01-11 17:37:08 +00:00 committed by Jelle Raaijmakers
commit a467005855
Notes: github-actions[bot] 2025-01-11 22:11:18 +00:00
20 changed files with 23 additions and 23 deletions

View file

@ -28,7 +28,7 @@ GC::Ref<Attr> Attr::create(Document& document, QualifiedName qualified_name, Str
return document.realm().create<Attr>(document, move(qualified_name), move(value), owner_element);
}
GC::Ref<Attr> Attr::clone(Document& document)
GC::Ref<Attr> Attr::clone(Document& document) const
{
return realm().create<Attr>(document, m_qualified_name, m_value, nullptr);
}

View file

@ -20,7 +20,7 @@ class Attr final : public Node {
public:
[[nodiscard]] static GC::Ref<Attr> create(Document&, QualifiedName, String value = {}, Element* = nullptr);
[[nodiscard]] static GC::Ref<Attr> create(Document&, FlyString local_name, String value = {}, Element* = nullptr);
GC::Ref<Attr> clone(Document&);
GC::Ref<Attr> clone(Document&) const;
virtual ~Attr() override = default;

View file

@ -1030,7 +1030,7 @@ WebIDL::ExceptionOr<GC::Ref<Node>> Node::replace_child(GC::Ref<Node> node, GC::R
}
// https://dom.spec.whatwg.org/#concept-node-clone
WebIDL::ExceptionOr<GC::Ref<Node>> Node::clone_node(Document* document, bool subtree, Node* parent)
WebIDL::ExceptionOr<GC::Ref<Node>> Node::clone_node(Document* document, bool subtree, Node* parent) const
{
// To clone a node given a node node and an optional document document (default nodes node document),
// boolean subtree (default false), and node-or-null parent (default null):
@ -1085,7 +1085,7 @@ WebIDL::ExceptionOr<GC::Ref<Node>> Node::clone_node(Document* document, bool sub
}
// https://dom.spec.whatwg.org/#clone-a-single-node
WebIDL::ExceptionOr<GC::Ref<Node>> Node::clone_single_node(Document& document)
WebIDL::ExceptionOr<GC::Ref<Node>> Node::clone_single_node(Document& document) const
{
// To clone a single node given a node node and document document:

View file

@ -199,8 +199,8 @@ public:
WebIDL::ExceptionOr<GC::Ref<Node>> replace_child(GC::Ref<Node> node, GC::Ref<Node> child);
WebIDL::ExceptionOr<GC::Ref<Node>> clone_node(Document* document = nullptr, bool subtree = false, Node* parent = nullptr);
WebIDL::ExceptionOr<GC::Ref<Node>> clone_single_node(Document&);
WebIDL::ExceptionOr<GC::Ref<Node>> clone_node(Document* document = nullptr, bool subtree = false, Node* parent = nullptr) const;
WebIDL::ExceptionOr<GC::Ref<Node>> clone_single_node(Document&) const;
WebIDL::ExceptionOr<GC::Ref<Node>> clone_node_binding(bool subtree);
// NOTE: This is intended for the JS bindings.
@ -263,7 +263,7 @@ public:
virtual void removed_from(Node*);
virtual void children_changed() { }
virtual void adopted_from(Document&) { }
virtual WebIDL::ExceptionOr<void> cloned(Node&, bool) { return {}; }
virtual WebIDL::ExceptionOr<void> cloned(Node&, bool) const { return {}; }
Layout::Node const* layout_node() const { return m_layout_node; }
Layout::Node* layout_node() { return m_layout_node; }