Skip to content

Truly independent web browser

LibWebView+UI/Qt: Refresh the page actions when a window becomes active

Jelle Raaijmakers89ea3255a015
diff --git a/Libraries/LibWebView/Application.cpp b/Libraries/LibWebView/Application.cpp
index b7692fae174..a80e8106a26 100644
--- a/Libraries/LibWebView/Application.cpp
+++ b/Libraries/LibWebView/Application.cpp
@@ -2958,6 +2958,13 @@ void Application::update_bookmark_action_for_current_web_view()
m_toggle_bookmark_action->set_engaged(is_bookmarked);
}
+// The shared actions that depend on the page follow the active view, whichever tab or window made it the active one.
+void Application::update_actions_for_active_web_view()
+{
+ update_bookmark_action_for_current_web_view();
+ update_editing_history_actions();
+}
+
void Application::bookmarks_changed(Badge<ApplicationBookmarkStoreObserver>)
{
if (m_autocomplete_service)
diff --git a/Libraries/LibWebView/Application.h b/Libraries/LibWebView/Application.h
index 463906cde96..cfd256655d4 100644
--- a/Libraries/LibWebView/Application.h
+++ b/Libraries/LibWebView/Application.h
@@ -155,6 +155,7 @@ public:
static BookmarkStore& bookmark_store() { return *the().m_bookmark_store; }
void update_bookmark_action_for_current_web_view();
+ void update_actions_for_active_web_view();
void bookmarks_changed(Badge<ApplicationBookmarkStoreObserver>);
void background_networking_settings_changed(Badge<ApplicationSettingsObserver>);
diff --git a/UI/Qt/BrowserWindow.cpp b/UI/Qt/BrowserWindow.cpp
index 25254978a51..7ff4e06cd81 100644
--- a/UI/Qt/BrowserWindow.cpp
+++ b/UI/Qt/BrowserWindow.cpp
@@ -742,8 +742,7 @@ void BrowserWindow::set_current_tab(Tab* tab)
m_session->session_store->active_tab_changed(*session_tab_id);
}
- WebView::Application::the().update_bookmark_action_for_current_web_view();
- WebView::Application::the().update_editing_history_actions();
+ WebView::Application::the().update_actions_for_active_web_view();
}
void BrowserWindow::activate_tab(int index)
@@ -1167,6 +1166,7 @@ bool BrowserWindow::event(QEvent* event)
if (event->type() == QEvent::WindowActivate) {
Application::the().set_active_window(*this);
+ WebView::Application::the().update_actions_for_active_web_view();
QTimer::singleShot(0, this, [this] {
refresh_resize_cursor_at_current_position(true);
Application::the().crash_report_notifier().show_pending();