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 | |
parent | ad5d217e760c7fb73ffc0c4c827d767d6be8ec80 (diff) | |
download | serenity-8b1108e4858f797c9216dc8ae4a3918ad50c73b4.zip |
Everywhere: Pass AK::StringView by value
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h | 2 | ||||
-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 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Serialize.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Serialize.h | 12 |
8 files changed, 37 insertions, 37 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp index 694f321066..c9e1a2ae58 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp @@ -18,7 +18,7 @@ CSSGroupingRule::~CSSGroupingRule() { } -size_t CSSGroupingRule::insert_rule(StringView const&, size_t) +size_t CSSGroupingRule::insert_rule(StringView, size_t) { // https://www.w3.org/TR/cssom-1/#insert-a-css-rule TODO(); diff --git a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h index 108de57469..af12208697 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h @@ -23,7 +23,7 @@ public: CSSRuleList const& css_rules() const { return m_rules; } CSSRuleList& css_rules() { return m_rules; } - size_t insert_rule(StringView const& rule, size_t index = 0); + size_t insert_rule(StringView rule, size_t index = 0); void delete_rule(size_t index); virtual void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const; 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(); diff --git a/Userland/Libraries/LibWeb/CSS/Serialize.cpp b/Userland/Libraries/LibWeb/CSS/Serialize.cpp index 07e8eb7555..e43a5e03c3 100644 --- a/Userland/Libraries/LibWeb/CSS/Serialize.cpp +++ b/Userland/Libraries/LibWeb/CSS/Serialize.cpp @@ -24,7 +24,7 @@ void escape_a_character_as_code_point(StringBuilder& builder, u32 character) } // https://www.w3.org/TR/cssom-1/#serialize-an-identifier -void serialize_an_identifier(StringBuilder& builder, StringView const& ident) +void serialize_an_identifier(StringBuilder& builder, StringView ident) { Utf8View characters { ident }; auto first_character = characters.is_empty() ? 0 : *characters.begin(); @@ -76,7 +76,7 @@ void serialize_an_identifier(StringBuilder& builder, StringView const& ident) } // https://www.w3.org/TR/cssom-1/#serialize-a-string -void serialize_a_string(StringBuilder& builder, StringView const& string) +void serialize_a_string(StringBuilder& builder, StringView string) { Utf8View characters { string }; @@ -108,7 +108,7 @@ void serialize_a_string(StringBuilder& builder, StringView const& string) } // https://www.w3.org/TR/cssom-1/#serialize-a-url -void serialize_a_url(StringBuilder& builder, StringView const& url) +void serialize_a_url(StringBuilder& builder, StringView url) { // To serialize a URL means to create a string represented by "url(", // followed by the serialization of the URL as a string, followed by ")". @@ -131,21 +131,21 @@ String escape_a_character_as_code_point(u32 character) return builder.to_string(); } -String serialize_an_identifier(StringView const& ident) +String serialize_an_identifier(StringView ident) { StringBuilder builder; serialize_an_identifier(builder, ident); return builder.to_string(); } -String serialize_a_string(StringView const& string) +String serialize_a_string(StringView string) { StringBuilder builder; serialize_a_string(builder, string); return builder.to_string(); } -String serialize_a_url(StringView const& url) +String serialize_a_url(StringView url) { StringBuilder builder; serialize_a_url(builder, url); diff --git a/Userland/Libraries/LibWeb/CSS/Serialize.h b/Userland/Libraries/LibWeb/CSS/Serialize.h index 01281efbbb..15ca58151b 100644 --- a/Userland/Libraries/LibWeb/CSS/Serialize.h +++ b/Userland/Libraries/LibWeb/CSS/Serialize.h @@ -14,14 +14,14 @@ namespace Web::CSS { void escape_a_character(StringBuilder&, u32 character); void escape_a_character_as_code_point(StringBuilder&, u32 character); -void serialize_an_identifier(StringBuilder&, StringView const& ident); -void serialize_a_string(StringBuilder&, StringView const& string); -void serialize_a_url(StringBuilder&, StringView const& url); +void serialize_an_identifier(StringBuilder&, StringView ident); +void serialize_a_string(StringBuilder&, StringView string); +void serialize_a_url(StringBuilder&, StringView url); String escape_a_character(u32 character); String escape_a_character_as_code_point(u32 character); -String serialize_an_identifier(StringView const& ident); -String serialize_a_string(StringView const& string); -String serialize_a_url(StringView const& url); +String serialize_an_identifier(StringView ident); +String serialize_a_string(StringView string); +String serialize_a_url(StringView url); } |