1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

LibWeb+LibWebView+WebContent: Add Inspector IPCs to manipulate DOM nodes

This adds the IDL methods and IPC to forward DOM-editing events from the
Inspector WebView to the Inspector client.
This commit is contained in:
Timothy Flynn 2023-12-03 11:49:08 -05:00 committed by Andreas Kling
parent 4cfeb41c4b
commit 1236cbd41a
10 changed files with 91 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#include <LibWeb/Bindings/InspectorPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/DOM/NamedNodeMap.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Internals/Inspector.h>
@ -47,6 +48,24 @@ void Inspector::inspect_dom_node(i32 node_id, Optional<i32> const& pseudo_elemen
}
}
void Inspector::set_dom_node_text(i32 node_id, String const& text)
{
if (auto* page = global_object().browsing_context()->page())
page->client().inspector_did_set_dom_node_text(node_id, text);
}
void Inspector::set_dom_node_tag(i32 node_id, String const& tag)
{
if (auto* page = global_object().browsing_context()->page())
page->client().inspector_did_set_dom_node_tag(node_id, tag);
}
void Inspector::replace_dom_node_attribute(i32 node_id, String const& name, JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes)
{
if (auto* page = global_object().browsing_context()->page())
page->client().inspector_did_replace_dom_node_attribute(node_id, name, replacement_attributes);
}
void Inspector::execute_console_script(String const& script)
{
if (auto* page = global_object().browsing_context()->page())