1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 15:57:34 +00:00

LibWebView+WebContent: Add a WebContent IPC to clone a DOM node

This commit is contained in:
Timothy Flynn 2023-12-07 11:12:43 -05:00 committed by Andreas Kling
parent 111e53a2f6
commit c6a11a77b5
5 changed files with 20 additions and 0 deletions

View file

@ -745,6 +745,18 @@ Messages::WebContentServer::CreateChildTextNodeResponse ConnectionFromClient::cr
return text_node->unique_id();
}
Messages::WebContentServer::CloneDomNodeResponse ConnectionFromClient::clone_dom_node(i32 node_id)
{
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
if (!dom_node || !dom_node->parent_node())
return OptionalNone {};
auto dom_node_clone = dom_node->clone_node(nullptr, true);
dom_node->parent_node()->insert_before(dom_node_clone, dom_node->next_sibling());
return dom_node_clone->unique_id();
}
void ConnectionFromClient::remove_dom_node(i32 node_id)
{
auto* active_document = page().page().top_level_browsing_context().active_document();