mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibDevTools+LibWebView+WebContent: Implement moving DOM nodes
This allows for click-and-dragging DOM nodes in DevTools to move them.
This commit is contained in:
parent
01c44a5c66
commit
cbefa797d4
Notes:
github-actions[bot]
2025-03-11 13:51:48 +00:00
Author: https://github.com/trflynn89
Commit: cbefa797d4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3898
9 changed files with 88 additions and 0 deletions
|
@ -849,6 +849,30 @@ void ConnectionFromClient::create_child_text_node(u64 page_id, Web::UniqueNodeID
|
|||
async_did_finish_editing_dom_node(page_id, text_node->unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::insert_dom_node_before(u64 page_id, Web::UniqueNodeID node_id, Web::UniqueNodeID parent_node_id, Optional<Web::UniqueNodeID> sibling_node_id)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
auto* parent_dom_node = Web::DOM::Node::from_unique_id(parent_node_id);
|
||||
|
||||
if (!dom_node || !parent_dom_node) {
|
||||
async_did_finish_editing_dom_node(page_id, {});
|
||||
return;
|
||||
}
|
||||
|
||||
GC::Ptr<Web::DOM::Node> sibling_dom_node;
|
||||
if (sibling_node_id.has_value()) {
|
||||
sibling_dom_node = Web::DOM::Node::from_unique_id(*sibling_node_id);
|
||||
|
||||
if (!sibling_dom_node) {
|
||||
async_did_finish_editing_dom_node(page_id, {});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
parent_dom_node->insert_before(*dom_node, sibling_dom_node);
|
||||
async_did_finish_editing_dom_node(page_id, dom_node->unique_id());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::clone_dom_node(u64 page_id, Web::UniqueNodeID node_id)
|
||||
{
|
||||
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue