From 8b1108e4858f797c9216dc8ae4a3918ad50c73b4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 11 Nov 2021 00:55:02 +0100 Subject: Everywhere: Pass AK::StringView by value --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 22 +++++++++++----------- Userland/Libraries/LibWeb/CSS/Parser/Parser.h | 20 ++++++++++---------- Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp | 2 +- Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'Userland/Libraries/LibWeb/CSS/Parser') diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 314660fbdf..d52c1045e4 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -147,7 +147,7 @@ void TokenStream::dump_all_tokens() } } -Parser::Parser(ParsingContext const& context, StringView const& input, String const& encoding) +Parser::Parser(ParsingContext const& context, StringView input, String const& encoding) : m_context(context) , m_tokenizer(input, encoding) , m_tokens(m_tokenizer.parse()) @@ -3685,7 +3685,7 @@ Optional Parser::parse_a_n_plus_b_patt auto is_dashndash = [](StyleComponentValueRule const& value) -> bool { return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("-n-"sv); }; - auto is_delim = [](StyleComponentValueRule const& value, StringView const& delim) -> bool { + auto is_delim = [](StyleComponentValueRule const& value, StringView delim) -> bool { return value.is(Token::Type::Delim) && value.token().delim().equals_ignoring_case(delim); }; auto is_n_dimension = [](StyleComponentValueRule const& value) -> bool { @@ -4208,7 +4208,7 @@ OwnPtr Parser::parse_calc_sum(ParsingContext cons return make(parsed_calc_product.release_nonnull(), move(additional)); } -bool Parser::has_ignored_vendor_prefix(StringView const& string) +bool Parser::has_ignored_vendor_prefix(StringView string) { if (!string.starts_with('-')) return false; @@ -4223,7 +4223,7 @@ bool Parser::has_ignored_vendor_prefix(StringView const& string) namespace Web { -RefPtr parse_css(CSS::ParsingContext const& context, StringView const& css) +RefPtr parse_css(CSS::ParsingContext const& context, StringView css) { if (css.is_empty()) return CSS::CSSStyleSheet::create({}); @@ -4231,7 +4231,7 @@ RefPtr parse_css(CSS::ParsingContext const& context, StringV return parser.parse_as_stylesheet(); } -RefPtr parse_css_declaration(CSS::ParsingContext const& context, StringView const& css) +RefPtr parse_css_declaration(CSS::ParsingContext const& context, StringView css) { if (css.is_empty()) return CSS::PropertyOwningCSSStyleDeclaration::create({}, {}); @@ -4239,7 +4239,7 @@ RefPtr parse_css_declaration(CSS::Parsin return parser.parse_as_list_of_declarations(); } -RefPtr parse_css_value(CSS::ParsingContext const& context, StringView const& string, CSS::PropertyID property_id) +RefPtr parse_css_value(CSS::ParsingContext const& context, StringView string, CSS::PropertyID property_id) { if (string.is_empty()) return {}; @@ -4253,25 +4253,25 @@ RefPtr parse_css_rule(CSS::ParsingContext const& context, StringVi return parser.parse_as_rule(); } -Optional parse_selector(CSS::ParsingContext const& context, StringView const& selector_text) +Optional parse_selector(CSS::ParsingContext const& context, StringView selector_text) { CSS::Parser parser(context, selector_text); return parser.parse_as_selector(); } -RefPtr parse_media_query(CSS::ParsingContext const& context, StringView const& string) +RefPtr parse_media_query(CSS::ParsingContext const& context, StringView string) { CSS::Parser parser(context, string); return parser.parse_as_media_query(); } -NonnullRefPtrVector parse_media_query_list(CSS::ParsingContext const& context, StringView const& string) +NonnullRefPtrVector parse_media_query_list(CSS::ParsingContext const& context, StringView string) { CSS::Parser parser(context, string); return parser.parse_as_media_query_list(); } -RefPtr parse_css_supports(CSS::ParsingContext const& context, StringView const& string) +RefPtr parse_css_supports(CSS::ParsingContext const& context, StringView string) { if (string.is_empty()) return {}; @@ -4279,7 +4279,7 @@ RefPtr parse_css_supports(CSS::ParsingContext const& context, Str return parser.parse_as_supports(); } -RefPtr parse_html_length(DOM::Document const& document, StringView const& string) +RefPtr parse_html_length(DOM::Document const& document, StringView string) { auto integer = string.to_int(); if (integer.has_value()) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h index 6592e73dc4..1377bf2ea4 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h @@ -80,7 +80,7 @@ private: class Parser { public: - Parser(ParsingContext const&, StringView const& input, String const& encoding = "utf-8"); + Parser(ParsingContext const&, StringView input, String const& encoding = "utf-8"); ~Parser(); // The normal parser entry point, for parsing stylesheets. @@ -260,7 +260,7 @@ private: Optional parse_supports_in_parens(TokenStream&); Optional parse_supports_feature(TokenStream&); - static bool has_ignored_vendor_prefix(StringView const&); + static bool has_ignored_vendor_prefix(StringView); ParsingContext m_context; @@ -273,15 +273,15 @@ private: namespace Web { -RefPtr parse_css(CSS::ParsingContext const&, StringView const&); -RefPtr parse_css_declaration(CSS::ParsingContext const&, StringView const&); -RefPtr parse_css_value(CSS::ParsingContext const&, StringView const&, CSS::PropertyID property_id = CSS::PropertyID::Invalid); -Optional parse_selector(CSS::ParsingContext const&, StringView const&); +RefPtr parse_css(CSS::ParsingContext const&, StringView); +RefPtr parse_css_declaration(CSS::ParsingContext const&, StringView); +RefPtr parse_css_value(CSS::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid); +Optional parse_selector(CSS::ParsingContext const&, StringView); RefPtr parse_css_rule(CSS::ParsingContext const&, StringView); -RefPtr parse_media_query(CSS::ParsingContext const&, StringView const&); -NonnullRefPtrVector parse_media_query_list(CSS::ParsingContext const&, StringView const&); -RefPtr parse_css_supports(CSS::ParsingContext const&, StringView const&); +RefPtr parse_media_query(CSS::ParsingContext const&, StringView); +NonnullRefPtrVector parse_media_query_list(CSS::ParsingContext const&, StringView); +RefPtr parse_css_supports(CSS::ParsingContext const&, StringView); -RefPtr parse_html_length(DOM::Document const&, StringView const&); +RefPtr parse_html_length(DOM::Document const&, StringView); } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp index 9c4602606a..d7f2808720 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp @@ -191,7 +191,7 @@ static inline bool is_E(u32 code_point) namespace Web::CSS { -Tokenizer::Tokenizer(const StringView& input, const String& encoding) +Tokenizer::Tokenizer(StringView input, const String& encoding) { auto* decoder = TextCodec::decoder_for(encoding); VERIFY(decoder); diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h index d557bee3db..201ac94ae2 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h @@ -66,7 +66,7 @@ public: class Tokenizer { public: - explicit Tokenizer(const StringView& input, const String& encoding); + explicit Tokenizer(StringView input, const String& encoding); [[nodiscard]] Vector parse(); -- cgit v1.2.3