Skip to content

Truly independent web browser

Hub+LibWebView+UI/Qt: Mirror actions and menus in the UI

Andreas Klingd3da145d201d
diff --git a/Libraries/LibWebView/Menu.h b/Libraries/LibWebView/Menu.h
index 1aa448bde9d..0678dfbfd45 100644
--- a/Libraries/LibWebView/Menu.h
+++ b/Libraries/LibWebView/Menu.h
@@ -163,6 +163,7 @@ public:
StringView text() const { return action_text_to_string_view(m_text); }
void set_text(ActionText);
+ bool has_tooltip() const { return m_tooltip.has_value(); }
StringView tooltip() const { return action_text_to_string_view(*m_tooltip); }
void set_tooltip(ActionText);
@@ -262,6 +263,8 @@ public:
void set_render_group_icon(bool render_group_icon) { m_render_group_icon = render_group_icon; }
bool render_group_icon() const { return m_render_group_icon; }
+ bool is_group() const { return m_is_group; }
+
bool visible() const { return m_visible; }
void set_visible(bool);
diff --git a/Services/Hub/ActionMirror.cpp b/Services/Hub/ActionMirror.cpp
new file mode 100644
index 00000000000..d0d005806d2
--- /dev/null
+++ b/Services/Hub/ActionMirror.cpp
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <Hub/ActionMirror.h>
+#include <Hub/Application.h>
+#include <Hub/ConnectionFromUI.h>
+#include <LibWebView/ViewImplementation.h>
+
+namespace Hub {
+
+ActionMirror& ActionMirror::the()
+{
+ // NB: Actions can go away while the process exits, and they tell this object when they do.
+ static auto& s_the = *new ActionMirror;
+ return s_the;
+}
+
+struct ActionObserver final : public WebView::Action::Observer {
+ ActionObserver(u64 handle, WebView::Action const& action)
+ : m_handle(handle)
+ , m_action(&action)
+ {
+ }
+
+ // NB: An action owns its observers, so this runs as the action goes away.
+ virtual ~ActionObserver() override { ActionMirror::the().retire(m_handle, m_action); }
+
+ virtual void on_text_changed(WebView::Action& action) override { did_change(action); }
+ virtual void on_tooltip_changed(WebView::Action& action) override { did_change(action); }
+ virtual void on_enabled_state_changed(WebView::Action& action) override { did_change(action); }
+ virtual void on_visible_state_changed(WebView::Action& action) override { did_change(action); }
+ virtual void on_engaged_state_changed(WebView::Action& action) override { did_change(action); }
+ virtual void on_checked_state_changed(WebView::Action& action) override { did_change(action); }
+
+ static void did_change(WebView::Action& action)
+ {
+ if (auto* ui = ConnectionFromUI::the())
+ ui->async_action_changed(ActionMirror::the().state_of(action));
+ }
+
+ u64 m_handle { 0 };
+ WebView::Action const* m_action { nullptr };
+};
+
+u64 ActionMirror::handle_of(WebView::Action& action)
+{
+ if (auto handle = m_handles.get(&action); handle.has_value())
+ return *handle;
+
+ auto handle = m_next_handle++;
+ m_handles.set(&action, handle);
+ m_actions.set(handle, action.make_weak_ptr<WebView::Action>());
+ action.add_observer(make<ActionObserver>(handle, action));
+ return handle;
+}
+
+void ActionMirror::retire(u64 handle, WebView::Action const* action)
+{
+ m_actions.remove(handle);
+ m_handles.remove(action);
+ if (auto* ui = ConnectionFromUI::the())
+ ui->async_action_retired(handle);
+}
+
+template<typename MenuOrAction>
+static void copy_properties(MenuOrAction const& menu_or_action, Vector<String>& names, Vector<String>& values)
+{
+ for (auto const& [name, value] : menu_or_action.properties()) {
+ names.append(MUST(String::from_utf8(name)));
+ values.append(value);
+ }
+}
+
+ActionState ActionMirror::state_of(WebView::Action& action)
+{
+ ActionState state;
+ state.handle = handle_of(action);
+ state.id = action.id();
+ state.text = MUST(String::from_utf8(action.text()));
+ if (action.has_tooltip())
+ state.tooltip = MUST(String::from_utf8(action.tooltip()));
+ state.enabled = action.enabled();
+ state.visible = action.visible();
+ state.engaged = action.engaged();
+ if (action.is_checkable())
+ state.checked = action.checked();
+ if (auto icon = action.png_icon(); icon.has_value())
+ state.png_icon = *icon;
+ copy_properties(action, state.property_names, state.property_values);
+ return state;
+}
+
+static MenuEntry menu_entry(MenuEntryKind kind)
+{
+ MenuEntry entry;
+ entry.kind = kind;
+ return entry;
+}
+
+Vector<MenuEntry> ActionMirror::entries_of(WebView::Menu& menu)
+{
+ Vector<MenuEntry> entries;
+ auto add_menu = [&](auto& add_menu, WebView::Menu& menu) -> void {
+ auto entry = menu_entry(MenuEntryKind::Submenu);
+ entry.title = MUST(String::from_utf8(menu.title()));
+ entry.visible = menu.visible();
+ entry.is_group = menu.is_group();
+ entry.render_group_icon = menu.render_group_icon();
+ copy_properties(menu, entry.property_names, entry.property_values);
+ entries.append(move(entry));
+
+ for (auto& item : menu.items()) {
+ item.visit(
+ [&](NonnullRefPtr<WebView::Action>& action) {
+ auto action_entry = menu_entry(MenuEntryKind::Action);
+ action_entry.action = state_of(*action);
+ entries.append(move(action_entry));
+ },
+ [&](NonnullRefPtr<WebView::Menu>& submenu) {
+ add_menu(add_menu, *submenu);
+ },
+ [&](WebView::Separator) {
+ entries.append(menu_entry(MenuEntryKind::Separator));
+ });
+ }
+ entries.append(menu_entry(MenuEntryKind::EndOfSubmenu));
+ };
+ add_menu(add_menu, menu);
+ return entries;
+}
+
+ApplicationActions ActionMirror::application_actions()
+{
+ auto& application = Application::the();
+ ApplicationActions actions;
+ actions.reload_action = state_of(application.reload_action());
+ actions.reload_bypassing_cache_action = state_of(application.reload_bypassing_cache_action());
+ actions.copy_selection_action = state_of(application.copy_selection_action());
+ actions.undo_action = state_of(application.undo_action());
+ actions.redo_action = state_of(application.redo_action());
+ actions.cut_selection_action = state_of(application.cut_selection_action());
+ actions.paste_action = state_of(application.paste_action());
+ actions.select_all_action = state_of(application.select_all_action());
+ actions.open_about_page_action = state_of(application.open_about_page_action());
+ actions.open_downloads_page_action = state_of(application.open_downloads_page_action());
+ actions.open_settings_page_action = state_of(application.open_settings_page_action());
+ actions.zoom_in_action = state_of(application.zoom_in_action());
+ actions.zoom_out_action = state_of(application.zoom_out_action());
+ actions.reset_zoom_action = state_of(application.reset_zoom_action());
+ actions.force_dark_action = state_of(application.force_dark_action());
+ actions.toggle_vertical_tabs_expanded_action = state_of(application.toggle_vertical_tabs_expanded_action());
+ actions.toggle_menu_bar_action = state_of(application.toggle_menu_bar_action());
+ actions.toggle_bookmark_bar_action = state_of(application.toggle_bookmark_bar_action());
+ actions.view_source_action = state_of(application.view_source_action());
+ actions.report_website_issue_action = state_of(application.report_website_issue_action());
+ actions.zoom_menu = entries_of(application.zoom_menu());
+ actions.color_scheme_menu = entries_of(application.color_scheme_menu());
+ actions.contrast_menu = entries_of(application.contrast_menu());
+ actions.motion_menu = entries_of(application.motion_menu());
+ actions.bookmarks_menu = entries_of(application.bookmarks_menu());
+ actions.show_bookmarks_bar_menu = entries_of(application.show_bookmarks_bar_menu());
+ actions.history_menu = entries_of(application.history_menu());
+ actions.inspect_menu = entries_of(application.inspect_menu());
+ actions.debug_menu = entries_of(application.debug_menu());
+ return actions;
+}
+
+ViewActions ActionMirror::view_actions(WebView::ViewImplementation& view)
+{
+ ViewActions actions;
+ actions.navigate_back_action = state_of(view.navigate_back_action());
+ actions.navigate_forward_action = state_of(view.navigate_forward_action());
+ actions.toggle_bookmark_action = state_of(view.toggle_bookmark_action());
+ actions.reset_zoom_action = state_of(view.reset_zoom_action());
+ actions.bookmarks_bar_context_menu = entries_of(view.bookmarks_bar_context_menu());
+ actions.bookmark_context_menu = entries_of(view.bookmark_context_menu());
+ actions.bookmark_folder_context_menu = entries_of(view.bookmark_folder_context_menu());
+ return actions;
+}
+
+void ActionMirror::activate(u64 handle, Optional<bool> checked)
+{
+ auto* action = m_actions.get(handle).value_or(nullptr);
+ if (!action)
+ return;
+ // NB: The UI has flipped its copy already, and what an action does often depends on its state.
+ if (checked.has_value())
+ action->set_checked(*checked);
+ action->activate();
+}
+
+}
diff --git a/Services/Hub/ActionMirror.h b/Services/Hub/ActionMirror.h
new file mode 100644
index 00000000000..3ee00549afd
--- /dev/null
+++ b/Services/Hub/ActionMirror.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/HashMap.h>
+#include <AK/WeakPtr.h>
+#include <Hub/HubClientEndpoint.h>
+#include <LibWebView/Forward.h>
+#include <LibWebView/Menu.h>
+
+namespace Hub {
+
+// Lets the UI show the Hub's actions and menus. The UI knows an action by a handle, sees it change, and activates it.
+class ActionMirror {
+public:
+ static ActionMirror& the();
+
+ ActionState state_of(WebView::Action&);
+ Vector<MenuEntry> entries_of(WebView::Menu&);
+ ApplicationActions application_actions();
+ ViewActions view_actions(WebView::ViewImplementation&);
+
+ void activate(u64 handle, Optional<bool> checked);
+ void retire(u64 handle, WebView::Action const*);
+
+private:
+ u64 handle_of(WebView::Action&);
+
+ HashMap<u64, WeakPtr<WebView::Action>> m_actions;
+ HashMap<WebView::Action const*, u64> m_handles;
+ u64 m_next_handle { 1 };
+};
+
+}
diff --git a/Services/Hub/Application.cpp b/Services/Hub/Application.cpp
index 85fc291b379..d229bb4e62e 100644
--- a/Services/Hub/Application.cpp
+++ b/Services/Hub/Application.cpp
@@ -4,7 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Hub/ActionMirror.h>
#include <Hub/Application.h>
+#include <Hub/ConnectionFromUI.h>
#include <LibCore/EventLoop.h>
#include <LibWebView/WebContentPage.h>
@@ -68,6 +70,15 @@ void Application::toggle_bookmark_for_view(WebView::ViewImplementation& view)
WebView::Application::toggle_bookmark_for_view(view);
}
+void Application::rebuild_bookmarks_menu() const
+{
+ if (!m_host)
+ return;
+ if (auto* ui = ConnectionFromUI::the())
+ ui->async_bookmarks_menu_changed(ActionMirror::the().entries_of(const_cast<Application&>(*this).bookmarks_menu()));
+ m_host->rebuild_bookmarks_menu();
+}
+
void Application::on_devtools_enabled() const
{
WebView::Application::on_devtools_enabled();
@@ -384,14 +395,6 @@ void Application::update_tabs_display() const
WebView::Application::update_tabs_display();
}
-void Application::rebuild_bookmarks_menu() const
-{
- if (m_host)
- m_host->rebuild_bookmarks_menu();
- else
- WebView::Application::rebuild_bookmarks_menu();
-}
-
void Application::show_bookmark_context_menu(Gfx::IntPoint position, Optional<WebView::BookmarkItem const&> item, Optional<String const&> target_folder_id, Optional<String const&> parent_folder_id)
{
if (m_host)
diff --git a/Services/Hub/CMakeLists.txt b/Services/Hub/CMakeLists.txt
index f087df48257..ccd1330aafa 100644
--- a/Services/Hub/CMakeLists.txt
+++ b/Services/Hub/CMakeLists.txt
@@ -3,6 +3,7 @@ set(CMAKE_AUTORCC OFF)
set(CMAKE_AUTOUIC OFF)
set(SOURCES
+ ActionMirror.cpp
Application.cpp
ConnectionFromUI.cpp
View.cpp
diff --git a/Services/Hub/ConnectionFromUI.cpp b/Services/Hub/ConnectionFromUI.cpp
index 08ce20fe998..526bb68b3da 100644
--- a/Services/Hub/ConnectionFromUI.cpp
+++ b/Services/Hub/ConnectionFromUI.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Hub/ActionMirror.h>
#include <Hub/Application.h>
#include <Hub/ConnectionFromUI.h>
@@ -116,6 +117,11 @@ void ConnectionFromUI::view_answer_permission_request(u64 view_id, u64 answer_id
}
}
+void ConnectionFromUI::activate_action(u64 handle, Optional<bool> checked)
+{
+ ActionMirror::the().activate(handle, checked);
+}
+
void ConnectionFromUI::destroy_view(u64 view_id)
{
Application::the().destroy_view(view_id);
diff --git a/Services/Hub/ConnectionFromUI.h b/Services/Hub/ConnectionFromUI.h
index 4a5bff8d9cd..da3ad2c2d43 100644
--- a/Services/Hub/ConnectionFromUI.h
+++ b/Services/Hub/ConnectionFromUI.h
@@ -33,6 +33,7 @@ private:
static View* find_view(u64 view_id);
// ^HubServerEndpoint
+ virtual void activate_action(u64 handle, Optional<bool> checked) override;
virtual void view_answer(u64 view_id, u64 answer_id, bool answer) override;
virtual void view_answer_permission_request(u64 view_id, u64 answer_id, Web::Permissions::PromptOutcome outcome) override;
virtual void destroy_view(u64 view_id) override;
diff --git a/Services/Hub/HubClient.ipc b/Services/Hub/HubClient.ipc
index 3a04919fe12..49403d5d9bd 100644
--- a/Services/Hub/HubClient.ipc
+++ b/Services/Hub/HubClient.ipc
@@ -12,6 +12,7 @@
#include <LibWebCommon/HTML/FileFilter.h>
#include <LibWebCommon/HTML/SelectItem.h>
#include <LibWebView/AccessibilityTreeManager.h>
+#include <LibWebView/Menu.h>
#include <LibWebView/TabPerformanceStats.h>
#include <LibWebView/ViewImplementation.h>
@@ -66,6 +67,83 @@ struct WebView::ViewImplementation::InputMethodState {
Optional<Web::DevicePixelRect> caret_rect;
}
+enum Hub::MenuEntryKind : u8 {
+ Action,
+ Separator,
+ Submenu,
+ EndOfSubmenu,
+}
+
+struct Hub::ActionState {
+ u64 handle;
+ WebView::ActionID id;
+ String text;
+ Optional<String> tooltip;
+ bool enabled;
+ bool visible;
+ bool engaged;
+ Optional<bool> checked;
+ Optional<ByteBuffer> png_icon;
+ Vector<String> property_names;
+ Vector<String> property_values;
+}
+
+// A menu goes as a flat list, in which a submenu's entries follow its own, up to its end.
+struct Hub::MenuEntry {
+ Hub::MenuEntryKind kind;
+ Optional<Hub::ActionState> action;
+ String title;
+ bool visible;
+ bool is_group;
+ bool render_group_icon;
+ Vector<String> property_names;
+ Vector<String> property_values;
+}
+
+// The actions and menus of the application, which the UI shows in its windows.
+struct Hub::ApplicationActions {
+ Hub::ActionState reload_action;
+ Hub::ActionState reload_bypassing_cache_action;
+ Hub::ActionState copy_selection_action;
+ Hub::ActionState undo_action;
+ Hub::ActionState redo_action;
+ Hub::ActionState cut_selection_action;
+ Hub::ActionState paste_action;
+ Hub::ActionState select_all_action;
+ Hub::ActionState open_about_page_action;
+ Hub::ActionState open_downloads_page_action;
+ Hub::ActionState open_settings_page_action;
+ Hub::ActionState zoom_in_action;
+ Hub::ActionState zoom_out_action;
+ Hub::ActionState reset_zoom_action;
+ Hub::ActionState force_dark_action;
+ Hub::ActionState toggle_vertical_tabs_expanded_action;
+ Hub::ActionState toggle_menu_bar_action;
+ Hub::ActionState toggle_bookmark_bar_action;
+ Hub::ActionState view_source_action;
+ Hub::ActionState report_website_issue_action;
+ Vector<Hub::MenuEntry> zoom_menu;
+ Vector<Hub::MenuEntry> color_scheme_menu;
+ Vector<Hub::MenuEntry> contrast_menu;
+ Vector<Hub::MenuEntry> motion_menu;
+ Vector<Hub::MenuEntry> bookmarks_menu;
+ Vector<Hub::MenuEntry> show_bookmarks_bar_menu;
+ Vector<Hub::MenuEntry> history_menu;
+ Vector<Hub::MenuEntry> inspect_menu;
+ Vector<Hub::MenuEntry> debug_menu;
+}
+
+// The actions and menus of a view.
+struct Hub::ViewActions {
+ Hub::ActionState navigate_back_action;
+ Hub::ActionState navigate_forward_action;
+ Hub::ActionState toggle_bookmark_action;
+ Hub::ActionState reset_zoom_action;
+ Vector<Hub::MenuEntry> bookmarks_bar_context_menu;
+ Vector<Hub::MenuEntry> bookmark_context_menu;
+ Vector<Hub::MenuEntry> bookmark_folder_context_menu;
+}
+
// What the UI needs to know about a view at any time, without having to ask.
struct Hub::ViewState {
URL::URL url;
@@ -97,6 +175,10 @@ struct Hub::ViewState {
// What the Hub tells the UI.
endpoint HubClient
{
+ action_changed(Hub::ActionState state) =|
+ action_retired(u64 handle) =|
+ bookmarks_menu_changed(Vector<Hub::MenuEntry> entries) =|
+ view_show_context_menu(u64 view_id, Vector<Hub::MenuEntry> entries, Gfx::IntPoint widget_position) =|
view_favicon_change(u64 view_id, Optional<Gfx::ShareableBitmap> favicon) =|
view_request_before_unload(u64 view_id, u64 answer_id, String source) =|
view_request_external_url_confirmation(u64 view_id, u64 answer_id, URL::URL url, URL::Origin initiator_origin, String application_name) =|
diff --git a/Services/Hub/HubServer.ipc b/Services/Hub/HubServer.ipc
index bf11011e591..46ea1f1fcc6 100644
--- a/Services/Hub/HubServer.ipc
+++ b/Services/Hub/HubServer.ipc
@@ -19,6 +19,7 @@ struct WebView::ViewImplementation::ScreenRects {
// What the UI asks of the Hub.
endpoint HubServer
{
+ activate_action(u64 handle, Optional<bool> checked) =|
view_answer(u64 view_id, u64 answer_id, bool answer) =|
view_answer_permission_request(u64 view_id, u64 answer_id, Web::Permissions::PromptOutcome outcome) =|
destroy_view(u64 view_id) =|
diff --git a/Services/Hub/View.cpp b/Services/Hub/View.cpp
index cf3783cb089..5457c835325 100644
--- a/Services/Hub/View.cpp
+++ b/Services/Hub/View.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Hub/ActionMirror.h>
#include <Hub/Application.h>
#include <Hub/ConnectionFromUI.h>
#include <Hub/View.h>
@@ -673,8 +674,10 @@ void View::update_zoom()
void View::show_context_menu(WebView::Menu& menu, Gfx::IntPoint widget_position)
{
- if (m_host)
- m_host->show_context_menu(menu, widget_position);
+ if (auto* ui = ConnectionFromUI::the()) {
+ push_state_to_ui();
+ ui->async_view_show_context_menu(view_id(), ActionMirror::the().entries_of(menu), widget_position);
+ }
}
}
diff --git a/Services/Hub/View.h b/Services/Hub/View.h
index 5ca9844a920..d70e90e91a0 100644
--- a/Services/Hub/View.h
+++ b/Services/Hub/View.h
@@ -11,14 +11,6 @@
namespace Hub {
-// What a view needs from the UI that shows it.
-class ViewHost {
-public:
- virtual ~ViewHost() = default;
-
- virtual void show_context_menu(WebView::Menu&, Gfx::IntPoint widget_position) = 0;
-};
-
// A tab's view. It holds the tab's pages and everything else about them, and leaves showing them to its ViewHost.
class View final : public WebView::ViewImplementation {
public:
@@ -42,13 +34,6 @@ public:
void initialize(Optional<WebView::CanonicalTraversable&>);
InitialState initial_state_for_related_view() const;
- void attach_host(ViewHost& host) { m_host = &host; }
-
- ViewHost* host() const { return m_host; }
-
- // The host is going away, and takes no more calls.
- void detach_from_host() { m_host = nullptr; }
-
ViewState current_state() const;
// Tells the UI where the view has changed, which it must hear of before anything that makes it look.
@@ -82,7 +67,6 @@ private:
void forward_callbacks_to_ui(bool is_tab);
- ViewHost* m_host { nullptr };
Core::AnonymousBuffer m_system_theme;
Optional<ScreenRects> m_screen_rects;
Web::DevicePixelSize m_viewport_size;
diff --git a/UI/Qt/Application.cpp b/UI/Qt/Application.cpp
index ef768768e1c..e24e4976173 100644
--- a/UI/Qt/Application.cpp
+++ b/UI/Qt/Application.cpp
@@ -18,6 +18,7 @@
#elif defined(AK_OS_LINUX) || defined(AK_OS_FREEBSD)
# include <LibWebView/NotificationBackendFreedesktop.h>
#endif
+#include <Hub/ActionMirror.h>
#include <LibWebView/SessionStore.h>
#include <LibWebView/URL.h>
#include <LibWebView/Utilities.h>
@@ -31,6 +32,7 @@
#include <UI/Qt/PictureInPictureWindow.h>
#include <UI/Qt/PlainText.h>
#include <UI/Qt/ProcessManagerWindow.h>
+#include <UI/Qt/RemoteActions.h>
#include <UI/Qt/StringUtils.h>
#include <UI/Qt/Tab.h>
#include <UI/Qt/Theme.h>
@@ -312,7 +314,7 @@ public:
void create_application_actions()
{
- auto& application = WebView::Application::the();
+ auto& application = RemoteActions::the();
auto make_action = [&](QString const& text) {
auto* action = new QAction(text, m_application_widget);
@@ -680,7 +682,9 @@ void Application::show_process_manager()
void Application::create_platform_actions()
{
- hub().inspect_menu().add_action(WebView::Action::create("Open Task Manager"sv, WebView::ActionID::OpenTaskManager, [this]() {
+ RemoteActions::the().set_application_actions(Hub::ActionMirror::the().application_actions());
+
+ RemoteActions::the().inspect_menu().add_action(WebView::Action::create("Open Task Manager"sv, WebView::ActionID::OpenTaskManager, [this]() {
show_process_manager();
}));
@@ -1925,7 +1929,7 @@ void Application::on_recently_closed_entries_changed() const
QMenuBar* Application::create_application_menu_bar(ForBrowserWindow for_browser_window)
{
- auto& application = WebView::Application::the();
+ auto& application = RemoteActions::the();
auto* menu_bar = new QMenuBar();
auto* file_menu = menu_bar->addMenu("&File");
diff --git a/UI/Qt/CMakeLists.txt b/UI/Qt/CMakeLists.txt
index 83fca376307..8d404fa3707 100644
--- a/UI/Qt/CMakeLists.txt
+++ b/UI/Qt/CMakeLists.txt
@@ -43,6 +43,7 @@ add_library(ladybird_impl STATIC
PlainText.cpp
Popover.cpp
ProcessManagerWindow.cpp
+ RemoteActions.cpp
RemoteView.cpp
ReportReview.cpp
RestoreSessionCard.cpp
diff --git a/UI/Qt/HubConnection.cpp b/UI/Qt/HubConnection.cpp
index b1ea2b27f75..23265f201f5 100644
--- a/UI/Qt/HubConnection.cpp
+++ b/UI/Qt/HubConnection.cpp
@@ -5,6 +5,7 @@
*/
#include <UI/Qt/HubConnection.h>
+#include <UI/Qt/RemoteActions.h>
#include <UI/Qt/RemoteView.h>
namespace Ladybird {
@@ -182,6 +183,27 @@ void HubConnection::view_request_dictionary_lookup(u64 view_id, WebView::Diction
view->on_request_dictionary_lookup(lookup, position);
}
+void HubConnection::action_changed(Hub::ActionState state)
+{
+ RemoteActions::the().update(state);
+}
+
+void HubConnection::bookmarks_menu_changed(Vector<Hub::MenuEntry> entries)
+{
+void HubConnection::action_retired(u64 handle)
+{
+ RemoteActions::the().retire(handle);
+}
+
+ RemoteActions::the().set_bookmarks_menu(entries);
+}
+
+void HubConnection::view_show_context_menu(u64 view_id, Vector<Hub::MenuEntry> entries, Gfx::IntPoint widget_position)
+{
+ if (auto* view = RemoteView::find(view_id))
+ view->did_request_context_menu(entries, widget_position);
+}
+
void HubConnection::view_update_zoom(u64 view_id)
{
if (auto* view = RemoteView::find(view_id))
diff --git a/UI/Qt/HubConnection.h b/UI/Qt/HubConnection.h
index f48d73eef2b..8e6a9e4362f 100644
--- a/UI/Qt/HubConnection.h
+++ b/UI/Qt/HubConnection.h
@@ -29,6 +29,10 @@ private:
virtual void die() override;
// ^HubClientEndpoint
+ virtual void action_changed(Hub::ActionState state) override;
+ virtual void bookmarks_menu_changed(Vector<Hub::MenuEntry> entries) override;
+ virtual void action_retired(u64 handle) override;
+ virtual void view_show_context_menu(u64 view_id, Vector<Hub::MenuEntry> entries, Gfx::IntPoint widget_position) override;
virtual void view_favicon_change(u64 view_id, Optional<Gfx::ShareableBitmap> favicon) override;
virtual void view_request_before_unload(u64 view_id, u64 answer_id, String source) override;
virtual void view_request_external_url_confirmation(u64 view_id, u64 answer_id, URL::URL url, URL::Origin initiator_origin, String application_name) override;
diff --git a/UI/Qt/RemoteActions.cpp b/UI/Qt/RemoteActions.cpp
new file mode 100644
index 00000000000..88c3ebd8b31
--- /dev/null
+++ b/UI/Qt/RemoteActions.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/ByteString.h>
+#include <AK/HashTable.h>
+#include <UI/Qt/HubConnection.h>
+#include <UI/Qt/RemoteActions.h>
+
+namespace Ladybird {
+
+RemoteActions& RemoteActions::the()
+{
+ static RemoteActions s_the;
+ return s_the;
+}
+
+// NB: Menus and actions hold their property names as views of string literals, which these stand in for.
+static StringView interned_property_name(String const& name)
+{
+ static HashTable<ByteString> s_names;
+ auto byte_string = name.to_byte_string();
+ s_names.set(byte_string);
+ return s_names.find(byte_string)->view();
+}
+
+template<typename MenuOrAction>
+static void apply_properties(MenuOrAction& menu_or_action, ReadonlySpan<String> names, ReadonlySpan<String> values)
+{
+ for (size_t i = 0; i < names.size(); ++i)
+ menu_or_action.add_property(interned_property_name(names[i]), values[i]);
+}
+
+void RemoteActions::apply_state(WebView::Action& action, Hub::ActionState const& state)
+{
+ if (action.text() != state.text)
+ action.set_text(state.text);
+ if (state.tooltip.has_value() && (!action.has_tooltip() || action.tooltip() != *state.tooltip))
+ action.set_tooltip(*state.tooltip);
+ action.set_png_icon(state.png_icon);
+ if (action.enabled() != state.enabled)
+ action.set_enabled(state.enabled);
+ if (action.visible() != state.visible)
+ action.set_visible(state.visible);
+ if (action.engaged() != state.engaged)
+ action.set_engaged(state.engaged);
+ if (state.checked.has_value() && action.is_checkable() && action.checked() != *state.checked)
+ action.set_checked(*state.checked);
+ apply_properties(action, state.property_names, state.property_values);
+}
+
+NonnullRefPtr<WebView::Action> RemoteActions::action_for(Hub::ActionState const& state)
+{
+ if (auto* action = m_actions.get(state.handle).value_or(nullptr)) {
+ apply_state(*action, state);
+ return *action;
+ }
+
+ auto activate = [this, handle = state.handle] {
+ Optional<bool> checked;
+ if (auto* action = m_actions.get(handle).value_or(nullptr); action && action->is_checkable())
+ checked = action->checked();
+ HubConnection::the().async_activate_action(handle, checked);
+ };
+ auto action = state.checked.has_value()
+ ? WebView::Action::create_checkable(state.text, state.id, move(activate))
+ : WebView::Action::create(state.text, state.id, move(activate));
+ apply_state(*action, state);
+ m_actions.set(state.handle, action->make_weak_ptr<WebView::Action>());
+ return action;
+}
+
+void RemoteActions::update(Hub::ActionState const& state)
+{
+ if (auto* action = m_actions.get(state.handle).value_or(nullptr))
+ apply_state(*action, state);
+}
+
+void RemoteActions::retire(u64 handle)
+{
+ m_actions.remove(handle);
+}
+
+NonnullRefPtr<WebView::Menu> RemoteActions::menu_for(ReadonlySpan<Hub::MenuEntry> entries)
+{
+ Vector<NonnullRefPtr<WebView::Menu>> open_menus;
+ RefPtr<WebView::Menu> outermost_menu;
+
+ for (auto const& entry : entries) {
+ switch (entry.kind) {
+ case Hub::MenuEntryKind::Submenu: {
+ auto menu = entry.is_group ? WebView::Menu::create_group(entry.title) : WebView::Menu::create(entry.title);
+ menu->set_render_group_icon(entry.render_group_icon);
+ menu->set_visible(entry.visible);
+ apply_properties(*menu, entry.property_names, entry.property_values);
+ if (!open_menus.is_empty())
+ open_menus.last()->add_submenu(menu);
+ else
+ outermost_menu = menu;
+ open_menus.append(menu);
+ break;
+ }
+ case Hub::MenuEntryKind::EndOfSubmenu:
+ (void)open_menus.take_last();
+ break;
+ case Hub::MenuEntryKind::Action:
+ open_menus.last()->add_action(action_for(*entry.action));
+ break;
+ case Hub::MenuEntryKind::Separator:
+ open_menus.last()->add_separator();
+ break;
+ }
+ }
+ return outermost_menu.release_nonnull();
+}
+
+void RemoteActions::set_application_actions(Hub::ApplicationActions const& actions)
+{
+ m_reload_action = action_for(actions.reload_action);
+ m_reload_bypassing_cache_action = action_for(actions.reload_bypassing_cache_action);
+ m_copy_selection_action = action_for(actions.copy_selection_action);
+ m_undo_action = action_for(actions.undo_action);
+ m_redo_action = action_for(actions.redo_action);
+ m_cut_selection_action = action_for(actions.cut_selection_action);
+ m_paste_action = action_for(actions.paste_action);
+ m_select_all_action = action_for(actions.select_all_action);
+ m_open_about_page_action = action_for(actions.open_about_page_action);
+ m_open_downloads_page_action = action_for(actions.open_downloads_page_action);
+ m_open_settings_page_action = action_for(actions.open_settings_page_action);
+ m_zoom_in_action = action_for(actions.zoom_in_action);
+ m_zoom_out_action = action_for(actions.zoom_out_action);
+ m_reset_zoom_action = action_for(actions.reset_zoom_action);
+ m_force_dark_action = action_for(actions.force_dark_action);
+ m_toggle_vertical_tabs_expanded_action = action_for(actions.toggle_vertical_tabs_expanded_action);
+ m_toggle_menu_bar_action = action_for(actions.toggle_menu_bar_action);
+ m_toggle_bookmark_bar_action = action_for(actions.toggle_bookmark_bar_action);
+ m_view_source_action = action_for(actions.view_source_action);
+ m_report_website_issue_action = action_for(actions.report_website_issue_action);
+ m_zoom_menu = menu_for(actions.zoom_menu);
+ m_color_scheme_menu = menu_for(actions.color_scheme_menu);
+ m_contrast_menu = menu_for(actions.contrast_menu);
+ m_motion_menu = menu_for(actions.motion_menu);
+ m_bookmarks_menu = menu_for(actions.bookmarks_menu);
+ m_show_bookmarks_bar_menu = menu_for(actions.show_bookmarks_bar_menu);
+ m_history_menu = menu_for(actions.history_menu);
+ m_inspect_menu = menu_for(actions.inspect_menu);
+ m_debug_menu = menu_for(actions.debug_menu);
+}
+
+void RemoteActions::set_bookmarks_menu(ReadonlySpan<Hub::MenuEntry> entries)
+{
+ m_bookmarks_menu = menu_for(entries);
+}
+
+}
diff --git a/UI/Qt/RemoteActions.h b/UI/Qt/RemoteActions.h
new file mode 100644
index 00000000000..c88a831b841
--- /dev/null
+++ b/UI/Qt/RemoteActions.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/HashMap.h>
+#include <AK/WeakPtr.h>
+#include <Hub/HubClientEndpoint.h>
+#include <LibWebView/Menu.h>
+
+namespace Ladybird {
+
+// The Hub's actions and menus, as the UI shows them. Each stands in for one in the Hub, which it follows, and which it
+// activates when the user picks it.
+class RemoteActions {
+public:
+ static RemoteActions& the();
+
+ void set_application_actions(Hub::ApplicationActions const&);
+ void set_bookmarks_menu(ReadonlySpan<Hub::MenuEntry>);
+
+ NonnullRefPtr<WebView::Action> action_for(Hub::ActionState const&);
+ NonnullRefPtr<WebView::Menu> menu_for(ReadonlySpan<Hub::MenuEntry>);
+ void update(Hub::ActionState const&);
+ void retire(u64 handle);
+
+ WebView::Action& reload_action() { return *m_reload_action; }
+ WebView::Action& reload_bypassing_cache_action() { return *m_reload_bypassing_cache_action; }
+ WebView::Action& copy_selection_action() { return *m_copy_selection_action; }
+ WebView::Action& undo_action() { return *m_undo_action; }
+ WebView::Action& redo_action() { return *m_redo_action; }
+ WebView::Action& cut_selection_action() { return *m_cut_selection_action; }
+ WebView::Action& paste_action() { return *m_paste_action; }
+ WebView::Action& select_all_action() { return *m_select_all_action; }
+ WebView::Action& open_about_page_action() { return *m_open_about_page_action; }
+ WebView::Action& open_downloads_page_action() { return *m_open_downloads_page_action; }
+ WebView::Action& open_settings_page_action() { return *m_open_settings_page_action; }
+ WebView::Action& zoom_in_action() { return *m_zoom_in_action; }
+ WebView::Action& zoom_out_action() { return *m_zoom_out_action; }
+ WebView::Action& reset_zoom_action() { return *m_reset_zoom_action; }
+ WebView::Action& force_dark_action() { return *m_force_dark_action; }
+ WebView::Action& toggle_vertical_tabs_expanded_action() { return *m_toggle_vertical_tabs_expanded_action; }
+ WebView::Action& toggle_menu_bar_action() { return *m_toggle_menu_bar_action; }
+ WebView::Action& toggle_bookmark_bar_action() { return *m_toggle_bookmark_bar_action; }
+ WebView::Action& view_source_action() { return *m_view_source_action; }
+ WebView::Action& report_website_issue_action() { return *m_report_website_issue_action; }
+
+ WebView::Menu& zoom_menu() { return *m_zoom_menu; }
+ WebView::Menu& color_scheme_menu() { return *m_color_scheme_menu; }
+ WebView::Menu& contrast_menu() { return *m_contrast_menu; }
+ WebView::Menu& motion_menu() { return *m_motion_menu; }
+ WebView::Menu& bookmarks_menu() { return *m_bookmarks_menu; }
+ WebView::Menu& show_bookmarks_bar_menu() { return *m_show_bookmarks_bar_menu; }
+ WebView::Menu& history_menu() { return *m_history_menu; }
+ WebView::Menu& inspect_menu() { return *m_inspect_menu; }
+ WebView::Menu& debug_menu() { return *m_debug_menu; }
+
+private:
+ static void apply_state(WebView::Action&, Hub::ActionState const&);
+
+ HashMap<u64, WeakPtr<WebView::Action>> m_actions;
+
+ RefPtr<WebView::Action> m_reload_action;
+ RefPtr<WebView::Action> m_reload_bypassing_cache_action;
+ RefPtr<WebView::Action> m_copy_selection_action;
+ RefPtr<WebView::Action> m_undo_action;
+ RefPtr<WebView::Action> m_redo_action;
+ RefPtr<WebView::Action> m_cut_selection_action;
+ RefPtr<WebView::Action> m_paste_action;
+ RefPtr<WebView::Action> m_select_all_action;
+ RefPtr<WebView::Action> m_open_about_page_action;
+ RefPtr<WebView::Action> m_open_downloads_page_action;
+ RefPtr<WebView::Action> m_open_settings_page_action;
+ RefPtr<WebView::Action> m_zoom_in_action;
+ RefPtr<WebView::Action> m_zoom_out_action;
+ RefPtr<WebView::Action> m_reset_zoom_action;
+ RefPtr<WebView::Action> m_force_dark_action;
+ RefPtr<WebView::Action> m_toggle_vertical_tabs_expanded_action;
+ RefPtr<WebView::Action> m_toggle_menu_bar_action;
+ RefPtr<WebView::Action> m_toggle_bookmark_bar_action;
+ RefPtr<WebView::Action> m_view_source_action;
+ RefPtr<WebView::Action> m_report_website_issue_action;
+
+ RefPtr<WebView::Menu> m_zoom_menu;
+ RefPtr<WebView::Menu> m_color_scheme_menu;
+ RefPtr<WebView::Menu> m_contrast_menu;
+ RefPtr<WebView::Menu> m_motion_menu;
+ RefPtr<WebView::Menu> m_bookmarks_menu;
+ RefPtr<WebView::Menu> m_show_bookmarks_bar_menu;
+ RefPtr<WebView::Menu> m_history_menu;
+ RefPtr<WebView::Menu> m_inspect_menu;
+ RefPtr<WebView::Menu> m_debug_menu;
+};
+
+}
diff --git a/UI/Qt/RemoteView.cpp b/UI/Qt/RemoteView.cpp
index 0b2becd7d07..7ce20cad927 100644
--- a/UI/Qt/RemoteView.cpp
+++ b/UI/Qt/RemoteView.cpp
@@ -5,7 +5,9 @@
*/
#include <AK/HashMap.h>
+#include <Hub/ActionMirror.h>
#include <Hub/Application.h>
+#include <UI/Qt/RemoteActions.h>
#include <UI/Qt/RemoteView.h>
namespace Ladybird {
@@ -25,15 +27,24 @@ RemoteView::RemoteView(Optional<u64> view_id, Hub::View::InitialState initial_st
m_view = &Hub::Application::the().create_view(move(initial_state));
}
m_view_id = m_view->view_id();
- m_view->attach_host(*this);
m_state = m_view->current_state();
+
+ auto actions = Hub::ActionMirror::the().view_actions(*m_view);
+ auto& remote_actions = RemoteActions::the();
+ m_navigate_back_action = remote_actions.action_for(actions.navigate_back_action);
+ m_navigate_forward_action = remote_actions.action_for(actions.navigate_forward_action);
+ m_toggle_bookmark_action = remote_actions.action_for(actions.toggle_bookmark_action);
+ m_reset_zoom_action = remote_actions.action_for(actions.reset_zoom_action);
+ m_bookmarks_bar_context_menu = remote_actions.menu_for(actions.bookmarks_bar_context_menu);
+ m_bookmark_context_menu = remote_actions.menu_for(actions.bookmark_context_menu);
+ m_bookmark_folder_context_menu = remote_actions.menu_for(actions.bookmark_folder_context_menu);
+
s_views.set(m_view_id, this);
}
RemoteView::~RemoteView()
{
s_views.remove(m_view_id);
- m_view->detach_from_host();
if (auto* hub = HubConnection::the_if_connected())
hub->async_destroy_view(m_view_id);
@@ -170,7 +181,21 @@ RemoteView* RemoteView::find(u64 view_id)
RemoteView& RemoteView::of(WebView::ViewImplementation const& view)
{
- return static_cast<RemoteView&>(*static_cast<Hub::View const&>(view).host());
+ auto* remote_view = of_if_any(view);
+ VERIFY(remote_view);
+ return *remote_view;
+}
+
+RemoteView* RemoteView::of_if_any(WebView::ViewImplementation const& view)
+{
+ return find(view.view_id());
+}
+
+void RemoteView::did_request_context_menu(Vector<Hub::MenuEntry> const& entries, Gfx::IntPoint widget_position)
+{
+ // NB: The menu has to outlive this call, since the view may show it later.
+ m_context_menu = RemoteActions::the().menu_for(entries);
+ show_context_menu(*m_context_menu, widget_position);
}
}
diff --git a/UI/Qt/RemoteView.h b/UI/Qt/RemoteView.h
index f9eafc8bb53..139420a5473 100644
--- a/UI/Qt/RemoteView.h
+++ b/UI/Qt/RemoteView.h
@@ -15,7 +15,7 @@ namespace Ladybird {
// The UI's side of a tab's view. The view itself lives in the Hub. This holds what the UI needs to show it, and offers
// the rest of the UI the calls and callbacks that it takes to use the view.
-class RemoteView : public Hub::ViewHost {
+class RemoteView {
public:
using InputMethodState = WebView::ViewImplementation::InputMethodState;
using NavigationListener = WebView::ViewImplementation::NavigationListener;
@@ -25,12 +25,17 @@ public:
// Shows the view that the Hub has made, if any, or else makes a new one.
RemoteView(Optional<u64> view_id, Hub::View::InitialState);
- virtual ~RemoteView() override;
+ virtual ~RemoteView();
// The UI's side of a view that the UI shows.
static RemoteView& of(WebView::ViewImplementation const&);
static RemoteView* find(u64 view_id);
+ // The view of the UI that shows a view of the Hub, if any.
+ static RemoteView* of_if_any(WebView::ViewImplementation const&);
+
+ void did_request_context_menu(Vector<Hub::MenuEntry> const&, Gfx::IntPoint widget_position);
+
void set_state(Hub::ViewState state) { m_state = move(state); }
void set_initial_state(Hub::ViewState state) { m_state = move(state); }
@@ -162,13 +167,13 @@ public:
bool needs_beforeunload_check() const { return m_view->needs_beforeunload_check(); }
u64 add_navigation_listener(NavigationListener);
void remove_navigation_listener(u64 listener_id) { m_navigation_listeners.remove(listener_id); }
- WebView::Menu& bookmarks_bar_context_menu() { return m_view->bookmarks_bar_context_menu(); }
- WebView::Menu& bookmark_context_menu() { return m_view->bookmark_context_menu(); }
- WebView::Menu& bookmark_folder_context_menu() { return m_view->bookmark_folder_context_menu(); }
- WebView::Action& navigate_back_action() { return m_view->navigate_back_action(); }
- WebView::Action& navigate_forward_action() { return m_view->navigate_forward_action(); }
- WebView::Action& toggle_bookmark_action() { return m_view->toggle_bookmark_action(); }
- WebView::Action& reset_zoom_action() { return m_view->reset_zoom_action(); }
+ WebView::Menu& bookmarks_bar_context_menu() { return *m_bookmarks_bar_context_menu; }
+ WebView::Menu& bookmark_context_menu() { return *m_bookmark_context_menu; }
+ WebView::Menu& bookmark_folder_context_menu() { return *m_bookmark_folder_context_menu; }
+ WebView::Action& navigate_back_action() { return *m_navigate_back_action; }
+ WebView::Action& navigate_forward_action() { return *m_navigate_forward_action; }
+ WebView::Action& toggle_bookmark_action() { return *m_toggle_bookmark_action; }
+ WebView::Action& reset_zoom_action() { return *m_reset_zoom_action; }
WebView::PageTranslation& page_translation() { return m_view->page_translation(); }
WebView::WebContentPage& page() const { return m_view->page(); }
@@ -199,6 +204,7 @@ public:
u64 backing_stores_page_id() const { return m_backing_stores_page_id; }
protected:
+ virtual void show_context_menu(WebView::Menu&, Gfx::IntPoint) { }
virtual void did_accept_presented_backing_store(i32, Gfx::IntRect) { }
virtual void release_backing_store(u64 page_id, i32 bitmap_id) { release_backing_store_to_page(page_id, bitmap_id); }
@@ -211,6 +217,16 @@ protected:
private:
Hub::View* m_view { nullptr };
+
+ RefPtr<WebView::Action> m_navigate_back_action;
+ RefPtr<WebView::Action> m_navigate_forward_action;
+ RefPtr<WebView::Action> m_toggle_bookmark_action;
+ RefPtr<WebView::Action> m_reset_zoom_action;
+ RefPtr<WebView::Menu> m_bookmarks_bar_context_menu;
+ RefPtr<WebView::Menu> m_bookmark_context_menu;
+ RefPtr<WebView::Menu> m_bookmark_folder_context_menu;
+ RefPtr<WebView::Menu> m_context_menu;
+
u64 m_view_id { 0 };
WebView::IsPrivate m_is_private { WebView::IsPrivate::No };
double m_device_pixel_ratio { 1.0 };
diff --git a/UI/Qt/Tab.cpp b/UI/Qt/Tab.cpp
index d919d533d76..d52dd32081f 100644
--- a/UI/Qt/Tab.cpp
+++ b/UI/Qt/Tab.cpp
@@ -26,6 +26,7 @@
#include <UI/Qt/Icon.h>
#include <UI/Qt/JavaScriptDialog.h>
#include <UI/Qt/LadybirdButton.h>
+#include <UI/Qt/RemoteActions.h>
#if defined(AK_OS_MACOS)
# include <UI/Qt/MacWindow.h>
#endif
@@ -870,7 +871,7 @@ void Tab::initialize(Optional<u64> hub_view_id)
void Tab::create_tab_context_menu()
{
- auto& application = WebView::Application::the();
+ auto& application = RemoteActions::the();
auto* duplicate_tab_action = new QAction("&Duplicate Tab", this);
QObject::connect(duplicate_tab_action, &QAction::triggered, this, [this]() {
diff --git a/UI/Qt/TabBar.cpp b/UI/Qt/TabBar.cpp
index ab3117d8eca..b47fe5f7df1 100644
--- a/UI/Qt/TabBar.cpp
+++ b/UI/Qt/TabBar.cpp
@@ -21,6 +21,7 @@
#include <UI/Qt/ChromeStyle.h>
#include <UI/Qt/Icon.h>
#include <UI/Qt/LadybirdButton.h>
+#include <UI/Qt/RemoteActions.h>
#if defined(AK_OS_MACOS)
# include <UI/Qt/MacWindow.h>
#endif
@@ -3399,7 +3400,7 @@ TabWidget::TabWidget(WebView::IsPrivate is_private, QWidget* parent)
m_vertical_tabs_toggle_button = new ChromeHeaderButton(m_vertical_tab_bar_column);
m_vertical_tabs_toggle_button->setObjectName("LadybirdVerticalTabsToggleButton");
- m_vertical_tabs_toggle_button->setDefaultAction(create_application_action(*this, Application::hub().toggle_vertical_tabs_expanded_action()));
+ m_vertical_tabs_toggle_button->setDefaultAction(create_application_action(*this, RemoteActions::the().toggle_vertical_tabs_expanded_action()));
m_vertical_tabs_toggle_button->setAutoRaise(true);
m_vertical_tabs_toggle_button->setFocusPolicy(Qt::NoFocus);
m_vertical_tabs_toggle_button->setIconSize({ 16, 16 });
diff --git a/UI/Qt/WebContentView.h b/UI/Qt/WebContentView.h
index 8d824bb6731..9071370e2d4 100644
--- a/UI/Qt/WebContentView.h
+++ b/UI/Qt/WebContentView.h
@@ -218,10 +218,8 @@ signals:
void urls_dropped(QList<QUrl> const&);
private:
- // ^Hub::ViewHost
- virtual void show_context_menu(WebView::Menu&, Gfx::IntPoint widget_position) override;
-
// ^RemoteView
+ virtual void show_context_menu(WebView::Menu&, Gfx::IntPoint widget_position) override;
virtual Optional<ScreenRects> screen_rects() const override;
virtual void update_zoom() override;
virtual void did_accept_presented_backing_store(i32, Gfx::IntRect) override;
diff --git a/UI/Qt/WindowToolbar.cpp b/UI/Qt/WindowToolbar.cpp
index be47be8280c..09613456a7a 100644
--- a/UI/Qt/WindowToolbar.cpp
+++ b/UI/Qt/WindowToolbar.cpp
@@ -29,6 +29,7 @@
#include <UI/Qt/Motion.h>
#include <UI/Qt/PerformanceMonitorWidget.h>
#include <UI/Qt/Popover.h>
+#include <UI/Qt/RemoteActions.h>
#include <UI/Qt/StringUtils.h>
#include <UI/Qt/SystemAppearance.h>
#include <UI/Qt/Theme.h>
@@ -1155,7 +1156,7 @@ WindowToolbar::WindowToolbar(WebView::IsPrivate is_private, QWidget* parent)
: QWidget(parent)
, m_is_private(is_private)
{
- auto& application = WebView::Application::the();
+ auto& application = RemoteActions::the();
setObjectName("LadybirdToolbarContainer");
// NB: The style sheet paints the toolbar's background, which a QWidget subclass only draws when asked to.