1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 01:17:46 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -100,7 +100,7 @@ BookmarksBarWidget& BookmarksBarWidget::the()
return *s_the;
}
BookmarksBarWidget::BookmarksBarWidget(const String& bookmarks_file, bool enabled)
BookmarksBarWidget::BookmarksBarWidget(String const& bookmarks_file, bool enabled)
{
s_the = this;
set_layout<GUI::HorizontalBoxLayout>();
@ -255,7 +255,7 @@ void BookmarksBarWidget::update_content_size()
}
}
bool BookmarksBarWidget::contains_bookmark(const String& url)
bool BookmarksBarWidget::contains_bookmark(String const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
@ -268,7 +268,7 @@ bool BookmarksBarWidget::contains_bookmark(const String& url)
return false;
}
bool BookmarksBarWidget::remove_bookmark(const String& url)
bool BookmarksBarWidget::remove_bookmark(String const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
@ -277,7 +277,7 @@ bool BookmarksBarWidget::remove_bookmark(const String& url)
if (item_url == url) {
auto& json_model = *static_cast<GUI::JsonArrayModel*>(model());
const auto item_removed = json_model.remove(item_index);
auto const item_removed = json_model.remove(item_index);
if (item_removed)
json_model.store();
@ -288,7 +288,7 @@ bool BookmarksBarWidget::remove_bookmark(const String& url)
return false;
}
bool BookmarksBarWidget::add_bookmark(const String& url, const String& title)
bool BookmarksBarWidget::add_bookmark(String const& url, String const& title)
{
Vector<JsonValue> values;
values.append(title);
@ -302,7 +302,7 @@ bool BookmarksBarWidget::add_bookmark(const String& url, const String& title)
return false;
}
bool BookmarksBarWidget::edit_bookmark(const String& url)
bool BookmarksBarWidget::edit_bookmark(String const& url)
{
for (int item_index = 0; item_index < model()->row_count(); ++item_index) {
auto item_title = model()->index(item_index, 0).data().to_string();

View file

@ -26,16 +26,16 @@ public:
GUI::Model* model() { return m_model.ptr(); }
const GUI::Model* model() const { return m_model.ptr(); }
Function<void(const String& url, unsigned modifiers)> on_bookmark_click;
Function<void(const String&, const String&)> on_bookmark_hover;
Function<void(String const& url, unsigned modifiers)> on_bookmark_click;
Function<void(String const&, String const&)> on_bookmark_hover;
bool contains_bookmark(const String& url);
bool remove_bookmark(const String& url);
bool add_bookmark(const String& url, const String& title);
bool edit_bookmark(const String& url);
bool contains_bookmark(String const& url);
bool remove_bookmark(String const& url);
bool add_bookmark(String const& url, String const& title);
bool edit_bookmark(String const& url);
private:
BookmarksBarWidget(const String&, bool enabled);
BookmarksBarWidget(String const&, bool enabled);
// ^GUI::ModelClient
virtual void model_did_update(unsigned) override;

View file

@ -93,7 +93,7 @@ void ConsoleWidget::notify_about_new_console_message(i32 message_index)
request_console_messages();
}
void ConsoleWidget::handle_console_messages(i32 start_index, const Vector<String>& message_types, const Vector<String>& messages)
void ConsoleWidget::handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)
{
i32 end_index = start_index + message_types.size() - 1;
if (end_index <= m_highest_received_message_index) {

View file

@ -26,7 +26,7 @@ public:
void print_html(StringView);
void reset();
Function<void(const String&)> on_js_input;
Function<void(String const&)> on_js_input;
Function<void(i32)> on_request_messages;
private:

View file

@ -26,7 +26,7 @@ String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
auto cookie_list = get_matching_cookies(url, domain.value(), source);
StringBuilder builder;
for (const auto& cookie : cookie_list) {
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("; ");
@ -38,7 +38,7 @@ String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
return builder.build();
}
void CookieJar::set_cookie(const URL& url, const Web::Cookie::ParsedCookie& parsed_cookie, Web::Cookie::Source source)
void CookieJar::set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source)
{
auto domain = canonicalize_domain(url);
if (!domain.has_value())
@ -57,7 +57,7 @@ void CookieJar::dump_cookies() const
StringBuilder builder;
builder.appendff("{} cookies stored\n", m_cookies.size());
for (const auto& cookie : m_cookies) {
for (auto const& cookie : m_cookies) {
builder.appendff("{}{}{} - ", key_color, cookie.key.name, no_color);
builder.appendff("{}{}{} - ", key_color, cookie.key.domain, no_color);
builder.appendff("{}{}{}\n", key_color, cookie.key.path, no_color);
@ -96,7 +96,7 @@ Optional<String> CookieJar::canonicalize_domain(const URL& url)
return url.host().to_lowercase();
}
bool CookieJar::domain_matches(const String& string, const String& domain_string)
bool CookieJar::domain_matches(String const& string, String const& domain_string)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.3
@ -120,7 +120,7 @@ bool CookieJar::domain_matches(const String& string, const String& domain_string
return true;
}
bool CookieJar::path_matches(const String& request_path, const String& cookie_path)
bool CookieJar::path_matches(String const& request_path, String const& cookie_path)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.4
@ -165,7 +165,7 @@ String CookieJar::default_path(const URL& url)
return uri_path.substring(0, last_separator);
}
void CookieJar::store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source)
void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source)
{
// https://tools.ietf.org/html/rfc6265#section-5.3
@ -251,7 +251,7 @@ void CookieJar::store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, con
m_cookies.set(key, move(cookie));
}
Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source)
Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source)
{
// https://tools.ietf.org/html/rfc6265#section-5.4
@ -305,12 +305,12 @@ void CookieJar::purge_expired_cookies()
time_t now = Core::DateTime::now().timestamp();
Vector<CookieStorageKey> keys_to_evict;
for (const auto& cookie : m_cookies) {
for (auto const& cookie : m_cookies) {
if (cookie.value.expiry_time.timestamp() < now)
keys_to_evict.append(cookie.key);
}
for (const auto& key : keys_to_evict)
for (auto const& key : keys_to_evict)
m_cookies.remove(key);
}

View file

@ -17,7 +17,7 @@
namespace Browser {
struct CookieStorageKey {
bool operator==(const CookieStorageKey&) const = default;
bool operator==(CookieStorageKey const&) const = default;
String name;
String domain;
@ -27,18 +27,18 @@ struct CookieStorageKey {
class CookieJar {
public:
String get_cookie(const URL& url, Web::Cookie::Source source);
void set_cookie(const URL& url, const Web::Cookie::ParsedCookie& parsed_cookie, Web::Cookie::Source source);
void set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source);
void dump_cookies() const;
Vector<Web::Cookie::Cookie> get_all_cookies() const;
private:
static Optional<String> canonicalize_domain(const URL& url);
static bool domain_matches(const String& string, const String& domain_string);
static bool path_matches(const String& request_path, const String& cookie_path);
static bool domain_matches(String const& string, String const& domain_string);
static bool path_matches(String const& request_path, String const& cookie_path);
static String default_path(const URL& url);
void store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source);
Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source);
void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source);
Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source);
void purge_expired_cookies();
HashMap<CookieStorageKey, Web::Cookie::Cookie> m_cookies;
@ -50,7 +50,7 @@ namespace AK {
template<>
struct Traits<Browser::CookieStorageKey> : public GenericTraits<Browser::CookieStorageKey> {
static unsigned hash(const Browser::CookieStorageKey& key)
static unsigned hash(Browser::CookieStorageKey const& key)
{
unsigned hash = 0;
hash = pair_int_hash(hash, string_hash(key.name.characters(), key.name.length()));

View file

@ -58,7 +58,7 @@ GUI::Variant CookiesModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
if (role != GUI::ModelRole::Display)
return {};
const auto& cookie = m_cookies[index.row()];
auto const& cookie = m_cookies[index.row()];
switch (index.column()) {
case Column::Domain:

View file

@ -18,7 +18,7 @@ void History::dump() const
}
}
void History::push(const URL& url, const String& title)
void History::push(const URL& url, String const& title)
{
if (!m_items.is_empty() && m_items[m_current].url == url)
return;
@ -55,12 +55,12 @@ void History::clear()
m_current = -1;
}
void History::update_title(const String& title)
void History::update_title(String const& title)
{
m_items[m_current].title = title;
}
const Vector<StringView> History::get_back_title_history()
Vector<StringView> const History::get_back_title_history()
{
Vector<StringView> back_title_history;
for (int i = m_current - 1; i >= 0; i--) {
@ -69,7 +69,7 @@ const Vector<StringView> History::get_back_title_history()
return back_title_history;
}
const Vector<StringView> History::get_forward_title_history()
Vector<StringView> const History::get_forward_title_history()
{
Vector<StringView> forward_title_history;
for (int i = m_current + 1; i < static_cast<int>(m_items.size()); i++) {

View file

@ -19,12 +19,12 @@ public:
};
void dump() const;
void push(const URL& url, const String& title);
void update_title(const String& title);
void push(const URL& url, String const& title);
void update_title(String const& title);
URLTitlePair current() const;
const Vector<StringView> get_back_title_history();
const Vector<StringView> get_forward_title_history();
Vector<StringView> const get_back_title_history();
Vector<StringView> const get_forward_title_history();
void go_back(int steps = 1);
void go_forward(int steps = 1);

View file

@ -183,7 +183,7 @@ void InspectorWidget::update_node_box_model(Optional<String> node_box_sizing_jso
return;
}
auto json_value = json_or_error.release_value();
const auto& json_object = json_value.as_object();
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();

View file

@ -66,7 +66,7 @@ void Tab::start_download(const URL& url)
window->show();
}
void Tab::view_source(const URL& url, const String& source)
void Tab::view_source(const URL& url, String const& source)
{
auto window = GUI::Window::construct(&this->window());
auto& editor = window->set_main_widget<GUI::TextEditor>();
@ -282,7 +282,7 @@ Tab::Tab(BrowserWindow& window)
m_image_context_menu->add_separator();
m_image_context_menu->add_action(window.inspect_dom_node_action());
hooks().on_image_context_menu_request = [this](auto& image_url, auto& screen_position, const Gfx::ShareableBitmap& shareable_bitmap) {
hooks().on_image_context_menu_request = [this](auto& image_url, auto& screen_position, Gfx::ShareableBitmap const& shareable_bitmap) {
m_image_context_menu_url = image_url;
m_image_context_menu_bitmap = shareable_bitmap;
m_image_context_menu->popup(screen_position);
@ -469,7 +469,7 @@ void Tab::bookmark_current_url()
update_bookmark_button(url);
}
void Tab::update_bookmark_button(const String& url)
void Tab::update_bookmark_button(String const& url)
{
if (BookmarksBarWidget::the().contains_bookmark(url)) {
m_bookmark_button->set_icon(g_icon_bag.bookmark_filled);
@ -503,7 +503,7 @@ void Tab::did_become_active()
update_actions();
}
void Tab::context_menu_requested(const Gfx::IntPoint& screen_position)
void Tab::context_menu_requested(Gfx::IntPoint const& screen_position)
{
m_tab_context_menu->popup(screen_position);
}

View file

@ -50,19 +50,19 @@ public:
void go_forward(int steps = 1);
void did_become_active();
void context_menu_requested(const Gfx::IntPoint& screen_position);
void context_menu_requested(Gfx::IntPoint const& screen_position);
void content_filters_changed();
void action_entered(GUI::Action&);
void action_left(GUI::Action&);
Function<void(const String&)> on_title_change;
Function<void(String const&)> on_title_change;
Function<void(const URL&)> on_tab_open_request;
Function<void(Tab&)> on_tab_close_request;
Function<void(Tab&)> on_tab_close_other_request;
Function<void(const Gfx::Bitmap&)> on_favicon_change;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<String(const URL&, Web::Cookie::Source source)> on_get_cookie;
Function<void(const URL&, const Web::Cookie::ParsedCookie& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void(const URL&, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void()> on_dump_cookies;
Function<Vector<Web::Cookie::Cookie>()> on_want_cookies;
@ -75,8 +75,8 @@ public:
void show_console_window();
void show_storage_inspector();
const String& title() const { return m_title; }
const Gfx::Bitmap* icon() const { return m_icon; }
String const& title() const { return m_title; }
Gfx::Bitmap const* icon() const { return m_icon; }
GUI::AbstractScrollableWidget& view();
@ -89,9 +89,9 @@ private:
Web::WebViewHooks& hooks();
void update_actions();
void bookmark_current_url();
void update_bookmark_button(const String& url);
void update_bookmark_button(String const& url);
void start_download(const URL& url);
void view_source(const URL& url, const String& source);
void view_source(const URL& url, String const& source);
void update_status(Optional<String> text_override = {}, i32 count_waiting = 0);
enum class MayAppendTLD {
@ -134,6 +134,6 @@ private:
bool m_is_history_navigation { false };
};
URL url_from_user_input(const String& input);
URL url_from_user_input(String const& input);
}

View file

@ -59,7 +59,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio recvfd sendfd unix cpath rpath wpath proc exec"));
const char* specified_url = nullptr;
char const* specified_url = nullptr;
Core::ArgsParser args_parser;
args_parser.add_positional_argument(specified_url, "URL to open", "url", Core::ArgsParser::Required::No);