mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
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:
parent
a4a15b9a1e
commit
e57176b484
Notes:
github-actions[bot]
2025-10-10 19:11:12 +00:00
Author: https://github.com/trflynn89
Commit: e57176b484
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6438
9 changed files with 247 additions and 22 deletions
|
@ -625,6 +625,27 @@ void Application::display_error_dialog(StringView error_message) const
|
|||
warnln("{}", error_message);
|
||||
}
|
||||
|
||||
Utf16String Application::clipboard_text() const
|
||||
{
|
||||
if (!m_clipboard.has_value())
|
||||
return {};
|
||||
if (m_clipboard->mime_type != "text/plain"sv)
|
||||
return {};
|
||||
return Utf16String::from_utf8(m_clipboard->data);
|
||||
}
|
||||
|
||||
Vector<Web::Clipboard::SystemClipboardRepresentation> Application::clipboard_entries() const
|
||||
{
|
||||
if (!m_clipboard.has_value())
|
||||
return {};
|
||||
return { *m_clipboard };
|
||||
}
|
||||
|
||||
void Application::insert_clipboard_entry(Web::Clipboard::SystemClipboardRepresentation entry)
|
||||
{
|
||||
m_clipboard = move(entry);
|
||||
}
|
||||
|
||||
void Application::initialize_actions()
|
||||
{
|
||||
auto debug_request = [this](auto request) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue