mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:47:36 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
virtual ~CSSFontFaceRule() override = default;
|
||||
|
||||
virtual StringView class_name() const override { return "CSSFontFaceRule"; }
|
||||
virtual StringView class_name() const override { return "CSSFontFaceRule"sv; }
|
||||
virtual Type type() const override { return Type::FontFace; }
|
||||
|
||||
FontFace const& font_face() const { return m_font_face; }
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
NonnullRefPtr<CSSStyleSheet> style_sheet_for_bindings() { return *m_style_sheet; }
|
||||
void set_style_sheet(RefPtr<CSSStyleSheet> const& style_sheet) { m_style_sheet = style_sheet; }
|
||||
|
||||
virtual StringView class_name() const override { return "CSSImportRule"; };
|
||||
virtual StringView class_name() const override { return "CSSImportRule"sv; };
|
||||
virtual Type type() const override { return Type::Import; };
|
||||
|
||||
private:
|
||||
|
|
|
@ -31,21 +31,21 @@ String CSSMediaRule::serialized() const
|
|||
StringBuilder builder;
|
||||
|
||||
// 1. The string "@media", followed by a single SPACE (U+0020).
|
||||
builder.append("@media ");
|
||||
builder.append("@media "sv);
|
||||
// 2. The result of performing serialize a media query list on rule’s media query list.
|
||||
builder.append(condition_text());
|
||||
// 3. A single SPACE (U+0020), followed by the string "{", i.e., LEFT CURLY BRACKET (U+007B), followed by a newline.
|
||||
builder.append(" {\n");
|
||||
builder.append(" {\n"sv);
|
||||
// 4. The result of performing serialize a CSS rule on each rule in the rule’s cssRules list, separated by a newline and indented by two spaces.
|
||||
for (size_t i = 0; i < css_rules().length(); i++) {
|
||||
auto rule = css_rules().item(i);
|
||||
if (i != 0)
|
||||
builder.append("\n");
|
||||
builder.append(" ");
|
||||
builder.append("\n"sv);
|
||||
builder.append(" "sv);
|
||||
builder.append(rule->css_text());
|
||||
}
|
||||
// 5. A newline, followed by the string "}", i.e., RIGHT CURLY BRACKET (U+007D)
|
||||
builder.append("\n}");
|
||||
builder.append("\n}"sv);
|
||||
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
virtual ~CSSMediaRule() = default;
|
||||
|
||||
virtual StringView class_name() const override { return "CSSMediaRule"; };
|
||||
virtual StringView class_name() const override { return "CSSMediaRule"sv; };
|
||||
virtual Type type() const override { return Type::Media; };
|
||||
|
||||
virtual String condition_text() const override;
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
virtual Optional<StyleProperty> property(PropertyID) const = 0;
|
||||
|
||||
virtual DOM::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority = "") = 0;
|
||||
virtual DOM::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority = ""sv) = 0;
|
||||
virtual DOM::ExceptionOr<String> remove_property(PropertyID) = 0;
|
||||
|
||||
DOM::ExceptionOr<void> set_property(StringView property_name, StringView css_text, StringView priority);
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
NonnullRefPtrVector<Selector> const& selectors() const { return m_selectors; }
|
||||
CSSStyleDeclaration const& declaration() const { return m_declaration; }
|
||||
|
||||
virtual StringView class_name() const override { return "CSSStyleRule"; };
|
||||
virtual StringView class_name() const override { return "CSSStyleRule"sv; };
|
||||
virtual Type type() const override { return Type::Style; };
|
||||
|
||||
String selector_text() const;
|
||||
|
|
|
@ -34,17 +34,17 @@ String CSSSupportsRule::serialized() const
|
|||
|
||||
StringBuilder builder;
|
||||
|
||||
builder.append("@supports ");
|
||||
builder.append("@supports "sv);
|
||||
builder.append(condition_text());
|
||||
builder.append(" {\n");
|
||||
builder.append(" {\n"sv);
|
||||
for (size_t i = 0; i < css_rules().length(); i++) {
|
||||
auto rule = css_rules().item(i);
|
||||
if (i != 0)
|
||||
builder.append("\n");
|
||||
builder.append(" ");
|
||||
builder.append("\n"sv);
|
||||
builder.append(" "sv);
|
||||
builder.append(rule->css_text());
|
||||
}
|
||||
builder.append("\n}");
|
||||
builder.append("\n}"sv);
|
||||
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
virtual ~CSSSupportsRule() = default;
|
||||
|
||||
virtual StringView class_name() const override { return "CSSSupportsRule"; };
|
||||
virtual StringView class_name() const override { return "CSSSupportsRule"sv; };
|
||||
virtual Type type() const override { return Type::Supports; };
|
||||
|
||||
String condition_text() const override;
|
||||
|
|
|
@ -284,14 +284,14 @@ String MediaCondition::to_string() const
|
|||
builder.append(feature->to_string());
|
||||
break;
|
||||
case Type::Not:
|
||||
builder.append("not ");
|
||||
builder.append("not "sv);
|
||||
builder.append(conditions.first().to_string());
|
||||
break;
|
||||
case Type::And:
|
||||
builder.join(" and ", conditions);
|
||||
builder.join(" and "sv, conditions);
|
||||
break;
|
||||
case Type::Or:
|
||||
builder.join(" or ", conditions);
|
||||
builder.join(" or "sv, conditions);
|
||||
break;
|
||||
case Type::GeneralEnclosed:
|
||||
builder.append(general_enclosed->to_string());
|
||||
|
@ -323,12 +323,12 @@ String MediaQuery::to_string() const
|
|||
StringBuilder builder;
|
||||
|
||||
if (m_negated)
|
||||
builder.append("not ");
|
||||
builder.append("not "sv);
|
||||
|
||||
if (m_negated || m_media_type != MediaType::All || !m_media_condition) {
|
||||
builder.append(CSS::to_string(m_media_type));
|
||||
if (m_media_condition)
|
||||
builder.append(" and ");
|
||||
builder.append(" and "sv);
|
||||
}
|
||||
|
||||
if (m_media_condition) {
|
||||
|
@ -386,7 +386,7 @@ String serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> const& media
|
|||
// 2. Serialize each media query in the list of media queries, in the same order as they
|
||||
// appear in the media query list, and then serialize the list.
|
||||
StringBuilder builder;
|
||||
builder.join(", ", media_queries);
|
||||
builder.join(", "sv, media_queries);
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ String Declaration::to_string() const
|
|||
StringBuilder builder;
|
||||
|
||||
serialize_an_identifier(builder, m_name);
|
||||
builder.append(": ");
|
||||
builder.join(" ", m_values);
|
||||
builder.append(": "sv);
|
||||
builder.join(' ', m_values);
|
||||
|
||||
if (m_important == Important::Yes)
|
||||
builder.append(" !important");
|
||||
builder.append(" !important"sv);
|
||||
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
|
@ -409,9 +409,9 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_attribute_simple_se
|
|||
auto const& case_sensitivity_part = attribute_tokens.next_token();
|
||||
if (case_sensitivity_part.is(Token::Type::Ident)) {
|
||||
auto case_sensitivity = case_sensitivity_part.token().ident();
|
||||
if (case_sensitivity.equals_ignoring_case("i")) {
|
||||
if (case_sensitivity.equals_ignoring_case("i"sv)) {
|
||||
simple_selector.attribute().case_type = Selector::SimpleSelector::Attribute::CaseType::CaseInsensitiveMatch;
|
||||
} else if (case_sensitivity.equals_ignoring_case("s")) {
|
||||
} else if (case_sensitivity.equals_ignoring_case("s"sv)) {
|
||||
simple_selector.attribute().case_type = Selector::SimpleSelector::Attribute::CaseType::CaseSensitiveMatch;
|
||||
} else {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Expected a \"i\" or \"s\" attribute selector case sensitivity identifier, got: '{}'", case_sensitivity_part.to_debug_string());
|
||||
|
@ -490,39 +490,39 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
};
|
||||
};
|
||||
|
||||
if (pseudo_name.equals_ignoring_case("active")) {
|
||||
if (pseudo_name.equals_ignoring_case("active"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Active);
|
||||
} else if (pseudo_name.equals_ignoring_case("checked")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("checked"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Checked);
|
||||
} else if (pseudo_name.equals_ignoring_case("disabled")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("disabled"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Disabled);
|
||||
} else if (pseudo_name.equals_ignoring_case("empty")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("empty"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Empty);
|
||||
} else if (pseudo_name.equals_ignoring_case("enabled")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("enabled"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Enabled);
|
||||
} else if (pseudo_name.equals_ignoring_case("first-child")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("first-child"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FirstChild);
|
||||
} else if (pseudo_name.equals_ignoring_case("first-of-type")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("first-of-type"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FirstOfType);
|
||||
} else if (pseudo_name.equals_ignoring_case("focus")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("focus"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Focus);
|
||||
} else if (pseudo_name.equals_ignoring_case("focus-within")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("focus-within"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FocusWithin);
|
||||
} else if (pseudo_name.equals_ignoring_case("hover")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("hover"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Hover);
|
||||
} else if (pseudo_name.equals_ignoring_case("last-child")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("last-child"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::LastChild);
|
||||
} else if (pseudo_name.equals_ignoring_case("last-of-type")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("last-of-type"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::LastOfType);
|
||||
} else if (pseudo_name.equals_ignoring_case("link")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("link"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Link);
|
||||
} else if (pseudo_name.equals_ignoring_case("only-child")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("only-child"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::OnlyChild);
|
||||
} else if (pseudo_name.equals_ignoring_case("only-of-type")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("only-of-type"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::OnlyOfType);
|
||||
} else if (pseudo_name.equals_ignoring_case("root")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("root"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Root);
|
||||
} else if (pseudo_name.equals_ignoring_case("visited")) {
|
||||
} else if (pseudo_name.equals_ignoring_case("visited"sv)) {
|
||||
return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Visited);
|
||||
}
|
||||
|
||||
|
@ -605,7 +605,7 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
: Selector::SimpleSelector::PseudoClass::Type::Where,
|
||||
.argument_selector_list = move(argument_selector_list) }
|
||||
};
|
||||
} else if (pseudo_function.name().equals_ignoring_case("not")) {
|
||||
} else if (pseudo_function.name().equals_ignoring_case("not"sv)) {
|
||||
auto function_token_stream = TokenStream(pseudo_function.values());
|
||||
auto not_selector = TRY(parse_a_selector_list(function_token_stream, SelectorType::Standalone));
|
||||
|
||||
|
@ -817,7 +817,7 @@ NonnullRefPtr<MediaQuery> Parser::parse_media_query(TokenStream<ComponentValue>&
|
|||
return media_query;
|
||||
|
||||
// `[ and <media-condition-without-or> ]?`
|
||||
if (auto maybe_and = tokens.next_token(); maybe_and.is(Token::Type::Ident) && maybe_and.token().ident().equals_ignoring_case("and")) {
|
||||
if (auto maybe_and = tokens.next_token(); maybe_and.is(Token::Type::Ident) && maybe_and.token().ident().equals_ignoring_case("and"sv)) {
|
||||
if (auto media_condition = parse_media_condition(tokens, MediaCondition::AllowOr::No)) {
|
||||
tokens.skip_whitespace();
|
||||
if (tokens.has_next_token())
|
||||
|
@ -964,12 +964,12 @@ Optional<MediaFeature> Parser::parse_media_feature(TokenStream<ComponentValue>&
|
|||
return MediaFeatureName { MediaFeatureName::Type::Normal, id.value() };
|
||||
}
|
||||
|
||||
if (allow_min_max_prefix && (name.starts_with("min-", CaseSensitivity::CaseInsensitive) || name.starts_with("max-", CaseSensitivity::CaseInsensitive))) {
|
||||
if (allow_min_max_prefix && (name.starts_with("min-"sv, CaseSensitivity::CaseInsensitive) || name.starts_with("max-"sv, CaseSensitivity::CaseInsensitive))) {
|
||||
auto adjusted_name = name.substring_view(4);
|
||||
if (auto id = media_feature_id_from_string(adjusted_name); id.has_value() && media_feature_type_is_range(id.value())) {
|
||||
transaction.commit();
|
||||
return MediaFeatureName {
|
||||
name.starts_with("min-", CaseSensitivity::CaseInsensitive) ? MediaFeatureName::Type::Min : MediaFeatureName::Type::Max,
|
||||
name.starts_with("min-"sv, CaseSensitivity::CaseInsensitive) ? MediaFeatureName::Type::Min : MediaFeatureName::Type::Max,
|
||||
id.value()
|
||||
};
|
||||
}
|
||||
|
@ -1345,7 +1345,7 @@ OwnPtr<Supports::Condition> Parser::parse_supports_condition(TokenStream<Compone
|
|||
|
||||
auto& peeked_token = tokens.peek_token();
|
||||
// `not <supports-in-parens>`
|
||||
if (peeked_token.is(Token::Type::Ident) && peeked_token.token().ident().equals_ignoring_case("not")) {
|
||||
if (peeked_token.is(Token::Type::Ident) && peeked_token.token().ident().equals_ignoring_case("not"sv)) {
|
||||
tokens.next_token();
|
||||
tokens.skip_whitespace();
|
||||
auto child = parse_supports_in_parens(tokens);
|
||||
|
@ -1367,9 +1367,9 @@ OwnPtr<Supports::Condition> Parser::parse_supports_condition(TokenStream<Compone
|
|||
if (!token.is(Token::Type::Ident))
|
||||
return {};
|
||||
auto ident = token.token().ident();
|
||||
if (ident.equals_ignoring_case("and"))
|
||||
if (ident.equals_ignoring_case("and"sv))
|
||||
return Supports::Condition::Type::And;
|
||||
if (ident.equals_ignoring_case("or"))
|
||||
if (ident.equals_ignoring_case("or"sv))
|
||||
return Supports::Condition::Type::Or;
|
||||
return {};
|
||||
};
|
||||
|
@ -1957,7 +1957,7 @@ Optional<Declaration> Parser::consume_a_declaration(TokenStream<T>& tokens)
|
|||
Optional<size_t> important_index;
|
||||
for (size_t i = declaration_values.size() - 1; i > 0; i--) {
|
||||
auto value = declaration_values[i];
|
||||
if (value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("important")) {
|
||||
if (value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("important"sv)) {
|
||||
important_index = i;
|
||||
break;
|
||||
}
|
||||
|
@ -2314,7 +2314,7 @@ Optional<AK::URL> Parser::parse_url_function(ComponentValue const& component_val
|
|||
// FIXME: Handle data: urls (RFC2397)
|
||||
|
||||
auto convert_string_to_url = [&](StringView& url_string) -> Optional<AK::URL> {
|
||||
if (url_string.starts_with("data:", CaseSensitivity::CaseInsensitive)) {
|
||||
if (url_string.starts_with("data:"sv, CaseSensitivity::CaseInsensitive)) {
|
||||
auto data_url = AK::URL(url_string);
|
||||
|
||||
switch (allowed_data_url_type) {
|
||||
|
@ -2337,7 +2337,7 @@ Optional<AK::URL> Parser::parse_url_function(ComponentValue const& component_val
|
|||
auto url_string = component_value.token().url();
|
||||
return convert_string_to_url(url_string);
|
||||
}
|
||||
if (component_value.is_function() && component_value.function().name().equals_ignoring_case("url")) {
|
||||
if (component_value.is_function() && component_value.function().name().equals_ignoring_case("url"sv)) {
|
||||
auto& function_values = component_value.function().values();
|
||||
// FIXME: Handle url-modifiers. https://www.w3.org/TR/css-values-4/#url-modifiers
|
||||
for (size_t i = 0; i < function_values.size(); ++i) {
|
||||
|
@ -2509,7 +2509,7 @@ Optional<StyleProperty> Parser::convert_to_style_property(Declaration const& dec
|
|||
auto property_id = property_id_from_string(property_name);
|
||||
|
||||
if (property_id == PropertyID::Invalid) {
|
||||
if (property_name.starts_with("--")) {
|
||||
if (property_name.starts_with("--"sv)) {
|
||||
property_id = PropertyID::Custom;
|
||||
} else if (has_ignored_vendor_prefix(property_name)) {
|
||||
return {};
|
||||
|
@ -2542,11 +2542,11 @@ RefPtr<StyleValue> Parser::parse_builtin_value(ComponentValue const& component_v
|
|||
{
|
||||
if (component_value.is(Token::Type::Ident)) {
|
||||
auto ident = component_value.token().ident();
|
||||
if (ident.equals_ignoring_case("inherit"))
|
||||
if (ident.equals_ignoring_case("inherit"sv))
|
||||
return InheritStyleValue::the();
|
||||
if (ident.equals_ignoring_case("initial"))
|
||||
if (ident.equals_ignoring_case("initial"sv))
|
||||
return InitialStyleValue::the();
|
||||
if (ident.equals_ignoring_case("unset"))
|
||||
if (ident.equals_ignoring_case("unset"sv))
|
||||
return UnsetStyleValue::the();
|
||||
// FIXME: Implement `revert` and `revert-layer` keywords, from Cascade4 and Cascade5 respectively
|
||||
}
|
||||
|
@ -2595,10 +2595,10 @@ RefPtr<StyleValue> Parser::parse_dynamic_value(ComponentValue const& component_v
|
|||
if (component_value.is_function()) {
|
||||
auto& function = component_value.function();
|
||||
|
||||
if (function.name().equals_ignoring_case("calc"))
|
||||
if (function.name().equals_ignoring_case("calc"sv))
|
||||
return parse_calculated_value(function.values());
|
||||
|
||||
if (function.name().equals_ignoring_case("var")) {
|
||||
if (function.name().equals_ignoring_case("var"sv)) {
|
||||
// Declarations using `var()` should already be parsed as an UnresolvedStyleValue before this point.
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
@ -2658,7 +2658,7 @@ Optional<Length> Parser::parse_length(ComponentValue const& component_value)
|
|||
return dimension->length();
|
||||
|
||||
// FIXME: auto isn't a length!
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"))
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"sv))
|
||||
return Length::make_auto();
|
||||
|
||||
return {};
|
||||
|
@ -2751,7 +2751,7 @@ Optional<UnicodeRange> Parser::parse_unicode_range(TokenStream<ComponentValue>&
|
|||
|
||||
// All options start with 'u'/'U'.
|
||||
auto& u = tokens.next_token();
|
||||
if (!(u.is(Token::Type::Ident) && u.token().ident().equals_ignoring_case("u"))) {
|
||||
if (!(u.is(Token::Type::Ident) && u.token().ident().equals_ignoring_case("u"sv))) {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: <urange> does not start with 'u'");
|
||||
return {};
|
||||
}
|
||||
|
@ -2883,7 +2883,7 @@ Optional<UnicodeRange> Parser::parse_unicode_range(StringView text)
|
|||
// 2. Interpret the consumed code points as a hexadecimal number,
|
||||
// with the U+003F QUESTION MARK (?) code points replaced by U+0030 DIGIT ZERO (0) code points.
|
||||
// This is the start value.
|
||||
auto start_value_string = start_value_code_points.replace("?", "0", ReplaceMode::All);
|
||||
auto start_value_string = start_value_code_points.replace("?"sv, "0"sv, ReplaceMode::All);
|
||||
auto maybe_start_value = AK::StringUtils::convert_to_uint_from_hex<u32>(start_value_string);
|
||||
if (!maybe_start_value.has_value()) {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: <urange> ?-converted start value did not parse as hex number.");
|
||||
|
@ -2894,7 +2894,7 @@ Optional<UnicodeRange> Parser::parse_unicode_range(StringView text)
|
|||
// 3. Interpret the consumed code points as a hexadecimal number again,
|
||||
// with the U+003F QUESTION MARK (?) code points replaced by U+0046 LATIN CAPITAL LETTER F (F) code points.
|
||||
// This is the end value.
|
||||
auto end_value_string = start_value_code_points.replace("?", "F", ReplaceMode::All);
|
||||
auto end_value_string = start_value_code_points.replace("?"sv, "F"sv, ReplaceMode::All);
|
||||
auto maybe_end_value = AK::StringUtils::convert_to_uint_from_hex<u32>(end_value_string);
|
||||
if (!maybe_end_value.has_value()) {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: <urange> ?-converted end value did not parse as hex number.");
|
||||
|
@ -2965,7 +2965,7 @@ RefPtr<StyleValue> Parser::parse_dimension_value(ComponentValue const& component
|
|||
if (component_value.is(Token::Type::Number) && !(m_context.in_quirks_mode() && property_has_quirk(m_context.current_property_id(), Quirk::UnitlessLength)))
|
||||
return {};
|
||||
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"))
|
||||
if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"sv))
|
||||
return LengthStyleValue::create(Length::make_auto());
|
||||
|
||||
auto dimension = parse_dimension(component_value);
|
||||
|
@ -4770,7 +4770,7 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c
|
|||
tokens.skip_whitespace();
|
||||
auto& part = tokens.next_token();
|
||||
|
||||
if (part.is(Token::Type::Ident) && part.token().ident().equals_ignoring_case("none")) {
|
||||
if (part.is(Token::Type::Ident) && part.token().ident().equals_ignoring_case("none"sv)) {
|
||||
if (!transformations.is_empty())
|
||||
return nullptr;
|
||||
tokens.skip_whitespace();
|
||||
|
@ -5306,11 +5306,11 @@ Optional<Selector::SimpleSelector::ANPlusBPattern> Parser::parse_a_n_plus_b_patt
|
|||
// odd | even
|
||||
if (first_value.is(Token::Type::Ident)) {
|
||||
auto ident = first_value.token().ident();
|
||||
if (ident.equals_ignoring_case("odd")) {
|
||||
if (ident.equals_ignoring_case("odd"sv)) {
|
||||
transaction.commit();
|
||||
return Selector::SimpleSelector::ANPlusBPattern { 2, 1 };
|
||||
}
|
||||
if (ident.equals_ignoring_case("even")) {
|
||||
if (ident.equals_ignoring_case("even"sv)) {
|
||||
transaction.commit();
|
||||
return Selector::SimpleSelector::ANPlusBPattern { 2, 0 };
|
||||
}
|
||||
|
@ -5781,9 +5781,9 @@ bool Parser::has_ignored_vendor_prefix(StringView string)
|
|||
{
|
||||
if (!string.starts_with('-'))
|
||||
return false;
|
||||
if (string.starts_with("--"))
|
||||
if (string.starts_with("--"sv))
|
||||
return false;
|
||||
if (string.starts_with("-libweb-"))
|
||||
if (string.starts_with("-libweb-"sv))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -5800,7 +5800,7 @@ RefPtr<StyleValue> Parser::parse_css_value(Badge<StyleComputer>, ParsingContext
|
|||
if (tokens.is_empty() || property_id == CSS::PropertyID::Invalid || property_id == CSS::PropertyID::Custom)
|
||||
return {};
|
||||
|
||||
Parser parser(context, "");
|
||||
Parser parser(context, ""sv);
|
||||
TokenStream<ComponentValue> token_stream { tokens };
|
||||
auto result = parser.parse_css_value(property_id, token_stream);
|
||||
if (result.is_error())
|
||||
|
|
|
@ -429,7 +429,7 @@ Token Tokenizer::consume_an_ident_like_token()
|
|||
|
||||
// If string’s value is an ASCII case-insensitive match for "url", and the next input code
|
||||
// point is U+0028 LEFT PARENTHESIS ((), consume it.
|
||||
if (string.equals_ignoring_case("url") && is_left_paren(peek_code_point())) {
|
||||
if (string.equals_ignoring_case("url"sv) && is_left_paren(peek_code_point())) {
|
||||
(void)next_code_point();
|
||||
|
||||
// While the next two input code points are whitespace, consume the next input code point.
|
||||
|
|
|
@ -10,9 +10,9 @@ namespace Web::CSS {
|
|||
|
||||
PreferredColorScheme preferred_color_scheme_from_string(String const& value)
|
||||
{
|
||||
if (value.equals_ignoring_case("light"))
|
||||
if (value.equals_ignoring_case("light"sv))
|
||||
return PreferredColorScheme::Light;
|
||||
if (value.equals_ignoring_case("dark"))
|
||||
if (value.equals_ignoring_case("dark"sv))
|
||||
return PreferredColorScheme::Dark;
|
||||
return PreferredColorScheme::Auto;
|
||||
}
|
||||
|
|
|
@ -151,22 +151,22 @@ String Selector::SimpleSelector::serialize() const
|
|||
if (!attribute.value.is_null()) {
|
||||
switch (attribute.match_type) {
|
||||
case Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch:
|
||||
s.append("=");
|
||||
s.append("="sv);
|
||||
break;
|
||||
case Selector::SimpleSelector::Attribute::MatchType::ContainsWord:
|
||||
s.append("~=");
|
||||
s.append("~="sv);
|
||||
break;
|
||||
case Selector::SimpleSelector::Attribute::MatchType::ContainsString:
|
||||
s.append("*=");
|
||||
s.append("*="sv);
|
||||
break;
|
||||
case Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment:
|
||||
s.append("|=");
|
||||
s.append("|="sv);
|
||||
break;
|
||||
case Selector::SimpleSelector::Attribute::MatchType::StartsWithString:
|
||||
s.append("^=");
|
||||
s.append("^="sv);
|
||||
break;
|
||||
case Selector::SimpleSelector::Attribute::MatchType::EndsWithString:
|
||||
s.append("$=");
|
||||
s.append("$="sv);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -180,10 +180,10 @@ String Selector::SimpleSelector::serialize() const
|
|||
// (the line just above is an addition to CSS OM to match Selectors Level 4 last draft)
|
||||
switch (attribute.case_type) {
|
||||
case Selector::SimpleSelector::Attribute::CaseType::CaseInsensitiveMatch:
|
||||
s.append(" i");
|
||||
s.append(" i"sv);
|
||||
break;
|
||||
case Selector::SimpleSelector::Attribute::CaseType::CaseSensitiveMatch:
|
||||
s.append(" s");
|
||||
s.append(" s"sv);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -304,16 +304,16 @@ String Selector::serialize() const
|
|||
// so we have to check that one.
|
||||
switch (compound_selectors()[i + 1].combinator) {
|
||||
case Selector::Combinator::ImmediateChild:
|
||||
s.append("> ");
|
||||
s.append("> "sv);
|
||||
break;
|
||||
case Selector::Combinator::NextSibling:
|
||||
s.append("+ ");
|
||||
s.append("+ "sv);
|
||||
break;
|
||||
case Selector::Combinator::SubsequentSibling:
|
||||
s.append("~ ");
|
||||
s.append("~ "sv);
|
||||
break;
|
||||
case Selector::Combinator::Column:
|
||||
s.append("|| ");
|
||||
s.append("|| "sv);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -322,7 +322,7 @@ String Selector::serialize() const
|
|||
// 4. If this is the last part of the chain of the selector and there is a pseudo-element,
|
||||
// append "::" followed by the name of the pseudo-element, to s.
|
||||
if (compound_selector.simple_selectors.last().type == Selector::SimpleSelector::Type::PseudoElement) {
|
||||
s.append("::");
|
||||
s.append("::"sv);
|
||||
s.append(pseudo_element_name(compound_selector.simple_selectors.last().pseudo_element()));
|
||||
}
|
||||
}
|
||||
|
@ -336,21 +336,21 @@ String serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selec
|
|||
{
|
||||
// To serialize a group of selectors serialize each selector in the group of selectors and then serialize a comma-separated list of these serializations.
|
||||
StringBuilder builder;
|
||||
builder.join(", ", selectors);
|
||||
builder.join(", "sv, selectors);
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
Optional<Selector::PseudoElement> pseudo_element_from_string(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("after")) {
|
||||
if (name.equals_ignoring_case("after"sv)) {
|
||||
return Selector::PseudoElement::After;
|
||||
} else if (name.equals_ignoring_case("before")) {
|
||||
} else if (name.equals_ignoring_case("before"sv)) {
|
||||
return Selector::PseudoElement::Before;
|
||||
} else if (name.equals_ignoring_case("first-letter")) {
|
||||
} else if (name.equals_ignoring_case("first-letter"sv)) {
|
||||
return Selector::PseudoElement::FirstLetter;
|
||||
} else if (name.equals_ignoring_case("first-line")) {
|
||||
} else if (name.equals_ignoring_case("first-line"sv)) {
|
||||
return Selector::PseudoElement::FirstLine;
|
||||
} else if (name.equals_ignoring_case("marker")) {
|
||||
} else if (name.equals_ignoring_case("marker"sv)) {
|
||||
return Selector::PseudoElement::Marker;
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
result.append("n");
|
||||
// - A is -1: Append "-n" to result.
|
||||
else if (step_size == -1)
|
||||
result.append("-n");
|
||||
result.append("-n"sv);
|
||||
// - A is non-zero: Serialize A and append it to result, then append "n" to result.
|
||||
else if (step_size != 0)
|
||||
result.appendff("{}n", step_size);
|
||||
|
|
|
@ -112,7 +112,7 @@ 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 ")".
|
||||
builder.append("url(");
|
||||
builder.append("url("sv);
|
||||
serialize_a_string(builder, url.to_string());
|
||||
builder.append(')');
|
||||
}
|
||||
|
|
|
@ -563,7 +563,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p
|
|||
if (!custom_property_name_token.is(Parser::Token::Type::Ident))
|
||||
return false;
|
||||
auto custom_property_name = custom_property_name_token.token().ident();
|
||||
if (!custom_property_name.starts_with("--"))
|
||||
if (!custom_property_name.starts_with("--"sv))
|
||||
return false;
|
||||
|
||||
// Detect dependency cycles. https://www.w3.org/TR/css-variables-1/#cycles
|
||||
|
@ -962,15 +962,15 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
|
|||
}
|
||||
}
|
||||
|
||||
int slope = Gfx::name_to_slope("Normal");
|
||||
int slope = Gfx::name_to_slope("Normal"sv);
|
||||
// FIXME: Implement oblique <angle>
|
||||
if (font_style->is_identifier()) {
|
||||
switch (static_cast<IdentifierStyleValue const&>(*font_style).id()) {
|
||||
case CSS::ValueID::Italic:
|
||||
slope = Gfx::name_to_slope("Italic");
|
||||
slope = Gfx::name_to_slope("Italic"sv);
|
||||
break;
|
||||
case CSS::ValueID::Oblique:
|
||||
slope = Gfx::name_to_slope("Oblique");
|
||||
slope = Gfx::name_to_slope("Oblique"sv);
|
||||
break;
|
||||
case CSS::ValueID::Normal:
|
||||
default:
|
||||
|
|
|
@ -272,7 +272,7 @@ String BackgroundStyleValue::to_string() const
|
|||
StringBuilder builder;
|
||||
for (size_t i = 0; i < m_layer_count; i++) {
|
||||
if (i)
|
||||
builder.append(", ");
|
||||
builder.append(", "sv);
|
||||
if (i == m_layer_count - 1)
|
||||
builder.appendff("{} ", m_color->to_string());
|
||||
builder.appendff("{} {} {} {} {} {} {}", get_layer_value_string(m_image, i), get_layer_value_string(m_position, i), get_layer_value_string(m_size, i), get_layer_value_string(m_repeat, i), get_layer_value_string(m_attachment, i), get_layer_value_string(m_origin, i), get_layer_value_string(m_clip, i));
|
||||
|
@ -1530,7 +1530,7 @@ String ShadowStyleValue::to_string() const
|
|||
StringBuilder builder;
|
||||
builder.appendff("{} {} {} {} {}", m_color.to_string(), m_offset_x.to_string(), m_offset_y.to_string(), m_blur_radius.to_string(), m_spread_distance.to_string());
|
||||
if (m_placement == ShadowPlacement::Inner)
|
||||
builder.append(" inset");
|
||||
builder.append(" inset"sv);
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
@ -1582,7 +1582,7 @@ String TransformationStyleValue::to_string() const
|
|||
StringBuilder builder;
|
||||
builder.append(CSS::to_string(m_transform_function));
|
||||
builder.append('(');
|
||||
builder.join(", ", m_values);
|
||||
builder.join(", "sv, m_values);
|
||||
builder.append(')');
|
||||
|
||||
return builder.to_string();
|
||||
|
|
|
@ -101,9 +101,9 @@ String Supports::Condition::to_string() const
|
|||
case Type::Not:
|
||||
return String::formatted("not {}", children.first().to_string());
|
||||
case Type::And:
|
||||
return String::join(" and ", children);
|
||||
return String::join(" and "sv, children);
|
||||
case Type::Or:
|
||||
return String::join(" or ", children);
|
||||
return String::join(" or "sv, children);
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue