summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-11 00:55:02 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-11 01:27:46 +0100
commit8b1108e4858f797c9216dc8ae4a3918ad50c73b4 (patch)
treeca64ba25aa735d25013d76c6d83570496c742014 /Userland/Libraries/LibWeb/HTML
parentad5d217e760c7fb73ffc0c4c827d767d6be8ec80 (diff)
downloadserenity-8b1108e4858f797c9216dc8ae4a3918ad50c73b4.zip
Everywhere: Pass AK::StringView by value
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/Entities.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h4
6 files changed, 13 insertions, 13 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp
index d0e6d90083..6371b62d8f 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp
@@ -10,7 +10,7 @@
namespace Web {
namespace HTML {
-Optional<EntityMatch> code_points_from_entity(const StringView& entity)
+Optional<EntityMatch> code_points_from_entity(StringView entity)
{
constexpr struct {
StringView entity;
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.h b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h
index 937a3985e4..1b56616acb 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/Entities.h
+++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h
@@ -17,7 +17,7 @@ struct EntityMatch {
StringView entity;
};
-Optional<EntityMatch> code_points_from_entity(const StringView&);
+Optional<EntityMatch> code_points_from_entity(StringView);
}
}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
index 1a7ada5a10..3919802f57 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
@@ -118,7 +118,7 @@ static bool is_html_integration_point(DOM::Element const& element)
return false;
}
-RefPtr<DOM::Document> parse_html_document(const StringView& data, const AK::URL& url, const String& encoding)
+RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, const String& encoding)
{
auto document = DOM::Document::create(url);
HTMLParser parser(document, data, encoding);
@@ -126,7 +126,7 @@ RefPtr<DOM::Document> parse_html_document(const StringView& data, const AK::URL&
return document;
}
-HTMLParser::HTMLParser(DOM::Document& document, const StringView& input, const String& encoding)
+HTMLParser::HTMLParser(DOM::Document& document, StringView input, const String& encoding)
: m_tokenizer(input, encoding)
, m_document(document)
{
@@ -3107,7 +3107,7 @@ DOM::Document& HTMLParser::document()
return *m_document;
}
-NonnullRefPtrVector<DOM::Node> HTMLParser::parse_html_fragment(DOM::Element& context_element, const StringView& markup)
+NonnullRefPtrVector<DOM::Node> HTMLParser::parse_html_fragment(DOM::Element& context_element, StringView markup)
{
auto temp_document = DOM::Document::create();
HTMLParser parser(*temp_document, markup, "utf-8");
@@ -3193,7 +3193,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
Yes,
};
- auto escape_string = [](StringView const& string, AttributeMode attribute_mode) -> String {
+ auto escape_string = [](StringView string, AttributeMode attribute_mode) -> String {
// https://html.spec.whatwg.org/multipage/parsing.html#escapingString
StringBuilder builder;
for (auto& ch : string) {
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h
index c30c374e7a..9805e43094 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h
@@ -39,11 +39,11 @@ namespace Web::HTML {
__ENUMERATE_INSERTION_MODE(AfterAfterBody) \
__ENUMERATE_INSERTION_MODE(AfterAfterFrameset)
-RefPtr<DOM::Document> parse_html_document(const StringView&, const AK::URL&, const String& encoding);
+RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, const String& encoding);
class HTMLParser {
public:
- HTMLParser(DOM::Document&, const StringView& input, const String& encoding);
+ HTMLParser(DOM::Document&, StringView input, const String& encoding);
~HTMLParser();
static NonnullOwnPtr<HTMLParser> create_with_uncertain_encoding(DOM::Document&, const ByteBuffer& input);
@@ -52,7 +52,7 @@ public:
DOM::Document& document();
- static NonnullRefPtrVector<DOM::Node> parse_html_fragment(DOM::Element& context_element, const StringView&);
+ static NonnullRefPtrVector<DOM::Node> parse_html_fragment(DOM::Element& context_element, StringView);
static String serialize_html_fragment(DOM::Node const& node);
enum class InsertionMode {
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
index 98d268bab5..737fec0507 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
@@ -2639,7 +2639,7 @@ _StartOfFunction:
}
}
-bool HTMLTokenizer::consume_next_if_match(StringView const& string, CaseSensitivity case_sensitivity)
+bool HTMLTokenizer::consume_next_if_match(StringView string, CaseSensitivity case_sensitivity)
{
for (size_t i = 0; i < string.length(); ++i) {
auto code_point = peek_code_point(i);
@@ -2678,7 +2678,7 @@ void HTMLTokenizer::create_new_token(HTMLToken::Type type)
m_current_token.set_start_position({}, nth_last_position(offset));
}
-HTMLTokenizer::HTMLTokenizer(StringView const& input, String const& encoding)
+HTMLTokenizer::HTMLTokenizer(StringView input, String const& encoding)
{
auto* decoder = TextCodec::decoder_for(encoding);
VERIFY(decoder);
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
index e70e97398e..23c14cba6e 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
@@ -100,7 +100,7 @@ namespace Web::HTML {
class HTMLTokenizer {
public:
- explicit HTMLTokenizer(StringView const& input, String const& encoding);
+ explicit HTMLTokenizer(StringView input, String const& encoding);
enum class State {
#define __ENUMERATE_TOKENIZER_STATE(state) state,
@@ -125,7 +125,7 @@ private:
void skip(size_t count);
Optional<u32> next_code_point();
Optional<u32> peek_code_point(size_t offset) const;
- bool consume_next_if_match(StringView const&, CaseSensitivity = CaseSensitivity::CaseSensitive);
+ bool consume_next_if_match(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive);
void create_new_token(HTMLToken::Type);
bool current_end_tag_token_is_appropriate() const;
String consume_current_builder();