LibWebView: Move headless clipboard management to LibWebView

We only supported headless clipboard management in test-web. So when WPT
tests the clipboard APIs, we would blindly try to access the Qt app,
which does not exist.

Note that the AppKit UI has no such restriction, as the NSPasteboard is
accessible even without a GUI.
This commit is contained in:
Timothy Flynn 2025-10-10 10:11:56 -04:00 committed by Tim Flynn
parent a4a15b9a1e
commit e57176b484
Notes: github-actions[bot] 2025-10-10 19:11:12 +00:00
9 changed files with 247 additions and 22 deletions

View file

@ -76,9 +76,10 @@ public:
virtual void display_download_confirmation_dialog(StringView download_name, LexicalPath const& path) const;
virtual void display_error_dialog(StringView error_message) const;
virtual Utf16String clipboard_text() const { return {}; }
virtual Vector<Web::Clipboard::SystemClipboardRepresentation> clipboard_entries() const { return {}; }
virtual void insert_clipboard_entry(Web::Clipboard::SystemClipboardRepresentation) { }
// FIXME: We should implement UI-agnostic platform APIs to interact with the system clipboard.
virtual Utf16String clipboard_text() const;
virtual Vector<Web::Clipboard::SystemClipboardRepresentation> clipboard_entries() const;
virtual void insert_clipboard_entry(Web::Clipboard::SystemClipboardRepresentation);
Action& reload_action() { return *m_reload_action; }
Action& copy_selection_action() { return *m_copy_selection_action; }
@ -221,6 +222,8 @@ private:
StringView m_user_agent_string;
StringView m_navigator_compatibility_mode;
Optional<Web::Clipboard::SystemClipboardRepresentation> m_clipboard;
#if defined(AK_OS_MACOS)
OwnPtr<MachPortServer> m_mach_port_server;
#endif