Ladybird: Reset the default favicon when starting a new page load

This matches the AppKit chrome. This resets the favicon so that we do
not keep using the previous site's favicon if the new site does not have
one.
This commit is contained in:
Timothy Flynn authored and Tim Flynn committed 2024-03-29 08:52:01 -04:00
1 parent 45c4e1c446
commit 8ff3cd6d76
2 files changed
+14 -1

No files matched your search

+10 -1
View File
@@ -42,6 +42,12 @@
namespace Ladybird {
static QIcon default_favicon()
{
static QIcon icon = load_icon_from_uri("resource://icons/16x16/app-browser.png"sv);
return icon;
}
static QIcon create_tvg_icon_with_theme_colors(QString name, QPalette const& palette)
{
auto path = QString(":/Icons/%1.tvg").arg(name);
@@ -83,7 +89,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
recreate_toolbar_icons();
m_favicon = load_icon_from_uri("resource://icons/16x16/app-browser.png"sv);
m_favicon = default_favicon();
m_toolbar->addAction(&m_window->go_back_action());
m_toolbar->addAction(&m_window->go_forward_action());
@@ -136,6 +142,9 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
m_title = url_serialized;
emit title_changed(tab_index(), url_serialized);
m_favicon = default_favicon();
emit favicon_changed(tab_index(), m_favicon);
m_location_edit->setText(url_serialized);
m_location_edit->setCursorPosition(0);
+4
View File
@@ -231,6 +231,10 @@ Tab::Tab(BrowserWindow& window)
if (on_title_change)
on_title_change(m_title);
m_icon = g_icon_bag.default_favicon;
if (on_favicon_change)
on_favicon_change(*m_icon);
update_status();
m_location_box->set_icon(nullptr);