mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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:
parent
45c4e1c446
commit
8ff3cd6d76
Notes:
sideshowbarker
2024-07-17 05:02:42 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/8ff3cd6d76 Pull-request: https://github.com/SerenityOS/serenity/pull/23758 Reviewed-by: https://github.com/kalenikaliaksandr ✅
2 changed files with 14 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue