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

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -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

View file

@ -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)
{

View file

@ -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;

View file

@ -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)
{
}

View file

@ -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"; }

View file

@ -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);
}

View file

@ -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); \
} \

View file

@ -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();

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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); }

View file

@ -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;

View file

@ -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;

View file

@ -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() { }

View file

@ -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>)

View file

@ -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 nodes assigned slot, if node is assigned, and nodes 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;

View file

@ -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;

View file

@ -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;

View file

@ -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:

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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;

View file

@ -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);

View file

@ -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"; }

View file

@ -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)
{
}

View file

@ -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);