mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 05:08:56 +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:
@@ -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 {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user