diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-11 00:55:02 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-11 01:27:46 +0100 |
commit | 8b1108e4858f797c9216dc8ae4a3918ad50c73b4 (patch) | |
tree | ca64ba25aa735d25013d76c6d83570496c742014 /Userland/Libraries/LibWeb/CSS/Parser | |
parent | ad5d217e760c7fb73ffc0c4c827d767d6be8ec80 (diff) | |
download | serenity-8b1108e4858f797c9216dc8ae4a3918ad50c73b4.zip |
Everywhere: Pass AK::StringView by value
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 22 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.h | 20 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h | 2 |
4 files changed, 23 insertions, 23 deletions
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<T>::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<Selector::SimpleSelector::ANPlusBPattern> 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<CalculatedStyleValue::CalcSum> Parser::parse_calc_sum(ParsingContext cons return make<CalculatedStyleValue::CalcSum>(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<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const& context, StringView const& css) +RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const& context, StringView css) { if (css.is_empty()) return CSS::CSSStyleSheet::create({}); @@ -4231,7 +4231,7 @@ RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const& context, StringV return parser.parse_as_stylesheet(); } -RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const& context, StringView const& css) +RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const& context, StringView css) { if (css.is_empty()) return CSS::PropertyOwningCSSStyleDeclaration::create({}, {}); @@ -4239,7 +4239,7 @@ RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::Parsin return parser.parse_as_list_of_declarations(); } -RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const& context, StringView const& string, CSS::PropertyID property_id) +RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const& context, StringView string, CSS::PropertyID property_id) { if (string.is_empty()) return {}; @@ -4253,25 +4253,25 @@ RefPtr<CSS::CSSRule> parse_css_rule(CSS::ParsingContext const& context, StringVi return parser.parse_as_rule(); } -Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const& context, StringView const& selector_text) +Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const& context, StringView selector_text) { CSS::Parser parser(context, selector_text); return parser.parse_as_selector(); } -RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const& context, StringView const& string) +RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const& context, StringView string) { CSS::Parser parser(context, string); return parser.parse_as_media_query(); } -NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const& context, StringView const& string) +NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const& context, StringView string) { CSS::Parser parser(context, string); return parser.parse_as_media_query_list(); } -RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const& context, StringView const& string) +RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const& context, StringView string) { if (string.is_empty()) return {}; @@ -4279,7 +4279,7 @@ RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const& context, Str return parser.parse_as_supports(); } -RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const& document, StringView const& string) +RefPtr<CSS::StyleValue> 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<Supports::InParens> parse_supports_in_parens(TokenStream<StyleComponentValueRule>&); Optional<Supports::Feature> parse_supports_feature(TokenStream<StyleComponentValueRule>&); - 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<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const&, StringView const&); -RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const&, StringView const&); -RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const&, StringView const&, CSS::PropertyID property_id = CSS::PropertyID::Invalid); -Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const&, StringView const&); +RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const&, StringView); +RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const&, StringView); +RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid); +Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const&, StringView); RefPtr<CSS::CSSRule> parse_css_rule(CSS::ParsingContext const&, StringView); -RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const&, StringView const&); -NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const&, StringView const&); -RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const&, StringView const&); +RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const&, StringView); +NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const&, StringView); +RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const&, StringView); -RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const&, StringView const&); +RefPtr<CSS::StyleValue> 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<Token> parse(); |