mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 14:40:18 +00:00
LibWebView+UI: Move clipboard handling from the WebView to the App
Clipboard handling largely has nothing to do with the individual web views. Rather, we interact with the system clipboard at the application level. So let's move these implementations to the Application.
This commit is contained in:
parent
4f31e492e7
commit
ca082d6d73
Notes:
github-actions[bot]
2025-09-19 10:39:59 +00:00
Author: https://github.com/trflynn89
Commit: ca082d6d73
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6228
15 changed files with 131 additions and 145 deletions
|
@ -663,19 +663,19 @@ void WebContentClient::did_change_theme_color(u64 page_id, Gfx::Color color)
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::did_insert_clipboard_entry(u64 page_id, Web::Clipboard::SystemClipboardRepresentation entry, String presentation_style)
|
||||
void WebContentClient::did_insert_clipboard_entry(u64, Web::Clipboard::SystemClipboardRepresentation entry, String)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_insert_clipboard_entry)
|
||||
view->on_insert_clipboard_entry(move(entry), presentation_style);
|
||||
}
|
||||
Application::the().insert_clipboard_entry(move(entry));
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_clipboard_entries(u64 page_id, u64 request_id)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_request_clipboard_entries)
|
||||
view->on_request_clipboard_entries(request_id);
|
||||
Vector<Web::Clipboard::SystemClipboardItem> items;
|
||||
if (auto entries = Application::the().clipboard_entries(); !entries.is_empty())
|
||||
items.empend(move(entries));
|
||||
|
||||
view->retrieved_clipboard_entries(request_id, items);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue