1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +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

@ -43,17 +43,17 @@ void OutOfProcessWebView::handle_web_content_process_crash()
handle_resize();
StringBuilder builder;
builder.append("<html><head><title>Crashed: ");
builder.append("<html><head><title>Crashed: "sv);
builder.append(escape_html_entities(m_url.to_string()));
builder.append("</title></head><body>");
builder.append("<h1>Web page crashed");
builder.append("</title></head><body>"sv);
builder.append("<h1>Web page crashed"sv);
if (!m_url.host().is_empty()) {
builder.appendff(" on {}", escape_html_entities(m_url.host()));
}
builder.append("</h1>");
builder.append("</h1>"sv);
auto escaped_url = escape_html_entities(m_url.to_string());
builder.appendff("The web page <a href=\"{}\">{}</a> has crashed.<br><br>You can reload the page to try again.", escaped_url, escaped_url);
builder.append("</body></html>");
builder.append("</body></html>"sv);
load_html(builder.to_string(), m_url);
}
@ -329,19 +329,19 @@ void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<Web
void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient>, String const& message)
{
GUI::MessageBox::show(window(), message, "Alert", GUI::MessageBox::Type::Information);
GUI::MessageBox::show(window(), message, "Alert"sv, GUI::MessageBox::Type::Information);
}
bool OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, String const& message)
{
auto confirm_result = GUI::MessageBox::show(window(), message, "Confirm", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel);
auto confirm_result = GUI::MessageBox::show(window(), message, "Confirm"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel);
return confirm_result == GUI::Dialog::ExecResult::OK;
}
String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_)
{
String response { default_ };
if (GUI::InputBox::show(window(), response, message, "Prompt") == GUI::InputBox::ExecResult::OK)
if (GUI::InputBox::show(window(), response, message, "Prompt"sv) == GUI::InputBox::ExecResult::OK)
return response;
return {};
}