mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibDevTools+LibWebView: Implement requests to clone DOM nodes
This commit is contained in:
parent
ffd48e1d45
commit
c4b1d2382a
Notes:
github-actions[bot]
2025-03-08 00:26:54 +00:00
Author: https://github.com/trflynn89
Commit: c4b1d2382a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3850
4 changed files with 36 additions and 0 deletions
|
@ -73,6 +73,33 @@ void WalkerActor::handle_message(StringView type, JsonObject const& message)
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == "duplicateNode"sv) {
|
||||
auto node = message.get_string("node"sv);
|
||||
if (!node.has_value()) {
|
||||
send_missing_parameter_error("node"sv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto dom_node = WalkerActor::dom_node_for(*this, *node); dom_node.has_value()) {
|
||||
auto block_token = block_responses();
|
||||
|
||||
devtools().delegate().clone_dom_node(
|
||||
dom_node->tab->description(), dom_node->identifier.id,
|
||||
[weak_self = make_weak_ptr<WalkerActor>(), block_token = move(block_token)](ErrorOr<Web::UniqueNodeID> node_id) mutable {
|
||||
if (node_id.is_error()) {
|
||||
dbgln_if(DEVTOOLS_DEBUG, "Unable to edit DOM node: {}", node_id.error());
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto self = weak_self.strong_ref()) {
|
||||
JsonObject message;
|
||||
message.set("from"sv, self->name());
|
||||
self->send_message(move(message), move(block_token));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (type == "editTagName"sv) {
|
||||
auto node = message.get_string("node"sv);
|
||||
if (!node.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue