mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:47:34 +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
|
@ -321,24 +321,24 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
auto box_model = box->box_model();
|
||||
StringBuilder builder;
|
||||
auto serializer = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
MUST(serializer.add("padding_top", box_model.padding.top));
|
||||
MUST(serializer.add("padding_right", box_model.padding.right));
|
||||
MUST(serializer.add("padding_bottom", box_model.padding.bottom));
|
||||
MUST(serializer.add("padding_left", box_model.padding.left));
|
||||
MUST(serializer.add("margin_top", box_model.margin.top));
|
||||
MUST(serializer.add("margin_right", box_model.margin.right));
|
||||
MUST(serializer.add("margin_bottom", box_model.margin.bottom));
|
||||
MUST(serializer.add("margin_left", box_model.margin.left));
|
||||
MUST(serializer.add("border_top", box_model.border.top));
|
||||
MUST(serializer.add("border_right", box_model.border.right));
|
||||
MUST(serializer.add("border_bottom", box_model.border.bottom));
|
||||
MUST(serializer.add("border_left", box_model.border.left));
|
||||
MUST(serializer.add("padding_top"sv, box_model.padding.top));
|
||||
MUST(serializer.add("padding_right"sv, box_model.padding.right));
|
||||
MUST(serializer.add("padding_bottom"sv, box_model.padding.bottom));
|
||||
MUST(serializer.add("padding_left"sv, box_model.padding.left));
|
||||
MUST(serializer.add("margin_top"sv, box_model.margin.top));
|
||||
MUST(serializer.add("margin_right"sv, box_model.margin.right));
|
||||
MUST(serializer.add("margin_bottom"sv, box_model.margin.bottom));
|
||||
MUST(serializer.add("margin_left"sv, box_model.margin.left));
|
||||
MUST(serializer.add("border_top"sv, box_model.border.top));
|
||||
MUST(serializer.add("border_right"sv, box_model.border.right));
|
||||
MUST(serializer.add("border_bottom"sv, box_model.border.bottom));
|
||||
MUST(serializer.add("border_left"sv, box_model.border.left));
|
||||
if (auto* paint_box = box->paint_box()) {
|
||||
MUST(serializer.add("content_width", paint_box->content_width()));
|
||||
MUST(serializer.add("content_height", paint_box->content_height()));
|
||||
MUST(serializer.add("content_width"sv, paint_box->content_width()));
|
||||
MUST(serializer.add("content_height"sv, paint_box->content_height()));
|
||||
} else {
|
||||
MUST(serializer.add("content_width", 0));
|
||||
MUST(serializer.add("content_height", 0));
|
||||
MUST(serializer.add("content_width"sv, 0));
|
||||
MUST(serializer.add("content_height"sv, 0));
|
||||
}
|
||||
|
||||
MUST(serializer.finish());
|
||||
|
|
|
@ -50,7 +50,7 @@ void WebContentConsoleClient::handle_input(String const& js_source)
|
|||
StringBuilder output_html;
|
||||
|
||||
if (result.is_abrupt()) {
|
||||
output_html.append("Uncaught exception: ");
|
||||
output_html.append("Uncaught exception: "sv);
|
||||
auto error = *result.release_error().value();
|
||||
if (error.is_object())
|
||||
output_html.append(JS::MarkupGenerator::html_from_error(error.as_object()));
|
||||
|
@ -111,19 +111,19 @@ void WebContentConsoleClient::send_messages(i32 start_index)
|
|||
auto& message = m_message_log[i];
|
||||
switch (message.type) {
|
||||
case ConsoleOutput::Type::HTML:
|
||||
message_types.append("html");
|
||||
message_types.append("html"sv);
|
||||
break;
|
||||
case ConsoleOutput::Type::Clear:
|
||||
message_types.append("clear");
|
||||
message_types.append("clear"sv);
|
||||
break;
|
||||
case ConsoleOutput::Type::BeginGroup:
|
||||
message_types.append("group");
|
||||
message_types.append("group"sv);
|
||||
break;
|
||||
case ConsoleOutput::Type::BeginGroupCollapsed:
|
||||
message_types.append("groupCollapsed");
|
||||
message_types.append("groupCollapsed"sv);
|
||||
break;
|
||||
case ConsoleOutput::Type::EndGroup:
|
||||
message_types.append("groupEnd");
|
||||
message_types.append("groupEnd"sv);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -147,10 +147,10 @@ JS::ThrowCompletionOr<JS::Value> WebContentConsoleClient::printer(JS::Console::L
|
|||
if (!trace.label.is_empty())
|
||||
html.appendff("<span class='title'>{}</span><br>", escape_html_entities(trace.label));
|
||||
|
||||
html.append("<span class='trace'>");
|
||||
html.append("<span class='trace'>"sv);
|
||||
for (auto& function_name : trace.stack)
|
||||
html.appendff("-> {}<br>", escape_html_entities(function_name));
|
||||
html.append("</span>");
|
||||
html.append("</span>"sv);
|
||||
|
||||
print_html(html.string_view());
|
||||
return JS::js_undefined();
|
||||
|
@ -162,34 +162,34 @@ JS::ThrowCompletionOr<JS::Value> WebContentConsoleClient::printer(JS::Console::L
|
|||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
auto output = String::join(" ", arguments.get<JS::MarkedVector<JS::Value>>());
|
||||
auto output = String::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
|
||||
m_console.output_debug_message(log_level, output);
|
||||
|
||||
StringBuilder html;
|
||||
switch (log_level) {
|
||||
case JS::Console::LogLevel::Debug:
|
||||
html.append("<span class=\"debug\">(d) ");
|
||||
html.append("<span class=\"debug\">(d) "sv);
|
||||
break;
|
||||
case JS::Console::LogLevel::Error:
|
||||
html.append("<span class=\"error\">(e) ");
|
||||
html.append("<span class=\"error\">(e) "sv);
|
||||
break;
|
||||
case JS::Console::LogLevel::Info:
|
||||
html.append("<span class=\"info\">(i) ");
|
||||
html.append("<span class=\"info\">(i) "sv);
|
||||
break;
|
||||
case JS::Console::LogLevel::Log:
|
||||
html.append("<span class=\"log\"> ");
|
||||
html.append("<span class=\"log\"> "sv);
|
||||
break;
|
||||
case JS::Console::LogLevel::Warn:
|
||||
case JS::Console::LogLevel::CountReset:
|
||||
html.append("<span class=\"warn\">(w) ");
|
||||
html.append("<span class=\"warn\">(w) "sv);
|
||||
break;
|
||||
default:
|
||||
html.append("<span>");
|
||||
html.append("<span>"sv);
|
||||
break;
|
||||
}
|
||||
|
||||
html.append(escape_html_entities(output));
|
||||
html.append("</span>");
|
||||
html.append("</span>"sv);
|
||||
print_html(html.string_view());
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue