1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +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:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -35,7 +35,7 @@ NonnullRefPtr<DOM::Document> DOMParser::parse_from_string(String const& string,
// 4. Start parser and let it run until it has consumed all the characters just inserted into the input stream.
// FIXME: This is to match the default URL. Instead, pass in this's relevant global object's associated Document's URL.
parser->run("about:blank");
parser->run("about:blank"sv);
} else {
// -> Otherwise

View file

@ -27,7 +27,7 @@ Vector<DOMStringMap::NameValuePair> DOMStringMap::get_name_value_pairs() const
// in the order that those attributes are listed in the element's attribute list, add a name-value pair to list whose name is the attribute's name with the first five characters removed and whose value
// is the attribute's value.
m_associated_element->for_each_attribute([&](auto& name, auto& value) {
if (!name.starts_with("data-"))
if (!name.starts_with("data-"sv))
return;
auto name_after_starting_data = name.view().substring_view(5);
@ -102,7 +102,7 @@ DOM::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String cons
// 3. Insert the string data- at the front of name.
// NOTE: This is done out of order because StringBuilder doesn't have prepend.
builder.append("data-");
builder.append("data-"sv);
for (size_t character_index = 0; character_index < name.length(); ++character_index) {
// 1. If name contains a U+002D HYPHEN-MINUS character (-) followed by an ASCII lower alpha, then throw a "SyntaxError" DOMException.
@ -147,7 +147,7 @@ bool DOMStringMap::delete_existing_named_property(String const& name)
// 2. Insert the string data- at the front of name.
// NOTE: This is done out of order because StringBuilder doesn't have prepend.
builder.append("data-");
builder.append("data-"sv);
for (auto character : name) {
// 1. For each ASCII upper alpha in name, insert a U+002D HYPHEN-MINUS character (-) before the character and replace the character with the same character converted to ASCII lowercase.

View file

@ -22,15 +22,15 @@ HTMLBodyElement::~HTMLBodyElement() = default;
void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const
{
for_each_attribute([&](auto& name, auto& value) {
if (name.equals_ignoring_case("bgcolor")) {
if (name.equals_ignoring_case("bgcolor"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
} else if (name.equals_ignoring_case("text")) {
} else if (name.equals_ignoring_case("text"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
} else if (name.equals_ignoring_case("background")) {
} else if (name.equals_ignoring_case("background"sv)) {
VERIFY(m_background_style_value);
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
}
@ -40,19 +40,19 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
void HTMLBodyElement::parse_attribute(FlyString const& name, String const& value)
{
HTMLElement::parse_attribute(name, value);
if (name.equals_ignoring_case("link")) {
if (name.equals_ignoring_case("link"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
document().set_link_color(color.value());
} else if (name.equals_ignoring_case("alink")) {
} else if (name.equals_ignoring_case("alink"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
document().set_active_link_color(color.value());
} else if (name.equals_ignoring_case("vlink")) {
} else if (name.equals_ignoring_case("vlink"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
document().set_visited_link_color(color.value());
} else if (name.equals_ignoring_case("background")) {
} else if (name.equals_ignoring_case("background"sv)) {
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value));
}

View file

@ -56,7 +56,7 @@ String HTMLButtonElement::type() const
auto value = attribute(HTML::AttributeNames::type);
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, _) \
if (value.equals_ignoring_case(#keyword)) \
if (value.equals_ignoring_case(#keyword##sv)) \
return #keyword;
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
@ -70,7 +70,7 @@ HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
auto value = attribute(HTML::AttributeNames::type);
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, state) \
if (value.equals_ignoring_case(#keyword)) \
if (value.equals_ignoring_case(#keyword##sv)) \
return HTMLButtonElement::TypeAttributeState::state;
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE

View file

@ -40,10 +40,10 @@ HTMLElement::ContentEditableState HTMLElement::content_editable_state() const
{
auto contenteditable = attribute(HTML::AttributeNames::contenteditable);
// "true", an empty string or a missing value map to the "true" state.
if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_case("true"))
if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_case("true"sv))
return ContentEditableState::True;
// "false" maps to the "false" state.
if (contenteditable.equals_ignoring_case("false"))
if (contenteditable.equals_ignoring_case("false"sv))
return ContentEditableState::False;
// Having no such attribute or an invalid value maps to the "inherit" state.
return ContentEditableState::Inherit;
@ -80,15 +80,15 @@ String HTMLElement::content_editable() const
// https://html.spec.whatwg.org/multipage/interaction.html#contenteditable
DOM::ExceptionOr<void> HTMLElement::set_content_editable(String const& content_editable)
{
if (content_editable.equals_ignoring_case("inherit")) {
if (content_editable.equals_ignoring_case("inherit"sv)) {
remove_attribute(HTML::AttributeNames::contenteditable);
return {};
}
if (content_editable.equals_ignoring_case("true")) {
if (content_editable.equals_ignoring_case("true"sv)) {
set_attribute(HTML::AttributeNames::contenteditable, "true");
return {};
}
if (content_editable.equals_ignoring_case("false")) {
if (content_editable.equals_ignoring_case("false"sv)) {
set_attribute(HTML::AttributeNames::contenteditable, "false");
return {};
}

View file

@ -20,7 +20,7 @@ HTMLFontElement::~HTMLFontElement() = default;
void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const
{
for_each_attribute([&](auto& name, auto& value) {
if (name.equals_ignoring_case("color")) {
if (name.equals_ignoring_case("color"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));

View file

@ -167,7 +167,7 @@ static bool is_form_control(DOM::Element const& element)
}
if (is<HTMLInputElement>(element)
&& !element.get_attribute(HTML::AttributeNames::type).equals_ignoring_case("image")) {
&& !element.get_attribute(HTML::AttributeNames::type).equals_ignoring_case("image"sv)) {
return true;
}

View file

@ -227,7 +227,7 @@ void HTMLInputElement::parse_attribute(FlyString const& name, String const& valu
HTMLInputElement::TypeAttributeState HTMLInputElement::parse_type_attribute(StringView type)
{
#define __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE(keyword, state) \
if (type.equals_ignoring_case(#keyword)) \
if (type.equals_ignoring_case(#keyword##sv)) \
return HTMLInputElement::TypeAttributeState::state;
ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTES
#undef __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE

View file

@ -175,7 +175,7 @@ void HTMLObjectElement::resource_did_load()
// FIXME: For now, ignore application/ MIME types as we cannot render yet them anyways. We will need to implement the MIME type sniffing
// algorithm in order to map all unknown MIME types to "application/octet-stream".
else if (auto type = resource()->mime_type(); !type.starts_with("application/"))
else if (auto type = resource()->mime_type(); !type.starts_with("application/"sv))
tentative_type = move(type);
// 2. If tentative type is not application/octet-stream, then let resource type be tentative type and jump to the step below labeled handler.
@ -195,7 +195,7 @@ static bool is_xml_mime_type(StringView resource_type)
return false;
// An XML MIME type is any MIME type whose subtype ends in "+xml" or whose essence is "text/xml" or "application/xml". [RFC7303]
if (mime_type->subtype().ends_with("+xml"))
if (mime_type->subtype().ends_with("+xml"sv))
return true;
return mime_type->essence().is_one_of("text/xml"sv, "application/xml"sv);

View file

@ -162,7 +162,7 @@ void HTMLScriptElement::prepare_script()
if (is_javascript_mime_type_essence_match(script_block_type.trim_whitespace())) {
// - If the script block's type string with leading and trailing ASCII whitespace stripped is a JavaScript MIME type essence match, the script's type is "classic".
m_script_type = ScriptType::Classic;
} else if (script_block_type.equals_ignoring_case("module")) {
} else if (script_block_type.equals_ignoring_case("module"sv)) {
// - If the script block's type string is an ASCII case-insensitive match for the string "module", the script's type is "module".
m_script_type = ScriptType::Module;
} else {
@ -217,13 +217,13 @@ void HTMLScriptElement::prepare_script()
event = event.trim_whitespace();
// 4. If for is not an ASCII case-insensitive match for the string "window", then return. The script is not executed.
if (!for_.equals_ignoring_case("window")) {
if (!for_.equals_ignoring_case("window"sv)) {
dbgln("HTMLScriptElement: Refusing to run classic script because the provided 'for' attribute is not equal to 'window'");
return;
}
// 5. If event is not an ASCII case-insensitive match for either the string "onload" or the string "onload()", then return. The script is not executed.
if (!event.equals_ignoring_case("onload") && !event.equals_ignoring_case("onload()")) {
if (!event.equals_ignoring_case("onload"sv) && !event.equals_ignoring_case("onload()"sv)) {
dbgln("HTMLScriptElement: Refusing to run classic script because the provided 'event' attribute is not equal to 'onload' or 'onload()'");
return;
}

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,7 @@ Optional<StringView> extract_character_encoding_from_meta_element(String const&
GenericLexer lexer(lowercase_string);
for (;;) {
auto charset_index = lexer.remaining().find("charset");
auto charset_index = lexer.remaining().find("charset"sv);
if (!charset_index.has_value())
return {};

View file

@ -393,16 +393,16 @@ DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) co
auto const& public_identifier = doctype_token.doctype_data().public_identifier;
auto const& system_identifier = doctype_token.doctype_data().system_identifier;
if (public_identifier.equals_ignoring_case("-//W3O//DTD W3 HTML Strict 3.0//EN//"))
if (public_identifier.equals_ignoring_case("-//W3O//DTD W3 HTML Strict 3.0//EN//"sv))
return DOM::QuirksMode::Yes;
if (public_identifier.equals_ignoring_case("-/W3C/DTD HTML 4.0 Transitional/EN"))
if (public_identifier.equals_ignoring_case("-/W3C/DTD HTML 4.0 Transitional/EN"sv))
return DOM::QuirksMode::Yes;
if (public_identifier.equals_ignoring_case("HTML"))
if (public_identifier.equals_ignoring_case("HTML"sv))
return DOM::QuirksMode::Yes;
if (system_identifier.equals_ignoring_case("http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"))
if (system_identifier.equals_ignoring_case("http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"sv))
return DOM::QuirksMode::Yes;
for (auto& public_id : s_quirks_public_ids) {
@ -411,24 +411,24 @@ DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) co
}
if (doctype_token.doctype_data().missing_system_identifier) {
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Frameset//", CaseSensitivity::CaseInsensitive))
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Frameset//"sv, CaseSensitivity::CaseInsensitive))
return DOM::QuirksMode::Yes;
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Transitional//", CaseSensitivity::CaseInsensitive))
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Transitional//"sv, CaseSensitivity::CaseInsensitive))
return DOM::QuirksMode::Yes;
}
if (public_identifier.starts_with("-//W3C//DTD XHTML 1.0 Frameset//", CaseSensitivity::CaseInsensitive))
if (public_identifier.starts_with("-//W3C//DTD XHTML 1.0 Frameset//"sv, CaseSensitivity::CaseInsensitive))
return DOM::QuirksMode::Limited;
if (public_identifier.starts_with("-//W3C//DTD XHTML 1.0 Transitional//", CaseSensitivity::CaseInsensitive))
if (public_identifier.starts_with("-//W3C//DTD XHTML 1.0 Transitional//"sv, CaseSensitivity::CaseInsensitive))
return DOM::QuirksMode::Limited;
if (!doctype_token.doctype_data().missing_system_identifier) {
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Frameset//", CaseSensitivity::CaseInsensitive))
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Frameset//"sv, CaseSensitivity::CaseInsensitive))
return DOM::QuirksMode::Limited;
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Transitional//", CaseSensitivity::CaseInsensitive))
if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Transitional//"sv, CaseSensitivity::CaseInsensitive))
return DOM::QuirksMode::Limited;
}
@ -1884,7 +1884,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
(void)m_stack_of_open_elements.pop();
token.acknowledge_self_closing_flag_if_set();
auto type_attribute = token.attribute(HTML::AttributeNames::type);
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden")) {
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden"sv)) {
m_frameset_ok = false;
}
return;
@ -2620,7 +2620,7 @@ void HTMLParser::handle_in_table(HTMLToken& token)
}
if (token.is_start_tag() && token.tag_name() == HTML::TagNames::input) {
auto type_attribute = token.attribute(HTML::AttributeNames::type);
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden")) {
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden"sv)) {
goto AnythingElse;
}
@ -3468,18 +3468,18 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
for (auto& ch : string) {
// 1. Replace any occurrence of the "&" character by the string "&amp;".
if (ch == '&')
builder.append("&amp;");
builder.append("&amp;"sv);
// 2. Replace any occurrences of the U+00A0 NO-BREAK SPACE character by the string "&nbsp;".
else if (ch == '\xA0')
builder.append("&nbsp;");
builder.append("&nbsp;"sv);
// 3. If the algorithm was invoked in the attribute mode, replace any occurrences of the """ character by the string "&quot;".
else if (ch == '"' && attribute_mode == AttributeMode::Yes)
builder.append("&quot;");
builder.append("&quot;"sv);
// 4. If the algorithm was not invoked in the attribute mode, replace any occurrences of the "<" character by the string "&lt;", and any occurrences of the ">" character by the string "&gt;".
else if (ch == '<' && attribute_mode == AttributeMode::No)
builder.append("&lt;");
builder.append("&lt;"sv);
else if (ch == '>' && attribute_mode == AttributeMode::No)
builder.append("&gt;");
builder.append("&gt;"sv);
else
builder.append(ch);
}
@ -3544,7 +3544,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
// FIXME: -> If the attribute is in some other namespace:
// The attribute's serialized name is the attribute's qualified name.
builder.append("=\"");
builder.append("=\""sv);
builder.append(escape_string(value, AttributeMode::Yes));
builder.append('"');
});
@ -3559,7 +3559,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
// 7. Append the value of running the HTML fragment serialization algorithm on the current node element (thus recursing into this algorithm for that element),
// followed by a U+003C LESS-THAN SIGN character (<), a U+002F SOLIDUS character (/), tagname again, and finally a U+003E GREATER-THAN SIGN character (>).
builder.append(serialize_html_fragment(element));
builder.append("</");
builder.append("</"sv);
builder.append(tag_name);
builder.append('>');
@ -3594,9 +3594,9 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
// 1. Append the literal string "<!--" (U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS),
// followed by the value of current node's data IDL attribute, followed by the literal string "-->" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN).
builder.append("<!--");
builder.append("<!--"sv);
builder.append(comment_node.data());
builder.append("-->");
builder.append("-->"sv);
return IterationDecision::Continue;
}
@ -3606,7 +3606,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
// 1. Append the literal string "<?" (U+003C LESS-THAN SIGN, U+003F QUESTION MARK), followed by the value of current node's target IDL attribute,
// followed by a single U+0020 SPACE character, followed by the value of current node's data IDL attribute, followed by a single U+003E GREATER-THAN SIGN character (>).
builder.append("<?");
builder.append("<?"sv);
builder.append(processing_instruction_node.target());
builder.append(' ');
builder.append(processing_instruction_node.data());
@ -3621,7 +3621,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
// 1. Append the literal string "<!DOCTYPE" (U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+0044 LATIN CAPITAL LETTER D, U+004F LATIN CAPITAL LETTER O,
// U+0043 LATIN CAPITAL LETTER C, U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL LETTER Y, U+0050 LATIN CAPITAL LETTER P, U+0045 LATIN CAPITAL LETTER E),
// followed by a space (U+0020 SPACE), followed by the value of current node's name IDL attribute, followed by the literal string ">" (U+003E GREATER-THAN SIGN).
builder.append("<!DOCTYPE ");
builder.append("<!DOCTYPE "sv);
builder.append(document_type_node.name());
builder.append('>');
return IterationDecision::Continue;

View file

@ -14,54 +14,54 @@ String HTMLToken::to_string() const
switch (type()) {
case HTMLToken::Type::DOCTYPE:
builder.append("DOCTYPE");
builder.append(" { name: '");
builder.append("DOCTYPE"sv);
builder.append(" { name: '"sv);
builder.append(doctype_data().name);
builder.append("' }");
builder.append("' }"sv);
break;
case HTMLToken::Type::StartTag:
builder.append("StartTag");
builder.append("StartTag"sv);
break;
case HTMLToken::Type::EndTag:
builder.append("EndTag");
builder.append("EndTag"sv);
break;
case HTMLToken::Type::Comment:
builder.append("Comment");
builder.append("Comment"sv);
break;
case HTMLToken::Type::Character:
builder.append("Character");
builder.append("Character"sv);
break;
case HTMLToken::Type::EndOfFile:
builder.append("EndOfFile");
builder.append("EndOfFile"sv);
break;
case HTMLToken::Type::Invalid:
VERIFY_NOT_REACHED();
}
if (type() == HTMLToken::Type::StartTag || type() == HTMLToken::Type::EndTag) {
builder.append(" { name: '");
builder.append(" { name: '"sv);
builder.append(tag_name());
builder.append("', { ");
builder.append("', { "sv);
for_each_attribute([&](auto& attribute) {
builder.append(attribute.local_name);
builder.append("=\"");
builder.append("=\""sv);
builder.append(attribute.value);
builder.append("\" ");
builder.append("\" "sv);
return IterationDecision::Continue;
});
builder.append("} }");
builder.append("} }"sv);
}
if (is_comment()) {
builder.append(" { data: '");
builder.append(" { data: '"sv);
builder.append(comment());
builder.append("' }");
builder.append("' }"sv);
}
if (is_character()) {
builder.append(" { data: '");
builder.append(" { data: '"sv);
builder.append_code_point(code_point());
builder.append("' }");
builder.append("' }"sv);
}
if (type() == HTMLToken::Type::Character) {

View file

@ -407,22 +407,22 @@ _StartOfFunction:
BEGIN_STATE(MarkupDeclarationOpen)
{
DONT_CONSUME_NEXT_INPUT_CHARACTER;
if (consume_next_if_match("--")) {
if (consume_next_if_match("--"sv)) {
create_new_token(HTMLToken::Type::Comment);
m_current_token.set_start_position({}, nth_last_position(3));
SWITCH_TO(CommentStart);
}
if (consume_next_if_match("DOCTYPE", CaseSensitivity::CaseInsensitive)) {
if (consume_next_if_match("DOCTYPE"sv, CaseSensitivity::CaseInsensitive)) {
SWITCH_TO(DOCTYPE);
}
if (consume_next_if_match("[CDATA[")) {
if (consume_next_if_match("[CDATA["sv)) {
// We keep the parser optional so that syntax highlighting can be lexer-only.
// The parser registers itself with the lexer it creates.
if (m_parser != nullptr && m_parser->adjusted_current_node().namespace_() != Namespace::HTML) {
SWITCH_TO(CDATASection);
} else {
create_new_token(HTMLToken::Type::Comment);
m_current_builder.append("[CDATA[");
m_current_builder.append("[CDATA["sv);
SWITCH_TO_WITH_UNCLEAN_BUILDER(BogusComment);
}
}
@ -595,10 +595,10 @@ _StartOfFunction:
}
ANYTHING_ELSE
{
if (to_ascii_uppercase(current_input_character.value()) == 'P' && consume_next_if_match("UBLIC", CaseSensitivity::CaseInsensitive)) {
if (to_ascii_uppercase(current_input_character.value()) == 'P' && consume_next_if_match("UBLIC"sv, CaseSensitivity::CaseInsensitive)) {
SWITCH_TO(AfterDOCTYPEPublicKeyword);
}
if (to_ascii_uppercase(current_input_character.value()) == 'S' && consume_next_if_match("YSTEM", CaseSensitivity::CaseInsensitive)) {
if (to_ascii_uppercase(current_input_character.value()) == 'S' && consume_next_if_match("YSTEM"sv, CaseSensitivity::CaseInsensitive)) {
SWITCH_TO(AfterDOCTYPESystemKeyword);
}
log_parse_error();
@ -1487,7 +1487,7 @@ _StartOfFunction:
}
ANYTHING_ELSE
{
m_current_builder.append("--");
m_current_builder.append("--"sv);
RECONSUME_IN(Comment);
}
}
@ -1498,7 +1498,7 @@ _StartOfFunction:
{
ON('-')
{
m_current_builder.append("--!");
m_current_builder.append("--!"sv);
SWITCH_TO_WITH_UNCLEAN_BUILDER(CommentEndDash);
}
ON('>')
@ -1515,7 +1515,7 @@ _StartOfFunction:
}
ANYTHING_ELSE
{
m_current_builder.append("--!");
m_current_builder.append("--!"sv);
RECONSUME_IN(Comment);
}
}

View file

@ -22,11 +22,11 @@ NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView s
// 2. If muted errors is true, then set baseURL to about:blank.
if (muted_errors == MutedErrors::Yes)
base_url = "about:blank";
base_url = "about:blank"sv;
// 3. If scripting is disabled for settings, then set source to the empty string.
if (environment_settings_object.is_scripting_disabled())
source = "";
source = ""sv;
// 4. Let script be a new classic script that this algorithm will subsequently initialize.
auto script = adopt_ref(*new ClassicScript(move(base_url), move(filename), environment_settings_object));

View file

@ -31,7 +31,7 @@ void WorkerDebugConsoleClient::end_group()
// 2.3. Printer(logLevel, args[, options]), https://console.spec.whatwg.org/#printer
JS::ThrowCompletionOr<JS::Value> WorkerDebugConsoleClient::printer(JS::Console::LogLevel log_level, PrinterArguments arguments)
{
String indent = String::repeated(" ", m_group_stack_depth);
String indent = String::repeated(" "sv, m_group_stack_depth);
if (log_level == JS::Console::LogLevel::Trace) {
auto trace = arguments.get<JS::Console::Trace>();