diff --git a/Libraries/LibWeb/DOM/Attr.cpp b/Libraries/LibWeb/DOM/Attr.cpp index df6878855bf..f045261cc1c 100644 --- a/Libraries/LibWeb/DOM/Attr.cpp +++ b/Libraries/LibWeb/DOM/Attr.cpp @@ -28,7 +28,7 @@ GC::Ref Attr::create(Document& document, QualifiedName qualified_name, Str return document.realm().create(document, move(qualified_name), move(value), owner_element); } -GC::Ref Attr::clone(Document& document) +GC::Ref Attr::clone(Document& document) const { return realm().create(document, m_qualified_name, m_value, nullptr); } diff --git a/Libraries/LibWeb/DOM/Attr.h b/Libraries/LibWeb/DOM/Attr.h index 3b2791e80f8..4afc4943e90 100644 --- a/Libraries/LibWeb/DOM/Attr.h +++ b/Libraries/LibWeb/DOM/Attr.h @@ -20,7 +20,7 @@ class Attr final : public Node { public: [[nodiscard]] static GC::Ref create(Document&, QualifiedName, String value = {}, Element* = nullptr); [[nodiscard]] static GC::Ref create(Document&, FlyString local_name, String value = {}, Element* = nullptr); - GC::Ref clone(Document&); + GC::Ref clone(Document&) const; virtual ~Attr() override = default; diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index ea48d6622dd..1262e56afdb 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -1030,7 +1030,7 @@ WebIDL::ExceptionOr> Node::replace_child(GC::Ref node, GC::R } // https://dom.spec.whatwg.org/#concept-node-clone -WebIDL::ExceptionOr> Node::clone_node(Document* document, bool subtree, Node* parent) +WebIDL::ExceptionOr> Node::clone_node(Document* document, bool subtree, Node* parent) const { // To clone a node given a node node and an optional document document (default node’s node document), // boolean subtree (default false), and node-or-null parent (default null): @@ -1085,7 +1085,7 @@ WebIDL::ExceptionOr> Node::clone_node(Document* document, bool sub } // https://dom.spec.whatwg.org/#clone-a-single-node -WebIDL::ExceptionOr> Node::clone_single_node(Document& document) +WebIDL::ExceptionOr> Node::clone_single_node(Document& document) const { // To clone a single node given a node node and document document: diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index fb1eb12dae2..c3b6e39d6cf 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -199,8 +199,8 @@ public: WebIDL::ExceptionOr> replace_child(GC::Ref node, GC::Ref child); - WebIDL::ExceptionOr> clone_node(Document* document = nullptr, bool subtree = false, Node* parent = nullptr); - WebIDL::ExceptionOr> clone_single_node(Document&); + WebIDL::ExceptionOr> clone_node(Document* document = nullptr, bool subtree = false, Node* parent = nullptr) const; + WebIDL::ExceptionOr> clone_single_node(Document&) const; WebIDL::ExceptionOr> 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 cloned(Node&, bool) { return {}; } + virtual WebIDL::ExceptionOr cloned(Node&, bool) const { return {}; } Layout::Node const* layout_node() const { return m_layout_node; } Layout::Node* layout_node() { return m_layout_node; } diff --git a/Libraries/LibWeb/HTML/HTMLElement.cpp b/Libraries/LibWeb/HTML/HTMLElement.cpp index ea8ab713ff3..579797f5653 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -612,7 +612,7 @@ void HTMLElement::attribute_changed(FlyString const& name, Optional cons #undef __ENUMERATE } -WebIDL::ExceptionOr HTMLElement::cloned(Web::DOM::Node& copy, bool clone_children) +WebIDL::ExceptionOr HTMLElement::cloned(Web::DOM::Node& copy, bool clone_children) const { TRY(Base::cloned(copy, clone_children)); TRY(HTMLOrSVGElement::cloned(copy, clone_children)); diff --git a/Libraries/LibWeb/HTML/HTMLElement.h b/Libraries/LibWeb/HTML/HTMLElement.h index 0d102160f44..2f7699e60a7 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Libraries/LibWeb/HTML/HTMLElement.h @@ -137,7 +137,7 @@ protected: virtual void initialize(JS::Realm&) override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; - virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) override; + virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) const override; virtual void inserted() override; virtual void visit_edges(Cell::Visitor&) override; diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp index e584051da2e..d84ba2f1330 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -1706,7 +1706,7 @@ void HTMLInputElement::apply_presentational_hints(GC::Ref HTMLInputElement::cloned(DOM::Node& copy, bool subtree) +WebIDL::ExceptionOr HTMLInputElement::cloned(DOM::Node& copy, bool subtree) const { TRY(Base::cloned(copy, subtree)); diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.h b/Libraries/LibWeb/HTML/HTMLInputElement.h index 44538ed3e90..76b45fec9ca 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -183,7 +183,7 @@ public: virtual void form_associated_element_was_removed(DOM::Node*) override; virtual void form_associated_element_attribute_changed(FlyString const&, Optional const&, Optional const&) override; - virtual WebIDL::ExceptionOr cloned(Node&, bool) override; + virtual WebIDL::ExceptionOr cloned(Node&, bool) const override; GC::Ref validity() const; diff --git a/Libraries/LibWeb/HTML/HTMLOrSVGElement.cpp b/Libraries/LibWeb/HTML/HTMLOrSVGElement.cpp index efa1e8070b8..2158479efdd 100644 --- a/Libraries/LibWeb/HTML/HTMLOrSVGElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLOrSVGElement.cpp @@ -78,7 +78,7 @@ void HTMLOrSVGElement::attribute_changed(FlyString const& local_nam // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#dom-noncedelement-nonce template -WebIDL::ExceptionOr HTMLOrSVGElement::cloned(DOM::Node& copy, bool) +WebIDL::ExceptionOr HTMLOrSVGElement::cloned(DOM::Node& copy, bool) const { // The cloning steps for elements that include HTMLOrSVGElement given node, copy, and subtree // are to set copy's [[CryptographicNonce]] to node's [[CryptographicNonce]]. diff --git a/Libraries/LibWeb/HTML/HTMLOrSVGElement.h b/Libraries/LibWeb/HTML/HTMLOrSVGElement.h index a927c1d5276..8051a5ddfcc 100644 --- a/Libraries/LibWeb/HTML/HTMLOrSVGElement.h +++ b/Libraries/LibWeb/HTML/HTMLOrSVGElement.h @@ -26,7 +26,7 @@ public: protected: void attribute_changed(FlyString const&, Optional const&, Optional const&, Optional const&); - WebIDL::ExceptionOr cloned(DOM::Node&, bool); + WebIDL::ExceptionOr cloned(DOM::Node&, bool) const; void inserted(); void visit_edges(JS::Cell::Visitor&); diff --git a/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 0d2efc90cba..19370937d6f 100644 --- a/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -651,7 +651,7 @@ void HTMLScriptElement::set_async(bool async) } // https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model:concept-node-clone-ext -WebIDL::ExceptionOr HTMLScriptElement::cloned(Node& copy, bool subtree) +WebIDL::ExceptionOr HTMLScriptElement::cloned(Node& copy, bool subtree) const { TRY(Base::cloned(copy, subtree)); diff --git a/Libraries/LibWeb/HTML/HTMLScriptElement.h b/Libraries/LibWeb/HTML/HTMLScriptElement.h index 6e49fe7cab3..f652c51d5b2 100644 --- a/Libraries/LibWeb/HTML/HTMLScriptElement.h +++ b/Libraries/LibWeb/HTML/HTMLScriptElement.h @@ -63,7 +63,7 @@ public: [[nodiscard]] bool async() const; void set_async(bool); - virtual WebIDL::ExceptionOr cloned(Node&, bool) override; + virtual WebIDL::ExceptionOr cloned(Node&, bool) const override; private: HTMLScriptElement(DOM::Document&, DOM::QualifiedName); diff --git a/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp b/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp index edaf25bb443..58154fcf664 100644 --- a/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp @@ -46,7 +46,7 @@ void HTMLTemplateElement::adopted_from(DOM::Document&) } // https://html.spec.whatwg.org/multipage/scripting.html#the-template-element:concept-node-clone-ext -WebIDL::ExceptionOr HTMLTemplateElement::cloned(Node& copy, bool subtree) +WebIDL::ExceptionOr HTMLTemplateElement::cloned(Node& copy, bool subtree) const { TRY(Base::cloned(copy, subtree)); diff --git a/Libraries/LibWeb/HTML/HTMLTemplateElement.h b/Libraries/LibWeb/HTML/HTMLTemplateElement.h index 488591d0ddf..f791a2eeeda 100644 --- a/Libraries/LibWeb/HTML/HTMLTemplateElement.h +++ b/Libraries/LibWeb/HTML/HTMLTemplateElement.h @@ -24,7 +24,7 @@ public: void set_template_contents(GC::Ref); virtual void adopted_from(DOM::Document&) override; - virtual WebIDL::ExceptionOr cloned(Node& copy, bool clone_children) override; + virtual WebIDL::ExceptionOr cloned(Node& copy, bool clone_children) const override; private: HTMLTemplateElement(DOM::Document&, DOM::QualifiedName); diff --git a/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index d5d4bb5f280..fba9ac2a322 100644 --- a/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -136,7 +136,7 @@ void HTMLTextAreaElement::clear_algorithm() } // https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element:concept-node-clone-ext -WebIDL::ExceptionOr HTMLTextAreaElement::cloned(DOM::Node& copy, bool subtree) +WebIDL::ExceptionOr HTMLTextAreaElement::cloned(DOM::Node& copy, bool subtree) const { TRY(Base::cloned(copy, subtree)); diff --git a/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index efb67f64004..19763895aa5 100644 --- a/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -64,7 +64,7 @@ public: virtual void reset_algorithm() override; virtual void clear_algorithm() override; - virtual WebIDL::ExceptionOr cloned(Node&, bool) override; + virtual WebIDL::ExceptionOr cloned(Node&, bool) const override; virtual void form_associated_element_was_inserted() override; virtual void form_associated_element_was_removed(DOM::Node*) override; diff --git a/Libraries/LibWeb/MathML/MathMLElement.cpp b/Libraries/LibWeb/MathML/MathMLElement.cpp index b5857695722..44c509f9d6f 100644 --- a/Libraries/LibWeb/MathML/MathMLElement.cpp +++ b/Libraries/LibWeb/MathML/MathMLElement.cpp @@ -26,7 +26,7 @@ void MathMLElement::attribute_changed(FlyString const& local_name, Optional MathMLElement::cloned(DOM::Node& node, bool clone_children) +WebIDL::ExceptionOr MathMLElement::cloned(DOM::Node& node, bool clone_children) const { TRY(Base::cloned(node, clone_children)); TRY(HTMLOrSVGElement::cloned(node, clone_children)); diff --git a/Libraries/LibWeb/MathML/MathMLElement.h b/Libraries/LibWeb/MathML/MathMLElement.h index 934bec2232e..23075188a69 100644 --- a/Libraries/LibWeb/MathML/MathMLElement.h +++ b/Libraries/LibWeb/MathML/MathMLElement.h @@ -25,7 +25,7 @@ public: protected: virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; - virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) override; + virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) const override; virtual void inserted() override; virtual GC::Ptr global_event_handlers_to_event_target(FlyString const&) override { return *this; } diff --git a/Libraries/LibWeb/SVG/SVGElement.cpp b/Libraries/LibWeb/SVG/SVGElement.cpp index 9a049afa3c4..20c9ad57250 100644 --- a/Libraries/LibWeb/SVG/SVGElement.cpp +++ b/Libraries/LibWeb/SVG/SVGElement.cpp @@ -83,7 +83,7 @@ void SVGElement::attribute_changed(FlyString const& local_name, Optional update_use_elements_that_reference_this(); } -WebIDL::ExceptionOr SVGElement::cloned(DOM::Node& copy, bool clone_children) +WebIDL::ExceptionOr SVGElement::cloned(DOM::Node& copy, bool clone_children) const { TRY(Base::cloned(copy, clone_children)); TRY(HTMLOrSVGElement::cloned(copy, clone_children)); diff --git a/Libraries/LibWeb/SVG/SVGElement.h b/Libraries/LibWeb/SVG/SVGElement.h index 2bf605a5256..848ba011a7e 100644 --- a/Libraries/LibWeb/SVG/SVGElement.h +++ b/Libraries/LibWeb/SVG/SVGElement.h @@ -35,7 +35,7 @@ protected: virtual void visit_edges(Cell::Visitor&) override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; - virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) override; + virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) const override; virtual void children_changed() override; virtual void inserted() override; virtual void removed_from(Node*) override;