1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibWebView+WebContent: Make the DOM node HTML retrieval IPC async

This commit is contained in:
Timothy Flynn 2023-12-30 14:32:50 -05:00 committed by Andreas Kling
parent c190294a76
commit 93db790974
9 changed files with 24 additions and 13 deletions

View file

@ -100,6 +100,11 @@ InspectorClient::InspectorClient(ViewImplementation& content_web_view, ViewImple
inspect();
};
m_content_web_view.on_received_dom_node_html = [this](auto const& html) {
if (m_content_web_view.on_insert_clipboard_entry)
m_content_web_view.on_insert_clipboard_entry(html, "unspecified"_string, "text/plain"_string);
};
m_content_web_view.on_received_console_message = [this](auto message_index) {
handle_console_message(message_index);
};
@ -241,11 +246,7 @@ void InspectorClient::context_menu_copy_dom_node()
{
VERIFY(m_context_menu_data.has_value());
if (auto html = m_content_web_view.get_dom_node_html(m_context_menu_data->dom_node_id); html.has_value()) {
if (m_content_web_view.on_insert_clipboard_entry)
m_content_web_view.on_insert_clipboard_entry(*html, "unspecified"_string, "text/plain"_string);
}
m_content_web_view.get_dom_node_html(m_context_menu_data->dom_node_id);
m_context_menu_data.clear();
}