diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
31 files changed, 92 insertions, 92 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h index 8d44b124c6..78b6071d9c 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h @@ -16,7 +16,7 @@ public: virtual ~BrowsingContextContainer() override; BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; } - const BrowsingContext* nested_browsing_context() const { return m_nested_browsing_context; } + BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; } const DOM::Document* content_document() const; DOM::Document const* content_document_without_origin_check() const; diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 806cae33cc..d3994da800 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -207,7 +207,7 @@ void CanvasRenderingContext2D::rotate(float radians) m_drawing_state.transform.rotate_radians(radians); } -void CanvasRenderingContext2D::did_draw(const Gfx::FloatRect&) +void CanvasRenderingContext2D::did_draw(Gfx::FloatRect const&) { // FIXME: Make use of the rect to reduce the invalidated area when possible. if (!m_element) @@ -230,7 +230,7 @@ OwnPtr<Gfx::Painter> CanvasRenderingContext2D::painter() return make<Gfx::Painter>(*m_element->bitmap()); } -void CanvasRenderingContext2D::fill_text(const String& text, float x, float y, Optional<double> max_width) +void CanvasRenderingContext2D::fill_text(String const& text, float x, float y, Optional<double> max_width) { if (max_width.has_value() && max_width.value() <= 0) return; @@ -383,7 +383,7 @@ void CanvasRenderingContext2D::fill(Gfx::Painter::WindingRule winding) did_draw(m_path.bounding_box()); } -void CanvasRenderingContext2D::fill(const String& fill_rule) +void CanvasRenderingContext2D::fill(String const& fill_rule) { if (fill_rule == "evenodd") return fill(Gfx::Painter::WindingRule::EvenOdd); @@ -439,7 +439,7 @@ DOM::ExceptionOr<RefPtr<ImageData>> CanvasRenderingContext2D::get_image_data(int return image_data; } -void CanvasRenderingContext2D::put_image_data(const ImageData& image_data, float x, float y) +void CanvasRenderingContext2D::put_image_data(ImageData const& image_data, float x, float y) { auto painter = this->painter(); if (!painter) diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h index ceacd1b5c8..f7465670b0 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h @@ -72,16 +72,16 @@ public: void rect(float x, float y, float width, float height); void stroke(); - void fill_text(const String&, float x, float y, Optional<double> max_width); + void fill_text(String const&, float x, float y, Optional<double> max_width); void stroke_text(String const&, float x, float y, Optional<double> max_width); // FIXME: We should only have one fill(), really. Fix the wrapper generator! void fill(Gfx::Painter::WindingRule); - void fill(const String& fill_rule); + void fill(String const& fill_rule); RefPtr<ImageData> create_image_data(int width, int height) const; DOM::ExceptionOr<RefPtr<ImageData>> get_image_data(int x, int y, int width, int height) const; - void put_image_data(const ImageData&, float x, float y); + void put_image_data(ImageData const&, float x, float y); void save(); void restore(); @@ -112,7 +112,7 @@ private: Gfx::IntRect bounding_box; }; - void did_draw(const Gfx::FloatRect&); + void did_draw(Gfx::FloatRect const&); PreparedText prepare_text(String const& text, float max_width = INFINITY); OwnPtr<Gfx::Painter> painter(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index 5d75290daa..ad0d688c6f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -37,7 +37,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co }); } -void HTMLBodyElement::parse_attribute(const FlyString& name, const String& value) +void HTMLBodyElement::parse_attribute(FlyString const& name, String const& value) { HTMLElement::parse_attribute(name, value); if (name.equals_ignoring_case("link")) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h index 9bbb48ec2f..2aef6df4d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -17,7 +17,7 @@ public: HTMLBodyElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLBodyElement() override; - virtual void parse_attribute(const FlyString&, const String&) override; + virtual void parse_attribute(FlyString const&, String const&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; private: diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 2f132faff9..1244c3dfc0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -59,7 +59,7 @@ CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type) return m_context; } -static Gfx::IntSize bitmap_size_for_canvas(const HTMLCanvasElement& canvas) +static Gfx::IntSize bitmap_size_for_canvas(HTMLCanvasElement const& canvas) { auto width = canvas.width(); auto height = canvas.height(); @@ -94,7 +94,7 @@ bool HTMLCanvasElement::create_bitmap() return m_bitmap; } -String HTMLCanvasElement::to_data_url(const String& type, [[maybe_unused]] Optional<double> quality) const +String HTMLCanvasElement::to_data_url(String const& type, [[maybe_unused]] Optional<double> quality) const { if (!m_bitmap) return {}; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h index d242c12adf..b6bda5884c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h @@ -19,7 +19,7 @@ public: HTMLCanvasElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLCanvasElement() override; - const Gfx::Bitmap* bitmap() const { return m_bitmap; } + Gfx::Bitmap const* bitmap() const { return m_bitmap; } Gfx::Bitmap* bitmap() { return m_bitmap; } bool create_bitmap(); @@ -31,7 +31,7 @@ public: void set_width(unsigned); void set_height(unsigned); - String to_data_url(const String& type, Optional<double> quality) const; + String to_data_url(String const& type, Optional<double> quality) const; private: virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index b9523d51cf..748d85fc5e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -78,7 +78,7 @@ String HTMLElement::content_editable() const } // https://html.spec.whatwg.org/multipage/interaction.html#contenteditable -DOM::ExceptionOr<void> HTMLElement::set_content_editable(const String& content_editable) +DOM::ExceptionOr<void> HTMLElement::set_content_editable(String const& content_editable) { if (content_editable.equals_ignoring_case("inherit")) { remove_attribute(HTML::AttributeNames::contenteditable); @@ -112,7 +112,7 @@ String HTMLElement::inner_text() if (!layout_node()) return text_content(); - Function<void(const Layout::Node&)> recurse = [&](auto& node) { + Function<void(Layout::Node const&)> recurse = [&](auto& node) { for (auto* child = node.first_child(); child; child = child->next_sibling()) { if (is<Layout::TextNode>(child)) builder.append(verify_cast<Layout::TextNode>(*child).text_for_rendering()); @@ -168,7 +168,7 @@ bool HTMLElement::cannot_navigate() const return !is<HTML::HTMLAnchorElement>(this) && !is_connected(); } -void HTMLElement::parse_attribute(const FlyString& name, const String& value) +void HTMLElement::parse_attribute(FlyString const& name, String const& value) { Element::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index 6e6239c56e..c4f0ba8bfc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -26,7 +26,7 @@ public: virtual bool is_editable() const final; String content_editable() const; - DOM::ExceptionOr<void> set_content_editable(const String&); + DOM::ExceptionOr<void> set_content_editable(String const&); String inner_text(); void set_inner_text(StringView); @@ -50,7 +50,7 @@ public: virtual bool is_labelable() const { return false; } protected: - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; private: // ^HTML::GlobalEventHandlers diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h index cb3427e697..1cb3a6c06c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h @@ -22,7 +22,7 @@ public: HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLFieldSetElement() override; - const String& type() const + String const& type() const { static String fieldset = "fieldset"; return fieldset; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 5879b7b4cf..163a457553 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -25,7 +25,7 @@ RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::St return adopt_ref(*new Layout::FrameBox(document(), *this, move(style))); } -void HTMLIFrameElement::parse_attribute(const FlyString& name, const String& value) +void HTMLIFrameElement::parse_attribute(FlyString const& name, String const& value) { HTMLElement::parse_attribute(name, value); if (name == HTML::AttributeNames::src) @@ -56,7 +56,7 @@ void HTMLIFrameElement::removed_from(DOM::Node* node) discard_nested_browsing_context(); } -void HTMLIFrameElement::load_src(const String& value) +void HTMLIFrameElement::load_src(String const& value) { if (!m_nested_browsing_context) return; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h index 1276480fc9..34149e50ed 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -22,9 +22,9 @@ public: private: virtual void inserted() override; virtual void removed_from(Node*) override; - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; - void load_src(const String&); + void load_src(String const&); }; void run_iframe_load_event_steps(HTML::HTMLIFrameElement&); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index bf05d8983e..17fdca1b91 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -70,7 +70,7 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c }); } -void HTMLImageElement::parse_attribute(const FlyString& name, const String& value) +void HTMLImageElement::parse_attribute(FlyString const& name, String const& value) { HTMLElement::parse_attribute(name, value); @@ -83,7 +83,7 @@ RefPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::Sty return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); } -const Gfx::Bitmap* HTMLImageElement::bitmap() const +Gfx::Bitmap const* HTMLImageElement::bitmap() const { return m_image_loader.bitmap(m_image_loader.current_frame_index()); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index e488e96f58..c7b46db958 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -26,12 +26,12 @@ public: HTMLImageElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLImageElement() override; - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; String alt() const { return attribute(HTML::AttributeNames::alt); } String src() const { return attribute(HTML::AttributeNames::src); } - const Gfx::Bitmap* bitmap() const; + Gfx::Bitmap const* bitmap() const; unsigned width() const; void set_width(unsigned); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index b1f835e43b..acebc098f8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -53,7 +53,7 @@ void HTMLLinkElement::inserted() } } -void HTMLLinkElement::parse_attribute(const FlyString& name, const String& value) +void HTMLLinkElement::parse_attribute(FlyString const& name, String const& value) { if (name == HTML::AttributeNames::rel) { m_relationship = 0; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h index 9a5153f9db..f033b27d0a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -29,7 +29,7 @@ public: String href() const { return attribute(HTML::AttributeNames::href); } private: - void parse_attribute(const FlyString&, const String&) override; + void parse_attribute(FlyString const&, String const&) override; // ^ResourceClient virtual void resource_did_fail() override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 0b324c3f05..8c59e43d23 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -23,7 +23,7 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName HTMLObjectElement::~HTMLObjectElement() = default; -void HTMLObjectElement::parse_attribute(const FlyString& name, const String& value) +void HTMLObjectElement::parse_attribute(FlyString const& name, String const& value) { BrowsingContextContainer::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h index 34cb9c4a3a..9b8b7aa558 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -34,7 +34,7 @@ public: HTMLObjectElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLObjectElement() override; - virtual void parse_attribute(const FlyString& name, const String& value) override; + virtual void parse_attribute(FlyString const& name, String const& value) override; String data() const; void set_data(String const& data) { set_attribute(HTML::AttributeNames::data, data); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h index 3e38612e8e..fb3ad802d0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h @@ -23,7 +23,7 @@ public: HTMLOutputElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLOutputElement() override; - const String& type() const + String const& type() const { static String output = "output"; return output; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 71ab5b1eb9..32fa015405 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -99,7 +99,7 @@ void HTMLScriptElement::execute_script() } // https://mimesniff.spec.whatwg.org/#javascript-mime-type-essence-match -static bool is_javascript_mime_type_essence_match(const String& string) +static bool is_javascript_mime_type_essence_match(String const& string) { auto lowercase_string = string.to_lowercase(); return lowercase_string.is_one_of("application/ecmascript", "application/javascript", "application/x-ecmascript", "application/x-javascript", "text/ecmascript", "text/javascript", "text/javascript1.0", "text/javascript1.1", "text/javascript1.2", "text/javascript1.3", "text/javascript1.4", "text/javascript1.5", "text/jscript", "text/livescript", "text/x-ecmascript", "text/x-javascript"); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h index d2eb8509cd..b00dc90bf7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h @@ -19,7 +19,7 @@ public: virtual ~HTMLTemplateElement() override; NonnullRefPtr<DOM::DocumentFragment> content() { return *m_content; } - const NonnullRefPtr<DOM::DocumentFragment> content() const { return *m_content; } + NonnullRefPtr<DOM::DocumentFragment> const content() const { return *m_content; } virtual void adopted_from(DOM::Document&) override; virtual void cloned(Node& copy, bool clone_children) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index 23c3148b7e..f8705b2551 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -23,7 +23,7 @@ public: HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName); virtual ~HTMLTextAreaElement() override; - const String& type() const + String const& type() const { static String textarea = "textarea"; return textarea; diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.h b/Userland/Libraries/LibWeb/HTML/ImageData.h index ed14a5852e..9f5c14d7c0 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.h +++ b/Userland/Libraries/LibWeb/HTML/ImageData.h @@ -26,7 +26,7 @@ public: unsigned height() const; Gfx::Bitmap& bitmap() { return m_bitmap; } - const Gfx::Bitmap& bitmap() const { return m_bitmap; } + Gfx::Bitmap const& bitmap() const { return m_bitmap; } JS::Uint8ClampedArray* data(); const JS::Uint8ClampedArray* data() const; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp index 2a9b622df5..f492a4170f 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp @@ -16,17 +16,17 @@ namespace Web::HTML { -bool prescan_should_abort(const ByteBuffer& input, const size_t& position) +bool prescan_should_abort(ByteBuffer const& input, size_t const& position) { return position >= input.size() || position >= 1024; } -bool prescan_is_whitespace_or_slash(const u8& byte) +bool prescan_is_whitespace_or_slash(u8 const& byte) { return byte == '\t' || byte == '\n' || byte == '\f' || byte == '\r' || byte == ' ' || byte == '/'; } -bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position) +bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position) { while (!prescan_should_abort(input, position) && (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ' || input[position] == '/')) ++position; @@ -96,7 +96,7 @@ Optional<StringView> extract_character_encoding_from_meta_element(String const& return TextCodec::get_standardized_encoding(encoding); } -RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document& document, const ByteBuffer& input, size_t& position) +RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document& document, ByteBuffer const& input, size_t& position) { if (!prescan_skip_whitespace_and_slashes(input, position)) return {}; @@ -160,7 +160,7 @@ value: } // https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding -Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, const ByteBuffer& input) +Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, ByteBuffer const& input) { // https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding @@ -249,7 +249,7 @@ Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, cons } // https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding -String run_encoding_sniffing_algorithm(DOM::Document& document, const ByteBuffer& input) +String run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer const& input) { if (input.size() >= 2) { if (input[0] == 0xFE && input[1] == 0xFF) { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h index e388b68d99..6cb9fc7e31 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.h @@ -12,12 +12,12 @@ namespace Web::HTML { -bool prescan_should_abort(const ByteBuffer& input, const size_t& position); -bool prescan_is_whitespace_or_slash(const u8& byte); -bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position); +bool prescan_should_abort(ByteBuffer const& input, size_t const& position); +bool prescan_is_whitespace_or_slash(u8 const& byte); +bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position); Optional<StringView> extract_character_encoding_from_meta_element(String const&); -RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document&, const ByteBuffer& input, size_t& position); -Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, const ByteBuffer& input); -String run_encoding_sniffing_algorithm(DOM::Document&, const ByteBuffer& input); +RefPtr<DOM::Attribute> prescan_get_attribute(DOM::Document&, ByteBuffer const& input, size_t& position); +Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input); +String run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index ba5e00dc13..7e59679b08 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -32,7 +32,7 @@ namespace Web::HTML { -static inline void log_parse_error(const SourceLocation& location = SourceLocation::current()) +static inline void log_parse_error(SourceLocation const& location = SourceLocation::current()) { dbgln("Parse error! {}", location); } @@ -118,7 +118,7 @@ static bool is_html_integration_point(DOM::Element const& element) return false; } -RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, const String& encoding) +RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, String const& encoding) { auto document = DOM::Document::create(url); auto parser = HTMLParser::create(document, data, encoding); @@ -126,7 +126,7 @@ RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, c return document; } -HTMLParser::HTMLParser(DOM::Document& document, StringView input, const String& encoding) +HTMLParser::HTMLParser(DOM::Document& document, StringView input, String const& encoding) : m_tokenizer(input, encoding) , m_document(document) { @@ -389,7 +389,7 @@ void HTMLParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& toke } } -DOM::QuirksMode HTMLParser::which_quirks_mode(const HTMLToken& doctype_token) const +DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) const { if (doctype_token.doctype_data().force_quirks) return DOM::QuirksMode::Yes; @@ -651,7 +651,7 @@ NonnullRefPtr<DOM::Element> HTMLParser::create_element_for(HTMLToken const& toke } // https://html.spec.whatwg.org/multipage/parsing.html#insert-a-foreign-element -NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(const HTMLToken& token, const FlyString& namespace_) +NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(HTMLToken const& token, FlyString const& namespace_) { auto adjusted_insertion_location = find_appropriate_place_for_inserting_node(); @@ -677,7 +677,7 @@ NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(const HTMLToken& return element; } -NonnullRefPtr<DOM::Element> HTMLParser::insert_html_element(const HTMLToken& token) +NonnullRefPtr<DOM::Element> HTMLParser::insert_html_element(HTMLToken const& token) { return insert_foreign_element(token, Namespace::HTML); } @@ -1011,7 +1011,7 @@ AnythingElse: process_using_the_rules_for(m_insertion_mode, token); } -void HTMLParser::generate_implied_end_tags(const FlyString& exception) +void HTMLParser::generate_implied_end_tags(FlyString const& exception) { while (current_node().local_name() != exception && current_node().local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc)) (void)m_stack_of_open_elements.pop(); @@ -1335,7 +1335,7 @@ HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_a } } -bool HTMLParser::is_special_tag(const FlyString& tag_name, const FlyString& namespace_) +bool HTMLParser::is_special_tag(FlyString const& tag_name, FlyString const& namespace_) { if (namespace_ == Namespace::HTML) { return tag_name.is_one_of( @@ -3357,7 +3357,7 @@ void HTMLParser::reset_the_insertion_mode_appropriately() m_insertion_mode = InsertionMode::InBody; } -const char* HTMLParser::insertion_mode_name() const +char const* HTMLParser::insertion_mode_name() const { switch (m_insertion_mode) { #define __ENUMERATE_INSERTION_MODE(mode) \ @@ -3430,7 +3430,7 @@ NonnullRefPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& docume return adopt_ref(*new HTMLParser(document)); } -NonnullRefPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, const ByteBuffer& input) +NonnullRefPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input) { if (document.has_encoding()) return adopt_ref(*new HTMLParser(document, input, document.encoding().value())); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h index 7fbfb363d6..81d0e46dd3 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h @@ -39,7 +39,7 @@ namespace Web::HTML { __ENUMERATE_INSERTION_MODE(AfterAfterBody) \ __ENUMERATE_INSERTION_MODE(AfterAfterFrameset) -RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, const String& encoding); +RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, String const& encoding); class HTMLParser : public RefCounted<HTMLParser> { friend class HTMLTokenizer; @@ -67,7 +67,7 @@ public: InsertionMode insertion_mode() const { return m_insertion_mode; } - static bool is_special_tag(const FlyString& tag_name, const FlyString& namespace_); + static bool is_special_tag(FlyString const& tag_name, FlyString const& namespace_); HTMLTokenizer& tokenizer() { return m_tokenizer; } @@ -76,12 +76,12 @@ public: size_t script_nesting_level() const { return m_script_nesting_level; } private: - HTMLParser(DOM::Document&, StringView input, const String& encoding); + HTMLParser(DOM::Document&, StringView input, String const& encoding); HTMLParser(DOM::Document&); - const char* insertion_mode_name() const; + char const* insertion_mode_name() const; - DOM::QuirksMode which_quirks_mode(const HTMLToken&) const; + DOM::QuirksMode which_quirks_mode(HTMLToken const&) const; void handle_initial(HTMLToken&); void handle_before_html(HTMLToken&); @@ -111,7 +111,7 @@ private: void stop_parsing() { m_stop_parsing = true; } - void generate_implied_end_tags(const FlyString& exception = {}); + void generate_implied_end_tags(FlyString const& exception = {}); void generate_all_implied_end_tags_thoroughly(); NonnullRefPtr<DOM::Element> create_element_for(HTMLToken const&, FlyString const& namespace_, DOM::Node const& intended_parent); @@ -124,8 +124,8 @@ private: DOM::Text* find_character_insertion_node(); void flush_character_insertions(); - NonnullRefPtr<DOM::Element> insert_foreign_element(const HTMLToken&, const FlyString&); - NonnullRefPtr<DOM::Element> insert_html_element(const HTMLToken&); + NonnullRefPtr<DOM::Element> insert_foreign_element(HTMLToken const&, FlyString const&); + NonnullRefPtr<DOM::Element> insert_html_element(HTMLToken const&); DOM::Element& current_node(); DOM::Element& adjusted_current_node(); DOM::Element& node_before_current_node(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp index 838f147df6..1d2453aad6 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp @@ -31,7 +31,7 @@ bool ListOfActiveFormattingElements::contains(const DOM::Element& element) const return false; } -DOM::Element* ListOfActiveFormattingElements::last_element_with_tag_name_before_marker(const FlyString& tag_name) +DOM::Element* ListOfActiveFormattingElements::last_element_with_tag_name_before_marker(FlyString const& tag_name) { for (ssize_t i = m_entries.size() - 1; i >= 0; --i) { auto& entry = m_entries[i]; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h index 9476e28497..bf8293d1f5 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h @@ -34,10 +34,10 @@ public: void remove(DOM::Element&); - const Vector<Entry>& entries() const { return m_entries; } + Vector<Entry> const& entries() const { return m_entries; } Vector<Entry>& entries() { return m_entries; } - DOM::Element* last_element_with_tag_name_before_marker(const FlyString& tag_name); + DOM::Element* last_element_with_tag_name_before_marker(FlyString const& tag_name); void clear_up_to_the_last_marker(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp index f71b35cdaf..f67c64305d 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp @@ -14,7 +14,7 @@ static Vector<FlyString> s_base_list { "applet", "caption", "html", "table", "td StackOfOpenElements::~StackOfOpenElements() = default; -bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>& list) const +bool StackOfOpenElements::has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const& list) const { for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { auto& node = m_elements.at(i); @@ -26,12 +26,12 @@ bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vec VERIFY_NOT_REACHED(); } -bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_scope(FlyString const& tag_name) const { return has_in_scope_impl(tag_name, s_base_list); } -bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>& list) const +bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, Vector<FlyString> const& list) const { for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { auto& node = m_elements.at(i); @@ -48,19 +48,19 @@ bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const return has_in_scope_impl(target_node, s_base_list); } -bool StackOfOpenElements::has_in_button_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_button_scope(FlyString const& tag_name) const { auto list = s_base_list; list.append("button"); return has_in_scope_impl(tag_name, list); } -bool StackOfOpenElements::has_in_table_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_table_scope(FlyString const& tag_name) const { return has_in_scope_impl(tag_name, { "html", "table", "template" }); } -bool StackOfOpenElements::has_in_list_item_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_list_item_scope(FlyString const& tag_name) const { auto list = s_base_list; list.append("ol"); @@ -74,7 +74,7 @@ bool StackOfOpenElements::has_in_list_item_scope(const FlyString& tag_name) cons // - optgroup in the HTML namespace // - option in the HTML namespace // NOTE: In this case it's "all element types _except_" -bool StackOfOpenElements::has_in_select_scope(const FlyString& tag_name) const +bool StackOfOpenElements::has_in_select_scope(FlyString const& tag_name) const { // https://html.spec.whatwg.org/multipage/parsing.html#has-an-element-in-the-specific-scope for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { @@ -103,7 +103,7 @@ bool StackOfOpenElements::contains(const DOM::Element& element) const return false; } -bool StackOfOpenElements::contains(const FlyString& tag_name) const +bool StackOfOpenElements::contains(FlyString const& tag_name) const { for (auto& element_on_stack : m_elements) { if (element_on_stack.local_name() == tag_name) @@ -112,7 +112,7 @@ bool StackOfOpenElements::contains(const FlyString& tag_name) const return false; } -void StackOfOpenElements::pop_until_an_element_with_tag_name_has_been_popped(const FlyString& tag_name) +void StackOfOpenElements::pop_until_an_element_with_tag_name_has_been_popped(FlyString const& tag_name) { while (m_elements.last().local_name() != tag_name) (void)pop(); @@ -132,7 +132,7 @@ DOM::Element* StackOfOpenElements::topmost_special_node_below(const DOM::Element return found_element; } -StackOfOpenElements::LastElementResult StackOfOpenElements::last_element_with_tag_name(const FlyString& tag_name) +StackOfOpenElements::LastElementResult StackOfOpenElements::last_element_with_tag_name(FlyString const& tag_name) { for (ssize_t i = m_elements.size() - 1; i >= 0; --i) { auto& element = m_elements[i]; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h index 8c6baae04a..726d7018de 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h @@ -36,21 +36,21 @@ public: const DOM::Element& current_node() const { return m_elements.last(); } DOM::Element& current_node() { return m_elements.last(); } - bool has_in_scope(const FlyString& tag_name) const; - bool has_in_button_scope(const FlyString& tag_name) const; - bool has_in_table_scope(const FlyString& tag_name) const; - bool has_in_list_item_scope(const FlyString& tag_name) const; - bool has_in_select_scope(const FlyString& tag_name) const; + bool has_in_scope(FlyString const& tag_name) const; + bool has_in_button_scope(FlyString const& tag_name) const; + bool has_in_table_scope(FlyString const& tag_name) const; + bool has_in_list_item_scope(FlyString const& tag_name) const; + bool has_in_select_scope(FlyString const& tag_name) const; bool has_in_scope(const DOM::Element&) const; bool contains(const DOM::Element&) const; - bool contains(const FlyString& tag_name) const; + bool contains(FlyString const& tag_name) const; - const NonnullRefPtrVector<DOM::Element>& elements() const { return m_elements; } + NonnullRefPtrVector<DOM::Element> const& elements() const { return m_elements; } NonnullRefPtrVector<DOM::Element>& elements() { return m_elements; } - void pop_until_an_element_with_tag_name_has_been_popped(const FlyString&); + void pop_until_an_element_with_tag_name_has_been_popped(FlyString const&); DOM::Element* topmost_special_node_below(const DOM::Element&); @@ -58,12 +58,12 @@ public: DOM::Element* element; ssize_t index; }; - LastElementResult last_element_with_tag_name(const FlyString&); + LastElementResult last_element_with_tag_name(FlyString const&); DOM::Element* element_immediately_above(DOM::Element const&); private: - bool has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>&) const; - bool has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>&) const; + bool has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const&) const; + bool has_in_scope_impl(const DOM::Element& target_node, Vector<FlyString> const&) const; NonnullRefPtrVector<DOM::Element> m_elements; }; |