summaryrefslogtreecommitdiff
path: root/Userland/Applications/Browser
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-07-11 17:32:29 +0000
committerAndreas Kling <kling@serenityos.org>2022-07-12 23:11:35 +0200
commit3f3f45580ab7266258e97cb3cecf1e24716d61c5 (patch)
tree152c7a187c98184d58bf91a326357e0af435edcf /Userland/Applications/Browser
parente5f09ea1703bacfbb79a4ad3c587a7d5d3d7bb13 (diff)
downloadserenity-3f3f45580ab7266258e97cb3cecf1e24716d61c5.zip
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.
Diffstat (limited to 'Userland/Applications/Browser')
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp52
-rw-r--r--Userland/Applications/Browser/ConsoleWidget.cpp22
-rw-r--r--Userland/Applications/Browser/CookieJar.cpp8
-rw-r--r--Userland/Applications/Browser/DownloadWidget.cpp16
-rw-r--r--Userland/Applications/Browser/ElementSizePreviewWidget.cpp6
-rw-r--r--Userland/Applications/Browser/IconBag.cpp48
-rw-r--r--Userland/Applications/Browser/InspectorWidget.cpp38
-rw-r--r--Userland/Applications/Browser/StorageWidget.cpp6
-rw-r--r--Userland/Applications/Browser/Tab.cpp14
-rw-r--r--Userland/Applications/Browser/WindowActions.cpp2
-rw-r--r--Userland/Applications/Browser/main.cpp16
11 files changed, 114 insertions, 114 deletions
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp
index bc2b96ca28..0753f44177 100644
--- a/Userland/Applications/Browser/BrowserWindow.cpp
+++ b/Userland/Applications/Browser/BrowserWindow.cpp
@@ -45,7 +45,7 @@ static String bookmarks_file_path()
{
StringBuilder builder;
builder.append(Core::StandardPaths::config_directory());
- builder.append("/bookmarks.json");
+ builder.append("/bookmarks.json"sv);
return builder.to_string();
}
@@ -53,7 +53,7 @@ static String search_engines_file_path()
{
StringBuilder builder;
builder.append(Core::StandardPaths::config_directory());
- builder.append("/SearchEngines.json");
+ builder.append("/SearchEngines.json"sv);
return builder.to_string();
}
@@ -61,7 +61,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
: m_cookie_jar(cookie_jar)
, m_window_actions(*this)
{
- auto app_icon = GUI::Icon::default_icon("app-browser");
+ auto app_icon = GUI::Icon::default_icon("app-browser"sv);
m_bookmarks_bar = Browser::BookmarksBarWidget::construct(Browser::bookmarks_file_path(), true);
resize(730, 560);
@@ -123,25 +123,25 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
});
m_window_actions.on_about = [this] {
- auto app_icon = GUI::Icon::default_icon("app-browser");
- GUI::AboutDialog::show("Browser", app_icon.bitmap_for_size(32), this);
+ auto app_icon = GUI::Icon::default_icon("app-browser"sv);
+ GUI::AboutDialog::show("Browser"sv, app_icon.bitmap_for_size(32), this);
};
m_window_actions.on_show_bookmarks_bar = [](auto& action) {
Browser::BookmarksBarWidget::the().set_visible(action.is_checked());
- Config::write_bool("Browser", "Preferences", "ShowBookmarksBar", action.is_checked());
+ Config::write_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, action.is_checked());
};
- bool show_bookmarks_bar = Config::read_bool("Browser", "Preferences", "ShowBookmarksBar", true);
+ bool show_bookmarks_bar = Config::read_bool("Browser"sv, "Preferences"sv, "ShowBookmarksBar"sv, true);
m_window_actions.show_bookmarks_bar_action().set_checked(show_bookmarks_bar);
Browser::BookmarksBarWidget::the().set_visible(show_bookmarks_bar);
m_window_actions.on_vertical_tabs = [this](auto& action) {
m_tab_widget->set_tab_position(action.is_checked() ? GUI::TabWidget::TabPosition::Left : GUI::TabWidget::TabPosition::Top);
- Config::write_bool("Browser", "Preferences", "VerticalTabs", action.is_checked());
+ Config::write_bool("Browser"sv, "Preferences"sv, "VerticalTabs"sv, action.is_checked());
};
- bool vertical_tabs = Config::read_bool("Browser", "Preferences", "VerticalTabs", false);
+ bool vertical_tabs = Config::read_bool("Browser"sv, "Preferences"sv, "VerticalTabs"sv, false);
m_window_actions.vertical_tabs_action().set_checked(vertical_tabs);
m_tab_widget->set_tab_position(vertical_tabs ? GUI::TabWidget::TabPosition::Left : GUI::TabWidget::TabPosition::Top);
@@ -258,13 +258,13 @@ void BrowserWindow::build_menus()
m_change_homepage_action = GUI::Action::create(
"Set Homepage URL...", g_icon_bag.go_home, [this](auto&) {
- auto homepage_url = Config::read_string("Browser", "Preferences", "Home", "about:blank");
- if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecResult::OK) {
+ auto homepage_url = Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, "about:blank"sv);
+ if (GUI::InputBox::show(this, homepage_url, "Enter URL"sv, "Change homepage URL"sv) == GUI::InputBox::ExecResult::OK) {
if (URL(homepage_url).is_valid()) {
- Config::write_string("Browser", "Preferences", "Home", homepage_url);
+ Config::write_string("Browser"sv, "Preferences"sv, "Home"sv, homepage_url);
Browser::g_home_url = homepage_url;
} else {
- GUI::MessageBox::show_error(this, "The URL you have entered is not valid");
+ GUI::MessageBox::show_error(this, "The URL you have entered is not valid"sv);
}
}
},
@@ -280,13 +280,13 @@ void BrowserWindow::build_menus()
auto& color_scheme_menu = settings_menu.add_submenu("&Color Scheme");
color_scheme_menu.set_icon(g_icon_bag.color_chooser);
{
- auto current_setting = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser", "Preferences", "ColorScheme", "auto"));
+ auto current_setting = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, "auto"sv));
m_color_scheme_actions.set_exclusive(true);
auto add_color_scheme_action = [&](auto& name, Web::CSS::PreferredColorScheme preference_value) {
auto action = GUI::Action::create_checkable(
name, [=, this](auto&) {
- Config::write_string("Browser", "Preferences", "ColorScheme", Web::CSS::preferred_color_scheme_to_string(preference_value));
+ Config::write_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, Web::CSS::preferred_color_scheme_to_string(preference_value));
active_tab().view().set_preferred_color_scheme(preference_value);
},
this);
@@ -302,9 +302,9 @@ void BrowserWindow::build_menus()
}
settings_menu.add_separator();
- auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value_but_fixme_should_propagate_errors(),
+ auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png"sv).release_value_but_fixme_should_propagate_errors(),
[this](auto&) {
- GUI::Process::spawn_or_show_error(this, "/bin/BrowserSettings");
+ GUI::Process::spawn_or_show_error(this, "/bin/BrowserSettings"sv);
});
settings_menu.add_action(move(open_settings_action));
@@ -385,7 +385,7 @@ void BrowserWindow::build_menus()
auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) {
String user_agent;
- if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) {
+ if (GUI::InputBox::show(this, user_agent, "Enter User Agent:"sv, "Custom User Agent"sv) != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) {
m_disable_user_agent_spoofing->activate();
return;
}
@@ -426,7 +426,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
m_disable_search_engine_action = GUI::Action::create_checkable(
"Disable", [](auto&) {
g_search_engine = {};
- Config::write_string("Browser", "Preferences", "SearchEngine", g_search_engine);
+ Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine);
},
this);
search_engine_menu.add_action(*m_disable_search_engine_action);
@@ -444,13 +444,13 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
if (!json_item.is_object())
continue;
auto search_engine = json_item.as_object();
- auto name = search_engine.get("title").to_string();
- auto url_format = search_engine.get("url_format").to_string();
+ auto name = search_engine.get("title"sv).to_string();
+ auto url_format = search_engine.get("url_format"sv).to_string();
auto action = GUI::Action::create_checkable(
name, [&, url_format](auto&) {
g_search_engine = url_format;
- Config::write_string("Browser", "Preferences", "SearchEngine", g_search_engine);
+ Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine);
},
this);
search_engine_menu.add_action(action);
@@ -467,20 +467,20 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) {
String search_engine;
- if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) {
+ if (GUI::InputBox::show(this, search_engine, "Enter URL template:"sv, "Custom Search Engine"sv, "https://host/search?q={}"sv) != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) {
m_disable_search_engine_action->activate();
return;
}
auto argument_count = search_engine.count("{}"sv);
if (argument_count != 1) {
- GUI::MessageBox::show(this, "Invalid format, must contain '{}' once!", "Error", GUI::MessageBox::Type::Error);
+ GUI::MessageBox::show(this, "Invalid format, must contain '{}' once!"sv, "Error"sv, GUI::MessageBox::Type::Error);
m_disable_search_engine_action->activate();
return;
}
g_search_engine = search_engine;
- Config::write_string("Browser", "Preferences", "SearchEngine", g_search_engine);
+ Config::write_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, g_search_engine);
action.set_status_tip(search_engine);
});
search_engine_menu.add_action(custom_search_engine_action);
@@ -608,7 +608,7 @@ void BrowserWindow::config_string_did_change(String const& domain, String const&
Browser::g_home_url = value;
else if (key == "NewTab")
Browser::g_new_tab_url = value;
- } else if (group.starts_with("Proxy:")) {
+ } else if (group.starts_with("Proxy:"sv)) {
dbgln("Proxy mapping changed: {}/{} = {}", group, key, value);
auto proxy_spec = group.substring_view(6);
auto existing_proxy = Browser::g_proxies.find(proxy_spec);
diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp
index 3603e856bb..392c4d6f61 100644
--- a/Userland/Applications/Browser/ConsoleWidget.cpp
+++ b/Userland/Applications/Browser/ConsoleWidget.cpp
@@ -25,7 +25,7 @@ ConsoleWidget::ConsoleWidget()
set_fill_with_background_color(true);
m_output_view = add<WebView::OutOfProcessWebView>();
- m_output_view->load("data:text/html,<html></html>");
+ m_output_view->load("data:text/html,<html></html>"sv);
// Wait until our output WebView is loaded, and then request any messages that occurred before we existed
m_output_view->on_load_finish = [this](auto&) {
if (on_request_messages)
@@ -130,9 +130,9 @@ void ConsoleWidget::handle_console_messages(i32 start_index, Vector<String> cons
void ConsoleWidget::print_source_line(StringView source)
{
StringBuilder html;
- html.append("<span class=\"repl-indicator\">");
- html.append("&gt; ");
- html.append("</span>");
+ html.append("<span class=\"repl-indicator\">"sv);
+ html.append("&gt; "sv);
+ html.append("</span>"sv);
html.append(JS::MarkupGenerator::html_from_source(source));
@@ -147,7 +147,7 @@ void ConsoleWidget::print_html(StringView line)
if (parent_id == 0) {
builder.append(R"~~~(
var parentGroup = document.body;
-)~~~");
+)~~~"sv);
} else {
builder.appendff(R"~~~(
var parentGroup = document.getElementById("group_{}");
@@ -157,11 +157,11 @@ void ConsoleWidget::print_html(StringView line)
builder.append(R"~~~(
var p = document.createElement("p");
- p.innerHTML = ")~~~");
+ p.innerHTML = ")~~~"sv);
builder.append_escaped_for_json(line);
builder.append(R"~~~("
parentGroup.appendChild(p);
-)~~~");
+)~~~"sv);
m_output_view->run_javascript(builder.string_view());
// FIXME: Make it scroll to the bottom, using `window.scrollTo()` in the JS above.
// We used to call `m_output_view->scroll_to_bottom();` here, but that does not work because
@@ -174,7 +174,7 @@ void ConsoleWidget::clear_output()
m_group_stack.clear();
m_output_view->run_javascript(R"~~~(
document.body.innerHTML = "";
- )~~~");
+ )~~~"sv);
}
void ConsoleWidget::begin_group(StringView label, bool start_expanded)
@@ -184,7 +184,7 @@ void ConsoleWidget::begin_group(StringView label, bool start_expanded)
if (parent_id == 0) {
builder.append(R"~~~(
var parentGroup = document.body;
-)~~~");
+)~~~"sv);
} else {
builder.appendff(R"~~~(
var parentGroup = document.getElementById("group_{}");
@@ -206,10 +206,10 @@ void ConsoleWidget::begin_group(StringView label, bool start_expanded)
builder.append(R"~~~(";
group.appendChild(label);
parentGroup.appendChild(group);
-)~~~");
+)~~~"sv);
if (start_expanded)
- builder.append("group.open = true;");
+ builder.append("group.open = true;"sv);
m_output_view->run_javascript(builder.string_view());
// FIXME: Scroll console to bottom - see note in print_html()
diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp
index d8be5e30e6..fb97ad2e81 100644
--- a/Userland/Applications/Browser/CookieJar.cpp
+++ b/Userland/Applications/Browser/CookieJar.cpp
@@ -29,7 +29,7 @@ String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
for (auto const& cookie : cookie_list) {
// If there is an unprocessed cookie in the cookie-list, output the characters %x3B and %x20 ("; ")
if (!builder.is_empty())
- builder.append("; ");
+ builder.append("; "sv);
// Output the cookie's name, the %x3D ("=") character, and the cookie's value.
builder.appendff("{}={}", cookie.name, cookie.value);
@@ -50,9 +50,9 @@ void CookieJar::set_cookie(const URL& url, Web::Cookie::ParsedCookie const& pars
void CookieJar::dump_cookies() const
{
- constexpr StringView key_color = "\033[34;1m";
- constexpr StringView attribute_color = "\033[33m";
- constexpr StringView no_color = "\033[0m";
+ constexpr auto key_color = "\033[34;1m"sv;
+ constexpr auto attribute_color = "\033[33m"sv;
+ constexpr auto no_color = "\033[0m"sv;
StringBuilder builder;
builder.appendff("{} cookies stored\n", m_cookies.size());
diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp
index cfc6df68dd..50dfe3932b 100644
--- a/Userland/Applications/Browser/DownloadWidget.cpp
+++ b/Userland/Applications/Browser/DownloadWidget.cpp
@@ -37,7 +37,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_destination_path = builder.to_string();
}
- auto close_on_finish = Config::read_bool("Browser", "Preferences", "CloseDownloadWidgetOnFinish", false);
+ auto close_on_finish = Config::read_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, false);
m_elapsed_timer.start();
m_download = Web::ResourceLoader::the().connector().start_request("GET", url);
@@ -49,7 +49,7 @@ DownloadWidget::DownloadWidget(const URL& url)
{
auto file_or_error = Core::Stream::File::open(m_destination_path, Core::Stream::OpenMode::Write);
if (file_or_error.is_error()) {
- GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed", GUI::MessageBox::Type::Error);
+ GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error);
window()->close();
return;
}
@@ -68,7 +68,7 @@ DownloadWidget::DownloadWidget(const URL& url)
auto& animation_layout = animation_container.set_layout<GUI::HorizontalBoxLayout>();
m_browser_image = animation_container.add<GUI::ImageWidget>();
- m_browser_image->load_from_file("/res/graphics/download-animation.gif");
+ m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv);
animation_layout.add_spacer();
auto& source_label = add<GUI::Label>(String::formatted("From: {}", url));
@@ -90,7 +90,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_close_on_finish_checkbox->set_checked(close_on_finish);
m_close_on_finish_checkbox->on_checked = [&](bool checked) {
- Config::write_bool("Browser", "Preferences", "CloseDownloadWidgetOnFinish", checked);
+ Config::write_bool("Browser"sv, "Preferences"sv, "CloseDownloadWidgetOnFinish"sv, checked);
};
auto& button_container = add<GUI::Widget>();
@@ -126,7 +126,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
{
StringBuilder builder;
- builder.append("Downloaded ");
+ builder.append("Downloaded "sv);
builder.append(human_readable_size(downloaded_size));
builder.appendff(" in {} sec", m_elapsed_timer.elapsed() / 1000);
m_progress_label->set_text(builder.to_string());
@@ -140,7 +140,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
} else {
builder.append(human_readable_size(downloaded_size));
}
- builder.append(" of ");
+ builder.append(" of "sv);
builder.append(m_url.basename());
window()->set_title(builder.to_string());
}
@@ -150,7 +150,7 @@ void DownloadWidget::did_finish(bool success)
{
dbgln("did_finish, success={}", success);
- m_browser_image->load_from_file("/res/graphics/download-finished.gif");
+ m_browser_image->load_from_file("/res/graphics/download-finished.gif"sv);
window()->set_title("Download finished!");
m_close_button->set_enabled(true);
m_cancel_button->set_text("Open in Folder");
@@ -161,7 +161,7 @@ void DownloadWidget::did_finish(bool success)
m_cancel_button->update();
if (!success) {
- GUI::MessageBox::show(window(), String::formatted("Download failed for some reason"), "Download failed", GUI::MessageBox::Type::Error);
+ GUI::MessageBox::show(window(), String::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error);
window()->close();
return;
}
diff --git a/Userland/Applications/Browser/ElementSizePreviewWidget.cpp b/Userland/Applications/Browser/ElementSizePreviewWidget.cpp
index a60f37a472..0ee3e8aef6 100644
--- a/Userland/Applications/Browser/ElementSizePreviewWidget.cpp
+++ b/Userland/Applications/Browser/ElementSizePreviewWidget.cpp
@@ -83,7 +83,7 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event)
draw_borders(margin_rect, Color::Black);
margin_rect.shrink(1, 1, 1, 1);
margin_rect.shrink(text_height_padding, text_width_padding, text_height_padding, text_width_padding);
- painter.draw_text(margin_rect, "margin", font(), Gfx::TextAlignment::TopLeft, Color::Black);
+ painter.draw_text(margin_rect, "margin"sv, font(), Gfx::TextAlignment::TopLeft, Color::Black);
draw_size_texts(margin_rect, Color::Black, m_node_box_sizing.margin);
// paint border box
@@ -91,7 +91,7 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event)
draw_borders(border_rect, Color::Black);
border_rect.shrink(1, 1, 1, 1);
border_rect.shrink(text_height_padding, text_width_padding, text_height_padding, text_width_padding);
- painter.draw_text(border_rect, "border", font(), Gfx::TextAlignment::TopLeft, Color::Black);
+ painter.draw_text(border_rect, "border"sv, font(), Gfx::TextAlignment::TopLeft, Color::Black);
draw_size_texts(border_rect, Color::Black, m_node_box_sizing.border);
// paint padding box
@@ -99,7 +99,7 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event)
draw_borders(padding_rect, Color::Black);
padding_rect.shrink(1, 1, 1, 1);
padding_rect.shrink(text_height_padding, text_width_padding, text_height_padding, text_width_padding);
- painter.draw_text(padding_rect, "padding", font(), Gfx::TextAlignment::TopLeft, Color::Black);
+ painter.draw_text(padding_rect, "padding"sv, font(), Gfx::TextAlignment::TopLeft, Color::Black);
draw_size_texts(padding_rect, Color::Black, m_node_box_sizing.padding);
// paint content box
diff --git a/Userland/Applications/Browser/IconBag.cpp b/Userland/Applications/Browser/IconBag.cpp
index de7abafd4e..05e738a9b6 100644
--- a/Userland/Applications/Browser/IconBag.cpp
+++ b/Userland/Applications/Browser/IconBag.cpp
@@ -12,30 +12,30 @@ ErrorOr<IconBag> IconBag::try_create()
{
IconBag icon_bag;
- icon_bag.filetype_html = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"));
- icon_bag.filetype_text = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png"));
- icon_bag.filetype_javascript = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png"));
- icon_bag.bookmark_contour = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png"));
- icon_bag.bookmark_filled = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png"));
- icon_bag.inspector_object = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
- icon_bag.go_home = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png"));
- icon_bag.find = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"));
- icon_bag.color_chooser = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"));
- icon_bag.delete_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"));
- icon_bag.new_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"));
- icon_bag.duplicate_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/duplicate-tab.png"));
- icon_bag.code = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/code.png"));
- icon_bag.dom_tree = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/dom-tree.png"));
- icon_bag.layout = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"));
- icon_bag.layers = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layers.png"));
- icon_bag.filetype_css = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-css.png"));
- icon_bag.inspect = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspect.png"));
- icon_bag.history = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/history.png"));
- icon_bag.cookie = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/cookie.png"));
- icon_bag.local_storage = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/local-storage.png"));
- icon_bag.trash_can = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/trash-can.png"));
- icon_bag.clear_cache = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/clear-cache.png"));
- icon_bag.spoof = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/spoof.png"));
+ icon_bag.filetype_html = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"sv));
+ icon_bag.filetype_text = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png"sv));
+ icon_bag.filetype_javascript = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png"sv));
+ icon_bag.bookmark_contour = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png"sv));
+ icon_bag.bookmark_filled = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png"sv));
+ icon_bag.inspector_object = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv));
+ icon_bag.go_home = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png"sv));
+ icon_bag.find = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv));
+ icon_bag.color_chooser = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"sv));
+ icon_bag.delete_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv));
+ icon_bag.new_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv));
+ icon_bag.duplicate_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/duplicate-tab.png"sv));
+ icon_bag.code = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/code.png"sv));
+ icon_bag.dom_tree = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/dom-tree.png"sv));
+ icon_bag.layout = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"sv));
+ icon_bag.layers = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layers.png"sv));
+ icon_bag.filetype_css = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-css.png"sv));
+ icon_bag.inspect = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspect.png"sv));
+ icon_bag.history = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/history.png"sv));
+ icon_bag.cookie = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/cookie.png"sv));
+ icon_bag.local_storage = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/local-storage.png"sv));
+ icon_bag.trash_can = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/trash-can.png"sv));
+ icon_bag.clear_cache = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/clear-cache.png"sv));
+ icon_bag.spoof = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/spoof.png"sv));
return icon_bag;
}
diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp
index 4342160812..56f9fde607 100644
--- a/Userland/Applications/Browser/InspectorWidget.cpp
+++ b/Userland/Applications/Browser/InspectorWidget.cpp
@@ -50,11 +50,11 @@ void InspectorWidget::set_selection(GUI::ModelIndex const index)
VERIFY(json);
Selection selection {};
- if (json->has_u32("pseudo-element")) {
- selection.dom_node_id = json->get("parent-id").to_i32();
- selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get("pseudo-element").to_u32());
+ if (json->has_u32("pseudo-element"sv)) {
+ selection.dom_node_id = json->get("parent-id"sv).to_i32();
+ selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get("pseudo-element"sv).to_u32());
} else {
- selection.dom_node_id = json->get("id").to_i32();
+ selection.dom_node_id = json->get("id"sv).to_i32();
}
if (selection == m_selection)
@@ -186,21 +186,21 @@ void InspectorWidget::update_node_box_model(Optional<String> node_box_sizing_jso
auto json_value = json_or_error.release_value();
auto const& json_object = json_value.as_object();
- m_node_box_sizing.margin.top = json_object.get("margin_top").to_float();
- m_node_box_sizing.margin.right = json_object.get("margin_right").to_float();
- m_node_box_sizing.margin.bottom = json_object.get("margin_bottom").to_float();
- m_node_box_sizing.margin.left = json_object.get("margin_left").to_float();
- m_node_box_sizing.padding.top = json_object.get("padding_top").to_float();
- m_node_box_sizing.padding.right = json_object.get("padding_right").to_float();
- m_node_box_sizing.padding.bottom = json_object.get("padding_bottom").to_float();
- m_node_box_sizing.padding.left = json_object.get("padding_left").to_float();
- m_node_box_sizing.border.top = json_object.get("border_top").to_float();
- m_node_box_sizing.border.right = json_object.get("border_right").to_float();
- m_node_box_sizing.border.bottom = json_object.get("border_bottom").to_float();
- m_node_box_sizing.border.left = json_object.get("border_left").to_float();
-
- m_element_size_view->set_node_content_width(json_object.get("content_width").to_float());
- m_element_size_view->set_node_content_height(json_object.get("content_height").to_float());
+ m_node_box_sizing.margin.top = json_object.get("margin_top"sv).to_float();
+ m_node_box_sizing.margin.right = json_object.get("margin_right"sv).to_float();
+ m_node_box_sizing.margin.bottom = json_object.get("margin_bottom"sv).to_float();
+ m_node_box_sizing.margin.left = json_object.get("margin_left"sv).to_float();
+ m_node_box_sizing.padding.top = json_object.get("padding_top"sv).to_float();
+ m_node_box_sizing.padding.right = json_object.get("padding_right"sv).to_float();
+ m_node_box_sizing.padding.bottom = json_object.get("padding_bottom"sv).to_float();
+ m_node_box_sizing.padding.left = json_object.get("padding_left"sv).to_float();
+ m_node_box_sizing.border.top = json_object.get("border_top"sv).to_float();
+ m_node_box_sizing.border.right = json_object.get("border_right"sv).to_float();
+ m_node_box_sizing.border.bottom = json_object.get("border_bottom"sv).to_float();
+ m_node_box_sizing.border.left = json_object.get("border_left"sv).to_float();
+
+ m_element_size_view->set_node_content_width(json_object.get("content_width"sv).to_float());
+ m_element_size_view->set_node_content_height(json_object.get("content_height"sv).to_float());
m_element_size_view->set_box_model(m_node_box_sizing);
}
diff --git a/Userland/Applications/Browser/StorageWidget.cpp b/Userland/Applications/Browser/StorageWidget.cpp
index 56991ba06d..bc45b55b74 100644
--- a/Userland/Applications/Browser/StorageWidget.cpp
+++ b/Userland/Applications/Browser/StorageWidget.cpp
@@ -25,7 +25,7 @@ StorageWidget::StorageWidget()
m_cookies_model = adopt_ref(*new CookiesModel());
m_cookies_filtering_model = MUST(GUI::FilteringProxyModel::create(*m_cookies_model));
- m_cookies_filtering_model->set_filter_term("");
+ m_cookies_filtering_model->set_filter_term(""sv);
m_cookies_textbox->on_change = [this] {
m_cookies_filtering_model->set_filter_term(m_cookies_textbox->text());
@@ -42,7 +42,7 @@ StorageWidget::StorageWidget()
m_local_storage_model = adopt_ref(*new StorageModel());
m_local_storage_filtering_model = MUST(GUI::FilteringProxyModel::create(*m_local_storage_model));
- m_local_storage_filtering_model->set_filter_term("");
+ m_local_storage_filtering_model->set_filter_term(""sv);
m_local_storage_textbox->on_change = [this] {
m_local_storage_filtering_model->set_filter_term(m_local_storage_textbox->text());
@@ -59,7 +59,7 @@ StorageWidget::StorageWidget()
m_session_storage_model = adopt_ref(*new StorageModel());
m_session_storage_filtering_model = MUST(GUI::FilteringProxyModel::create(*m_session_storage_model));
- m_session_storage_filtering_model->set_filter_term("");
+ m_session_storage_filtering_model->set_filter_term(""sv);
m_session_storage_textbox->on_change = [this] {
m_session_storage_filtering_model->set_filter_term(m_session_storage_textbox->text());
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp
index e6eb96325b..aa04c63002 100644
--- a/Userland/Applications/Browser/Tab.cpp
+++ b/Userland/Applications/Browser/Tab.cpp
@@ -42,8 +42,8 @@ namespace Browser {
URL url_from_user_input(String const& input)
{
- if (input.starts_with("?") && !g_search_engine.is_empty())
- return URL(g_search_engine.replace("{}", URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly));
+ if (input.starts_with('?') && !g_search_engine.is_empty())
+ return URL(g_search_engine.replace("{}"sv, URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly));
URL url_with_http_schema = URL(String::formatted("http://{}", input));
if (url_with_http_schema.is_valid() && url_with_http_schema.port().has_value())
@@ -150,7 +150,7 @@ Tab::Tab(BrowserWindow& window)
toolbar.add_action(window.reload_action());
m_location_box = toolbar.add<GUI::UrlBox>();
- m_location_box->set_placeholder("Address");
+ m_location_box->set_placeholder("Address"sv);
m_location_box->on_return_pressed = [this] {
auto url = url_from_location_bar();
@@ -166,7 +166,7 @@ Tab::Tab(BrowserWindow& window)
m_location_box->add_custom_context_menu_action(GUI::Action::create("Paste && Go", [this](auto&) {
auto [data, mime_type, _] = GUI::Clipboard::the().fetch_data_and_type();
- if (!mime_type.starts_with("text/"))
+ if (!mime_type.starts_with("text/"sv))
return;
auto const& paste_text = data;
if (paste_text.is_empty())
@@ -400,7 +400,7 @@ Tab::Tab(BrowserWindow& window)
Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
{
if (m_location_box->text().starts_with('?') && g_search_engine.is_empty()) {
- GUI::MessageBox::show(&this->window(), "Select a search engine in the Settings menu before searching.", "No search engine selected", GUI::MessageBox::Type::Information);
+ GUI::MessageBox::show(&this->window(), "Select a search engine in the Settings menu before searching."sv, "No search engine selected"sv, GUI::MessageBox::Type::Information);
return {};
}
@@ -410,8 +410,8 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
builder.append(text);
if (may_append_tld == MayAppendTLD::Yes) {
// FIXME: Expand the list of top level domains.
- if (!(text.ends_with(".com") || text.ends_with(".net") || text.ends_with(".org"))) {
- builder.append(".com");
+ if (!(text.ends_with(".com"sv) || text.ends_with(".net"sv) || text.ends_with(".org"sv))) {
+ builder.append(".com"sv);
}
}
String final_text = builder.to_string();
diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp
index 0af7bfedee..68a22afc89 100644
--- a/Userland/Applications/Browser/WindowActions.cpp
+++ b/Userland/Applications/Browser/WindowActions.cpp
@@ -66,7 +66,7 @@ WindowActions::WindowActions(GUI::Window& window)
m_tab_actions.last().set_status_tip("Switch to last tab");
m_about_action = GUI::Action::create(
- "&About Browser", GUI::Icon::default_icon("app-browser").bitmap_for_size(16), [this](const GUI::Action&) {
+ "&About Browser", GUI::Icon::default_icon("app-browser"sv).bitmap_for_size(16), [this](const GUI::Action&) {
if (on_about)
on_about();
},
diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp
index 1c1f22ecc0..04a7ea4613 100644
--- a/Userland/Applications/Browser/main.cpp
+++ b/Userland/Applications/Browser/main.cpp
@@ -93,22 +93,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create()));
- auto app_icon = GUI::Icon::default_icon("app-browser");
+ auto app_icon = GUI::Icon::default_icon("app-browser"sv);
- Browser::g_home_url = Config::read_string("Browser", "Preferences", "Home", "file:///res/html/misc/welcome.html");
- Browser::g_new_tab_url = Config::read_string("Browser", "Preferences", "NewTab", "file:///res/html/misc/new-tab.html");
- Browser::g_search_engine = Config::read_string("Browser", "Preferences", "SearchEngine", {});
- Browser::g_content_filters_enabled = Config::read_bool("Browser", "Preferences", "EnableContentFilters", true);
+ Browser::g_home_url = Config::read_string("Browser"sv, "Preferences"sv, "Home"sv, "file:///res/html/misc/welcome.html"sv);
+ Browser::g_new_tab_url = Config::read_string("Browser"sv, "Preferences"sv, "NewTab"sv, "file:///res/html/misc/new-tab.html"sv);
+ Browser::g_search_engine = Config::read_string("Browser"sv, "Preferences"sv, "SearchEngine"sv, {});
+ Browser::g_content_filters_enabled = Config::read_bool("Browser"sv, "Preferences"sv, "EnableContentFilters"sv, true);
Browser::g_icon_bag = TRY(Browser::IconBag::try_create());
TRY(load_content_filters());
- for (auto& group : Config::list_groups("Browser")) {
- if (!group.starts_with("Proxy:"))
+ for (auto& group : Config::list_groups("Browser"sv)) {
+ if (!group.starts_with("Proxy:"sv))
continue;
- for (auto& key : Config::list_keys("Browser", group)) {
+ for (auto& key : Config::list_keys("Browser"sv, group)) {
auto proxy_spec = group.substring_view(6);
auto existing_proxy = Browser::g_proxies.find(proxy_spec);
if (existing_proxy.is_end())