diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-04-01 20:58:27 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-01 21:24:45 +0100 |
commit | 086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch) | |
tree | 02b3699a66735ef806d9b46353491f18f8e4e7b4 /Userland/Libraries/LibWeb/DOM | |
parent | 0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff) | |
download | serenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip |
Everywhere: Run clang-format
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
29 files changed, 132 insertions, 132 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/AbstractRange.h b/Userland/Libraries/LibWeb/DOM/AbstractRange.h index 0547879aa8..0407de68f2 100644 --- a/Userland/Libraries/LibWeb/DOM/AbstractRange.h +++ b/Userland/Libraries/LibWeb/DOM/AbstractRange.h @@ -20,11 +20,11 @@ public: virtual ~AbstractRange() override = default; Node* start_container() { return m_start_container; } - const Node* start_container() const { return m_start_container; } + Node const* start_container() const { return m_start_container; } unsigned start_offset() const { return m_start_offset; } Node* end_container() { return m_end_container; } - const Node* end_container() const { return m_end_container; } + Node const* end_container() const { return m_end_container; } unsigned end_offset() const { return m_end_offset; } // https://dom.spec.whatwg.org/#range-collapsed diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp index dec8901baf..2b17e0955e 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp @@ -10,7 +10,7 @@ namespace Web::DOM { -CharacterData::CharacterData(Document& document, NodeType type, const String& data) +CharacterData::CharacterData(Document& document, NodeType type, String const& data) : Node(document, type) , m_data(data) { diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.h b/Userland/Libraries/LibWeb/DOM/CharacterData.h index 0b38ec92a0..d72d5bdfc4 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.h +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.h @@ -22,7 +22,7 @@ public: virtual ~CharacterData() override = default; - const String& data() const { return m_data; } + String const& data() const { return m_data; } void set_data(String); unsigned length() const { return m_data.length(); } @@ -31,7 +31,7 @@ public: ExceptionOr<void> replace_data(size_t offset, size_t count, String const&); protected: - explicit CharacterData(Document&, NodeType, const String&); + explicit CharacterData(Document&, NodeType, String const&); private: String m_data; diff --git a/Userland/Libraries/LibWeb/DOM/Comment.cpp b/Userland/Libraries/LibWeb/DOM/Comment.cpp index 8b70cf501b..9e79dd5869 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.cpp +++ b/Userland/Libraries/LibWeb/DOM/Comment.cpp @@ -10,7 +10,7 @@ namespace Web::DOM { -Comment::Comment(Document& document, const String& data) +Comment::Comment(Document& document, String const& data) : CharacterData(document, NodeType::COMMENT_NODE, data) { } diff --git a/Userland/Libraries/LibWeb/DOM/Comment.h b/Userland/Libraries/LibWeb/DOM/Comment.h index 7f34f43a13..9696a31137 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.h +++ b/Userland/Libraries/LibWeb/DOM/Comment.h @@ -15,7 +15,7 @@ class Comment final : public CharacterData { public: using WrapperType = Bindings::CommentWrapper; - explicit Comment(Document&, const String&); + explicit Comment(Document&, String const&); virtual ~Comment() override = default; virtual FlyString node_name() const override { return "#comment"; } diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.h b/Userland/Libraries/LibWeb/DOM/CustomEvent.h index ed549d87d7..6ecbd83950 100644 --- a/Userland/Libraries/LibWeb/DOM/CustomEvent.h +++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.h @@ -23,7 +23,7 @@ public: { return adopt_ref(*new CustomEvent(event_name, event_init)); } - static NonnullRefPtr<CustomEvent> create_with_global_object(Bindings::WindowObject&, const FlyString& event_name, CustomEventInit const& event_init) + static NonnullRefPtr<CustomEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, CustomEventInit const& event_init) { return CustomEvent::create(event_name, event_init); } diff --git a/Userland/Libraries/LibWeb/DOM/DOMException.h b/Userland/Libraries/LibWeb/DOM/DOMException.h index 6e555536bf..95475e2829 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMException.h +++ b/Userland/Libraries/LibWeb/DOM/DOMException.h @@ -78,7 +78,7 @@ namespace Web::DOM { __ENUMERATE(OperationError) \ __ENUMERATE(NotAllowedError) -static u16 get_legacy_code_for_name(const FlyString& name) +static u16 get_legacy_code_for_name(FlyString const& name) { #define __ENUMERATE(ErrorName, code) \ if (name == #ErrorName) \ @@ -95,23 +95,23 @@ class DOMException final public: using WrapperType = Bindings::DOMExceptionWrapper; - static NonnullRefPtr<DOMException> create(const FlyString& name, const FlyString& message) + static NonnullRefPtr<DOMException> create(FlyString const& name, FlyString const& message) { return adopt_ref(*new DOMException(name, message)); } // JS constructor has message first, name second - static NonnullRefPtr<DOMException> create_with_global_object(Bindings::WindowObject&, const FlyString& message, const FlyString& name) + static NonnullRefPtr<DOMException> create_with_global_object(Bindings::WindowObject&, FlyString const& message, FlyString const& name) { return adopt_ref(*new DOMException(name, message)); } - const FlyString& name() const { return m_name; } - const FlyString& message() const { return m_message; } + FlyString const& name() const { return m_name; } + FlyString const& message() const { return m_message; } u16 code() const { return get_legacy_code_for_name(m_name); } protected: - DOMException(const FlyString& name, const FlyString& message) + DOMException(FlyString const& name, FlyString const& message) : m_name(name) , m_message(message) { @@ -125,7 +125,7 @@ private: #define __ENUMERATE(ErrorName) \ class ErrorName final { \ public: \ - static NonnullRefPtr<DOMException> create(const FlyString& message) \ + static NonnullRefPtr<DOMException> create(FlyString const& message) \ { \ return DOMException::create(#ErrorName, message); \ } \ diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp index 08ae8d5de2..3da0c63c1a 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp @@ -20,7 +20,7 @@ DOMImplementation::DOMImplementation(Document& document) } // https://dom.spec.whatwg.org/#dom-domimplementation-createdocument -ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const String& namespace_, const String& qualified_name, RefPtr<DocumentType> doctype) const +ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(String const& namespace_, String const& qualified_name, RefPtr<DocumentType> doctype) const { // FIXME: This should specifically be an XML document. auto xml_document = Document::create(); @@ -51,7 +51,7 @@ ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const St } // https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument -NonnullRefPtr<Document> DOMImplementation::create_html_document(const String& title) const +NonnullRefPtr<Document> DOMImplementation::create_html_document(String const& title) const { // FIXME: This should specifically be a HTML document. auto html_document = Document::create(); diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.h b/Userland/Libraries/LibWeb/DOM/DOMImplementation.h index 74948243be..1c8d828696 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.h +++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.h @@ -28,7 +28,7 @@ public: } ExceptionOr<NonnullRefPtr<Document>> create_document(String const&, String const&, RefPtr<DocumentType>) const; - NonnullRefPtr<Document> create_html_document(const String& title) const; + NonnullRefPtr<Document> create_html_document(String const& title) const; ExceptionOr<NonnullRefPtr<DocumentType>> create_document_type(String const& qualified_name, String const& public_id, String const& system_id); // https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 929042dc74..d91d6c1e44 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -307,7 +307,7 @@ Origin Document::origin() const return { m_url.protocol(), m_url.host(), m_url.port_or_default() }; } -void Document::set_origin(const Origin& origin) +void Document::set_origin(Origin const& origin) { m_url.set_protocol(origin.protocol()); m_url.set_host(origin.host()); @@ -328,7 +328,7 @@ void Document::schedule_layout_update() m_layout_update_timer->start(); } -bool Document::is_child_allowed(const Node& node) const +bool Document::is_child_allowed(Node const& node) const { switch (node.type()) { case NodeType::DOCUMENT_NODE: @@ -350,7 +350,7 @@ Element* Document::document_element() return first_child_of_type<Element>(); } -const Element* Document::document_element() const +Element const* Document::document_element() const { return first_child_of_type<Element>(); } @@ -432,7 +432,7 @@ String Document::title() const return builder.to_string(); } -void Document::set_title(const String& title) +void Document::set_title(String const& title) { auto* head_element = const_cast<HTML::HTMLHeadElement*>(head()); if (!head_element) @@ -651,9 +651,9 @@ void Document::set_visited_link_color(Color color) m_visited_link_color = color; } -const Layout::InitialContainingBlock* Document::layout_node() const +Layout::InitialContainingBlock const* Document::layout_node() const { - return static_cast<const Layout::InitialContainingBlock*>(Node::layout_node()); + return static_cast<Layout::InitialContainingBlock const*>(Node::layout_node()); } Layout::InitialContainingBlock* Document::layout_node() @@ -935,12 +935,12 @@ NonnullRefPtr<DocumentFragment> Document::create_document_fragment() return adopt_ref(*new DocumentFragment(*this)); } -NonnullRefPtr<Text> Document::create_text_node(const String& data) +NonnullRefPtr<Text> Document::create_text_node(String const& data) { return adopt_ref(*new Text(*this, data)); } -NonnullRefPtr<Comment> Document::create_comment(const String& data) +NonnullRefPtr<Comment> Document::create_comment(String const& data) { return adopt_ref(*new Comment(*this, data)); } @@ -951,7 +951,7 @@ NonnullRefPtr<Range> Document::create_range() } // https://dom.spec.whatwg.org/#dom-document-createevent -NonnullRefPtr<Event> Document::create_event(const String& interface) +NonnullRefPtr<Event> Document::create_event(String const& interface) { auto interface_lowercase = interface.to_lowercase(); RefPtr<Event> event; @@ -1101,12 +1101,12 @@ ExceptionOr<NonnullRefPtr<Node>> Document::adopt_node_binding(NonnullRefPtr<Node return node; } -const DocumentType* Document::doctype() const +DocumentType const* Document::doctype() const { return first_child_of_type<DocumentType>(); } -const String& Document::compat_mode() const +String const& Document::compat_mode() const { static String back_compat = "BackCompat"; static String css1_compat = "CSS1Compat"; @@ -1192,12 +1192,12 @@ Page* Document::page() return m_browsing_context ? m_browsing_context->page() : nullptr; } -const Page* Document::page() const +Page const* Document::page() const { return m_browsing_context ? m_browsing_context->page() : nullptr; } -EventTarget* Document::get_parent(const Event& event) +EventTarget* Document::get_parent(Event const& event) { if (event.type() == HTML::EventNames::load) return nullptr; diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 7b1ca335c7..4412efd5e9 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -68,7 +68,7 @@ public: AK::URL url() const { return m_url; } Origin origin() const; - void set_origin(const Origin& origin); + void set_origin(Origin const& origin); AK::URL parse_url(String const&) const; @@ -84,14 +84,14 @@ public: void set_hovered_node(Node*); Node* hovered_node() { return m_hovered_node; } - const Node* hovered_node() const { return m_hovered_node; } + Node const* hovered_node() const { return m_hovered_node; } void set_inspected_node(Node*); Node* inspected_node() { return m_inspected_node; } - const Node* inspected_node() const { return m_inspected_node; } + Node const* inspected_node() const { return m_inspected_node; } Element* document_element(); - const Element* document_element() const; + Element const* document_element() const; HTML::HTMLHtmlElement* html_element(); HTML::HTMLHeadElement* head(); @@ -115,7 +115,7 @@ public: ExceptionOr<void> set_body(HTML::HTMLElement* new_body); String title() const; - void set_title(const String&); + void set_title(String const&); void attach_to_browsing_context(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&); void detach_from_browsing_context(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&); @@ -124,9 +124,9 @@ public: HTML::BrowsingContext const* browsing_context() const { return m_browsing_context.ptr(); } Page* page(); - const Page* page() const; + Page const* page() const; - Color background_color(const Gfx::Palette&) const; + Color background_color(Gfx::Palette const&) const; Vector<CSS::BackgroundLayerData> const* background_layers() const; Color link_color() const; @@ -148,9 +148,9 @@ public: void invalidate_layout(); void invalidate_stacking_context_tree(); - virtual bool is_child_allowed(const Node&) const override; + virtual bool is_child_allowed(Node const&) const override; - const Layout::InitialContainingBlock* layout_node() const; + Layout::InitialContainingBlock const* layout_node() const; Layout::InitialContainingBlock* layout_node(); void schedule_style_update(); @@ -168,8 +168,8 @@ public: NonnullRefPtr<HTMLCollection> forms(); NonnullRefPtr<HTMLCollection> scripts(); - const String& source() const { return m_source; } - void set_source(const String& source) { m_source = source; } + String const& source() const { return m_source; } + void set_source(String const& source) { m_source = source; } HTML::EnvironmentSettingsObject& relevant_settings_object(); JS::Realm& realm(); @@ -177,13 +177,13 @@ public: JS::Value run_javascript(StringView source, StringView filename = "(unknown)"); - ExceptionOr<NonnullRefPtr<Element>> create_element(const String& tag_name); - ExceptionOr<NonnullRefPtr<Element>> create_element_ns(const String& namespace_, const String& qualified_name); + ExceptionOr<NonnullRefPtr<Element>> create_element(String const& tag_name); + ExceptionOr<NonnullRefPtr<Element>> create_element_ns(String const& namespace_, String const& qualified_name); NonnullRefPtr<DocumentFragment> create_document_fragment(); - NonnullRefPtr<Text> create_text_node(const String& data); - NonnullRefPtr<Comment> create_comment(const String& data); + NonnullRefPtr<Text> create_text_node(String const& data); + NonnullRefPtr<Comment> create_comment(String const& data); NonnullRefPtr<Range> create_range(); - NonnullRefPtr<Event> create_event(const String& interface); + NonnullRefPtr<Event> create_event(String const& interface); void set_pending_parsing_blocking_script(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement*); HTML::HTMLScriptElement* pending_parsing_blocking_script() { return m_pending_parsing_blocking_script; } @@ -205,18 +205,18 @@ public: void adopt_node(Node&); ExceptionOr<NonnullRefPtr<Node>> adopt_node_binding(NonnullRefPtr<Node>); - const DocumentType* doctype() const; - const String& compat_mode() const; + DocumentType const* doctype() const; + String const& compat_mode() const; void set_editable(bool editable) { m_editable = editable; } virtual bool is_editable() const final; Element* focused_element() { return m_focused_element; } - const Element* focused_element() const { return m_focused_element; } + Element const* focused_element() const { return m_focused_element; } void set_focused_element(Element*); - const Element* active_element() const { return m_active_element; } + Element const* active_element() const { return m_active_element; } void set_active_element(Element*); @@ -224,7 +224,7 @@ public: void set_created_for_appropriate_template_contents(bool value) { m_created_for_appropriate_template_contents = value; } Document* associated_inert_template_document() { return m_associated_inert_template_document; } - const Document* associated_inert_template_document() const { return m_associated_inert_template_document; } + Document const* associated_inert_template_document() const { return m_associated_inert_template_document; } void set_associated_inert_template_document(Document& document) { m_associated_inert_template_document = document; } String ready_state() const; @@ -253,13 +253,13 @@ public: HTML::Window* default_view() { return m_window; } - const String& content_type() const { return m_content_type; } - void set_content_type(const String& content_type) { m_content_type = content_type; } + String const& content_type() const { return m_content_type; } + void set_content_type(String const& content_type) { m_content_type = content_type; } bool has_encoding() const { return m_encoding.has_value(); } - const Optional<String>& encoding() const { return m_encoding; } + Optional<String> const& encoding() const { return m_encoding; } String encoding_or_default() const { return m_encoding.value_or("UTF-8"); } - void set_encoding(const Optional<String>& encoding) { m_encoding = encoding; } + void set_encoding(Optional<String> const& encoding) { m_encoding = encoding; } // NOTE: These are intended for the JS bindings String character_set() const { return encoding_or_default(); } @@ -280,7 +280,7 @@ public: void increment_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter++; } void decrement_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter--; } - virtual EventTarget* get_parent(const Event&) override; + virtual EventTarget* get_parent(Event const&) override; String dump_dom_tree_as_json() const; diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.h b/Userland/Libraries/LibWeb/DOM/DocumentType.h index 0e8a9eedd0..89816ef0ea 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentType.h +++ b/Userland/Libraries/LibWeb/DOM/DocumentType.h @@ -28,14 +28,14 @@ public: virtual FlyString node_name() const override { return "#doctype"; } - const String& name() const { return m_name; } - void set_name(const String& name) { m_name = name; } + String const& name() const { return m_name; } + void set_name(String const& name) { m_name = name; } - const String& public_id() const { return m_public_id; } - void set_public_id(const String& public_id) { m_public_id = public_id; } + String const& public_id() const { return m_public_id; } + void set_public_id(String const& public_id) { m_public_id = public_id; } - const String& system_id() const { return m_system_id; } - void set_system_id(const String& system_id) { m_system_id = system_id; } + String const& system_id() const { return m_system_id; } + void set_system_id(String const& system_id) { m_system_id = system_id; } private: String m_name; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 4068fa5160..6bce81f358 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -51,7 +51,7 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name) Element::~Element() = default; // https://dom.spec.whatwg.org/#dom-element-getattribute -String Element::get_attribute(const FlyString& name) const +String Element::get_attribute(FlyString const& name) const { // 1. Let attr be the result of getting an attribute given qualifiedName and this. auto const* attribute = m_attributes->get_attribute(name); @@ -65,7 +65,7 @@ String Element::get_attribute(const FlyString& name) const } // https://dom.spec.whatwg.org/#dom-element-setattribute -ExceptionOr<void> Element::set_attribute(const FlyString& name, const String& value) +ExceptionOr<void> Element::set_attribute(FlyString const& name, String const& value) { // 1. If qualifiedName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException. // FIXME: Proper name validation @@ -156,7 +156,7 @@ ExceptionOr<void> Element::set_attribute_ns(FlyString const& namespace_, FlyStri } // https://dom.spec.whatwg.org/#dom-element-removeattribute -void Element::remove_attribute(const FlyString& name) +void Element::remove_attribute(FlyString const& name) { m_attributes->remove_attribute(name); @@ -167,7 +167,7 @@ void Element::remove_attribute(const FlyString& name) } // https://dom.spec.whatwg.org/#dom-element-hasattribute -bool Element::has_attribute(const FlyString& name) const +bool Element::has_attribute(FlyString const& name) const { return m_attributes->get_attribute(name) != nullptr; } @@ -232,7 +232,7 @@ Vector<String> Element::get_attribute_names() const return names; } -bool Element::has_class(const FlyString& class_name, CaseSensitivity case_sensitivity) const +bool Element::has_class(FlyString const& class_name, CaseSensitivity case_sensitivity) const { return any_of(m_classes, [&](auto& it) { return case_sensitivity == CaseSensitivity::CaseSensitive @@ -291,7 +291,7 @@ RefPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Document& TODO(); } -void Element::parse_attribute(const FlyString& name, const String& value) +void Element::parse_attribute(FlyString const& name, String const& value) { if (name == HTML::AttributeNames::class_) { auto new_classes = value.split_view(is_ascii_space); diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 8746a69f6f..5608534806 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -36,27 +36,27 @@ public: Element(Document&, DOM::QualifiedName); virtual ~Element() override; - const String& qualified_name() const { return m_qualified_name.as_string(); } - const String& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; } + String const& qualified_name() const { return m_qualified_name.as_string(); } + String const& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; } virtual FlyString node_name() const final { return html_uppercased_qualified_name(); } - const FlyString& local_name() const { return m_qualified_name.local_name(); } + FlyString const& local_name() const { return m_qualified_name.local_name(); } // NOTE: This is for the JS bindings - const String& tag_name() const { return html_uppercased_qualified_name(); } + String const& tag_name() const { return html_uppercased_qualified_name(); } - const FlyString& prefix() const { return m_qualified_name.prefix(); } - const FlyString& namespace_() const { return m_qualified_name.namespace_(); } + FlyString const& prefix() const { return m_qualified_name.prefix(); } + FlyString const& namespace_() const { return m_qualified_name.namespace_(); } // NOTE: This is for the JS bindings - const FlyString& namespace_uri() const { return namespace_(); } + FlyString const& namespace_uri() const { return namespace_(); } - bool has_attribute(const FlyString& name) const; + bool has_attribute(FlyString const& name) const; bool has_attributes() const { return !m_attributes->is_empty(); } - String attribute(const FlyString& name) const { return get_attribute(name); } - String get_attribute(const FlyString& name) const; - ExceptionOr<void> set_attribute(const FlyString& name, const String& value); + String attribute(FlyString const& name) const { return get_attribute(name); } + String get_attribute(FlyString const& name) const; + ExceptionOr<void> set_attribute(FlyString const& name, String const& value); ExceptionOr<void> set_attribute_ns(FlyString const& namespace_, FlyString const& qualified_name, String const& value); - void remove_attribute(const FlyString& name); + void remove_attribute(FlyString const& name); DOM::ExceptionOr<bool> toggle_attribute(FlyString const& name, Optional<bool> force); size_t attribute_list_size() const { return m_attributes->length(); } NonnullRefPtr<NamedNodeMap> const& attributes() const { return m_attributes; } @@ -81,11 +81,11 @@ public: } } - bool has_class(const FlyString&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - const Vector<FlyString>& class_names() const { return m_classes; } + bool has_class(FlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + Vector<FlyString> const& class_names() const { return m_classes; } virtual void apply_presentational_hints(CSS::StyleProperties&) const { } - virtual void parse_attribute(const FlyString& name, const String& value); + virtual void parse_attribute(FlyString const& name, String const& value); virtual void did_remove_attribute(FlyString const&); enum class NeedsRelayout { @@ -95,7 +95,7 @@ public: NeedsRelayout recompute_style(); Layout::NodeWithStyle* layout_node() { return static_cast<Layout::NodeWithStyle*>(Node::layout_node()); } - const Layout::NodeWithStyle* layout_node() const { return static_cast<const Layout::NodeWithStyle*>(Node::layout_node()); } + Layout::NodeWithStyle const* layout_node() const { return static_cast<Layout::NodeWithStyle const*>(Node::layout_node()); } String name() const { return attribute(HTML::AttributeNames::name); } @@ -116,7 +116,7 @@ public: NonnullRefPtr<HTMLCollection> get_elements_by_class_name(FlyString const&); ShadowRoot* shadow_root() { return m_shadow_root; } - const ShadowRoot* shadow_root() const { return m_shadow_root; } + ShadowRoot const* shadow_root() const { return m_shadow_root; } void set_shadow_root(RefPtr<ShadowRoot>); void set_custom_properties(HashMap<FlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); } diff --git a/Userland/Libraries/LibWeb/DOM/Event.cpp b/Userland/Libraries/LibWeb/DOM/Event.cpp index 16ef6055f3..dc16bad15b 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.cpp +++ b/Userland/Libraries/LibWeb/DOM/Event.cpp @@ -37,7 +37,7 @@ void Event::set_cancelled_flag() } // https://dom.spec.whatwg.org/#concept-event-initialize -void Event::initialize(const String& type, bool bubbles, bool cancelable) +void Event::initialize(String const& type, bool bubbles, bool cancelable) { m_initialized = true; m_stop_propagation = false; @@ -51,7 +51,7 @@ void Event::initialize(const String& type, bool bubbles, bool cancelable) } // https://dom.spec.whatwg.org/#dom-event-initevent -void Event::init_event(const String& type, bool bubbles, bool cancelable) +void Event::init_event(String const& type, bool bubbles, bool cancelable) { if (m_dispatch) return; diff --git a/Userland/Libraries/LibWeb/DOM/Event.h b/Userland/Libraries/LibWeb/DOM/Event.h index 23d25f040e..698b65250b 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.h +++ b/Userland/Libraries/LibWeb/DOM/Event.h @@ -47,11 +47,11 @@ public: using Path = Vector<PathEntry>; - static NonnullRefPtr<Event> create(const FlyString& event_name, EventInit const& event_init = {}) + static NonnullRefPtr<Event> create(FlyString const& event_name, EventInit const& event_init = {}) { return adopt_ref(*new Event(event_name, event_init)); } - static NonnullRefPtr<Event> create_with_global_object(Bindings::WindowObject&, const FlyString& event_name, EventInit const& event_init) + static NonnullRefPtr<Event> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, EventInit const& event_init) { return Event::create(event_name, event_init); } @@ -60,7 +60,7 @@ public: double time_stamp() const; - const FlyString& type() const { return m_type; } + FlyString const& type() const { return m_type; } void set_type(StringView type) { m_type = type; } RefPtr<EventTarget> target() const { return m_target; } @@ -111,7 +111,7 @@ public: void append_to_path(EventTarget&, RefPtr<EventTarget>, RefPtr<EventTarget>, TouchTargetList&, bool); Path& path() { return m_path; } - const Path& path() const { return m_path; } + Path const& path() const { return m_path; } void clear_path() { m_path.clear(); } void set_touch_target_list(TouchTargetList& touch_target_list) { m_touch_target_list = touch_target_list; } @@ -142,7 +142,7 @@ public: m_stop_immediate_propagation = true; } - void init_event(const String&, bool, bool); + void init_event(String const&, bool, bool); void set_time_stamp(double time_stamp) { m_time_stamp = time_stamp; } @@ -163,7 +163,7 @@ protected: { } - void initialize(const String&, bool, bool); + void initialize(String const&, bool, bool); private: FlyString m_type; diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.h b/Userland/Libraries/LibWeb/DOM/EventTarget.h index 75586c3d36..c0098efc47 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.h +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.h @@ -41,7 +41,7 @@ public: virtual JS::Object* create_wrapper(JS::GlobalObject&) = 0; - virtual EventTarget* get_parent(const Event&) { return nullptr; } + virtual EventTarget* get_parent(Event const&) { return nullptr; } void add_an_event_listener(NonnullRefPtr<DOMEventListener>); void remove_an_event_listener(DOMEventListener&); @@ -50,7 +50,7 @@ public: auto& event_listener_list() { return m_event_listener_list; } auto const& event_listener_list() const { return m_event_listener_list; } - Function<void(const Event&)> activation_behavior; + Function<void(Event const&)> activation_behavior; // NOTE: These only exist for checkbox and radio input elements. virtual void legacy_pre_activation_behavior() { } diff --git a/Userland/Libraries/LibWeb/DOM/ExceptionOr.h b/Userland/Libraries/LibWeb/DOM/ExceptionOr.h index e741cbceba..bef730ff68 100644 --- a/Userland/Libraries/LibWeb/DOM/ExceptionOr.h +++ b/Userland/Libraries/LibWeb/DOM/ExceptionOr.h @@ -39,7 +39,7 @@ public: { } - ExceptionOr(const ValueType& result) + ExceptionOr(ValueType const& result) : m_result(result) { } @@ -65,7 +65,7 @@ public: } ExceptionOr(ExceptionOr&& other) = default; - ExceptionOr(const ExceptionOr& other) = default; + ExceptionOr(ExceptionOr const& other) = default; ~ExceptionOr() = default; ValueType& value() requires(!IsSame<ValueType, Empty>) diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index ad6773e4e3..c12ed76f78 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -95,7 +95,7 @@ const HTML::HTMLElement* Node::enclosing_html_element() const return first_ancestor_of_type<HTML::HTMLElement>(); } -const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(const FlyString& attribute) const +const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(FlyString const& attribute) const { for (auto* node = this; node; node = node->parent()) { if (is<HTML::HTMLElement>(*node) && verify_cast<HTML::HTMLElement>(*node).has_attribute(attribute)) @@ -162,7 +162,7 @@ String Node::node_value() const } // https://dom.spec.whatwg.org/#ref-for-dom-node-nodevalue%E2%91%A0 -void Node::set_node_value(const String& value) +void Node::set_node_value(String const& value) { if (is<Attribute>(this)) { @@ -249,7 +249,7 @@ Element* Node::parent_element() return verify_cast<Element>(parent()); } -const Element* Node::parent_element() const +Element const* Node::parent_element() const { if (!parent() || !is<Element>(parent())) return nullptr; @@ -650,7 +650,7 @@ void Node::set_layout_node(Badge<Layout::Node>, Layout::Node* layout_node) const m_layout_node = nullptr; } -EventTarget* Node::get_parent(const Event&) +EventTarget* Node::get_parent(Event const&) { // FIXME: returns the node’s assigned slot, if node is assigned, and node’s parent otherwise. return parent(); @@ -746,7 +746,7 @@ u16 Node::compare_document_position(RefPtr<Node> other) } // https://dom.spec.whatwg.org/#concept-tree-host-including-inclusive-ancestor -bool Node::is_host_including_inclusive_ancestor_of(const Node& other) const +bool Node::is_host_including_inclusive_ancestor_of(Node const& other) const { if (is_inclusive_ancestor_of(other)) return true; diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 44d63efb96..ffc513642b 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -50,7 +50,7 @@ public: using TreeNode<Node>::unref; ParentNode* parent_or_shadow_host(); - const ParentNode* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); } + ParentNode const* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); } // ^EventTarget virtual void ref_event_target() final { ref(); } @@ -121,24 +121,24 @@ public: void set_node_value(String const&); Document& document() { return *m_document; } - const Document& document() const { return *m_document; } + Document const& document() const { return *m_document; } RefPtr<Document> owner_document() const; const HTML::HTMLAnchorElement* enclosing_link_element() const; const HTML::HTMLElement* enclosing_html_element() const; - const HTML::HTMLElement* enclosing_html_element_with_attribute(const FlyString&) const; + const HTML::HTMLElement* enclosing_html_element_with_attribute(FlyString const&) const; String child_text_content() const; Node& root(); - const Node& root() const + Node const& root() const { return const_cast<Node*>(this)->root(); } Node& shadow_including_root(); - const Node& shadow_including_root() const + Node const& shadow_including_root() const { return const_cast<Node*>(this)->shadow_including_root(); } @@ -146,10 +146,10 @@ public: bool is_connected() const; Node* parent_node() { return parent(); } - const Node* parent_node() const { return parent(); } + Node const* parent_node() const { return parent(); } Element* parent_element(); - const Element* parent_element() const; + Element const* parent_element() const; virtual void inserted(); virtual void removed_from(Node*) { } @@ -157,7 +157,7 @@ public: virtual void adopted_from(Document&) { } virtual void cloned(Node&, bool) {}; - const Layout::Node* layout_node() const { return m_layout_node; } + Layout::Node const* layout_node() const { return m_layout_node; } Layout::Node* layout_node() { return m_layout_node; } Painting::PaintableBox const* paint_box() const; @@ -165,7 +165,7 @@ public: void set_layout_node(Badge<Layout::Node>, Layout::Node*) const; - virtual bool is_child_allowed(const Node&) const { return true; } + virtual bool is_child_allowed(Node const&) const { return true; } bool needs_style_update() const { return m_needs_style_update; } void set_needs_style_update(bool); @@ -179,14 +179,14 @@ public: void set_document(Badge<Document>, Document&); - virtual EventTarget* get_parent(const Event&) override; + virtual EventTarget* get_parent(Event const&) override; template<typename T> bool fast_is() const = delete; ExceptionOr<void> ensure_pre_insertion_validity(NonnullRefPtr<Node> node, RefPtr<Node> child) const; - bool is_host_including_inclusive_ancestor_of(const Node&) const; + bool is_host_including_inclusive_ancestor_of(Node const&) const; bool is_scripting_enabled() const; bool is_scripting_disabled() const; diff --git a/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h b/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h index 3929382b7c..37a4fde5bd 100644 --- a/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h +++ b/Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h @@ -51,10 +51,10 @@ public: return nullptr; } - const Element* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); } - const Element* previous_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_in_pre_order(); } - const Element* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); } - const Element* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); } + Element const* previous_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_sibling(); } + Element const* previous_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->previous_element_in_pre_order(); } + Element const* next_element_sibling() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_sibling(); } + Element const* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); } protected: NonDocumentTypeChildNode() = default; diff --git a/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h b/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h index 4b8605d4bd..59c1ef65cb 100644 --- a/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h +++ b/Userland/Libraries/LibWeb/DOM/NonElementParentNode.h @@ -16,10 +16,10 @@ namespace Web::DOM { template<typename NodeType> class NonElementParentNode { public: - RefPtr<Element> get_element_by_id(const FlyString& id) const + RefPtr<Element> get_element_by_id(FlyString const& id) const { RefPtr<Element> found_element; - static_cast<const NodeType*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) { + static_cast<NodeType const*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) { if (element.attribute(HTML::AttributeNames::id) == id) { found_element = &element; return IterationDecision::Break; @@ -28,9 +28,9 @@ public: }); return found_element; } - RefPtr<Element> get_element_by_id(const FlyString& id) + RefPtr<Element> get_element_by_id(FlyString const& id) { - return const_cast<const NonElementParentNode*>(this)->get_element_by_id(id); + return const_cast<NonElementParentNode const*>(this)->get_element_by_id(id); } protected: diff --git a/Userland/Libraries/LibWeb/DOM/Position.h b/Userland/Libraries/LibWeb/DOM/Position.h index a4fe55a57e..45ef6768a7 100644 --- a/Userland/Libraries/LibWeb/DOM/Position.h +++ b/Userland/Libraries/LibWeb/DOM/Position.h @@ -21,7 +21,7 @@ public: bool is_valid() const { return m_node; } Node* node() { return m_node; } - const Node* node() const { return m_node; } + Node const* node() const { return m_node; } unsigned offset() const { return m_offset; } bool offset_is_at_end_of_node() const; @@ -29,12 +29,12 @@ public: bool increment_offset(); bool decrement_offset(); - bool operator==(const Position& other) const + bool operator==(Position const& other) const { return m_node == other.m_node && m_offset == other.m_offset; } - bool operator!=(const Position& other) const + bool operator!=(Position const& other) const { return !(*this == other); } diff --git a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp index c1cc2f2dce..66cb7a56bc 100644 --- a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp +++ b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp @@ -9,7 +9,7 @@ namespace Web::DOM { -ProcessingInstruction::ProcessingInstruction(Document& document, const String& data, const String& target) +ProcessingInstruction::ProcessingInstruction(Document& document, String const& data, String const& target) : CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, data) , m_target(target) { diff --git a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h index 087960ca3c..5bc6706daf 100644 --- a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h +++ b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h @@ -15,12 +15,12 @@ class ProcessingInstruction final : public CharacterData { public: using WrapperType = Bindings::ProcessingInstructionWrapper; - ProcessingInstruction(Document&, const String& data, const String& target); + ProcessingInstruction(Document&, String const& data, String const& target); virtual ~ProcessingInstruction() override = default; virtual FlyString node_name() const override { return m_target; } - const String& target() const { return m_target; } + String const& target() const { return m_target; } private: String m_target; diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp index 98965b475d..01a312ee65 100644 --- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp +++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp @@ -19,7 +19,7 @@ ShadowRoot::ShadowRoot(Document& document, Element& host) } // https://dom.spec.whatwg.org/#ref-for-get-the-parent%E2%91%A6 -EventTarget* ShadowRoot::get_parent(const Event& event) +EventTarget* ShadowRoot::get_parent(Event const& event) { if (!event.composed()) { auto& events_first_invocation_target = verify_cast<Node>(*event.path().first().invocation_target); diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h index f550c0e5cb..b4306c4461 100644 --- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h +++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h @@ -23,7 +23,7 @@ public: void set_available_to_element_internals(bool available_to_element_internals) { m_available_to_element_internals = available_to_element_internals; } // ^EventTarget - virtual EventTarget* get_parent(const Event&) override; + virtual EventTarget* get_parent(Event const&) override; // NOTE: This is intended for the JS bindings. String mode() const { return m_closed ? "closed" : "open"; } diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp index 83b21fcdd7..d2ea61a2bb 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.cpp +++ b/Userland/Libraries/LibWeb/DOM/Text.cpp @@ -12,7 +12,7 @@ namespace Web::DOM { -Text::Text(Document& document, const String& data) +Text::Text(Document& document, String const& data) : CharacterData(document, NodeType::TEXT_NODE, data) { } diff --git a/Userland/Libraries/LibWeb/DOM/Text.h b/Userland/Libraries/LibWeb/DOM/Text.h index 2d839cb63a..bccfc2024e 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.h +++ b/Userland/Libraries/LibWeb/DOM/Text.h @@ -16,7 +16,7 @@ class Text final : public CharacterData { public: using WrapperType = Bindings::TextWrapper; - explicit Text(Document&, const String&); + explicit Text(Document&, String const&); virtual ~Text() override = default; static NonnullRefPtr<Text> create_with_global_object(Bindings::WindowObject& window, String const& data); |