mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:37:35 +00:00
Everywhere: Pass AK::StringView by value
This commit is contained in:
parent
ad5d217e76
commit
8b1108e485
392 changed files with 978 additions and 978 deletions
|
@ -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;
|
||||
|
|
|
@ -17,7 +17,7 @@ struct EntityMatch {
|
|||
StringView entity;
|
||||
};
|
||||
|
||||
Optional<EntityMatch> code_points_from_entity(const StringView&);
|
||||
Optional<EntityMatch> code_points_from_entity(StringView);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue