mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb+WebContent: Add inspect_dom_node() IPC call
This is the IPC version of `Document::set_inspected_node()`, using a node ID. We return the inspected node's style properties as JSON, so that the DOM Inspector can immediately display them.
This commit is contained in:
committed by
Andreas Kling
parent
e824454ab4
commit
f381f8d63e
Notes:
sideshowbarker
2024-07-18 04:51:57 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/f381f8d63e7 Pull-request: https://github.com/SerenityOS/serenity/pull/9725 Issue: https://github.com/SerenityOS/serenity/issues/8935 Reviewed-by: https://github.com/awesomekling
@@ -402,6 +402,22 @@ void OutOfProcessWebView::inspect_dom_tree()
|
||||
client().async_inspect_dom_tree();
|
||||
}
|
||||
|
||||
Optional<OutOfProcessWebView::DOMNodeProperties> OutOfProcessWebView::inspect_dom_node(i32 node_id)
|
||||
{
|
||||
auto response = client().inspect_dom_node(node_id);
|
||||
if (!response.has_style())
|
||||
return {};
|
||||
return DOMNodeProperties {
|
||||
.specified_values_json = response.specified_style(),
|
||||
.computed_values_json = response.computed_style()
|
||||
};
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::clear_inspected_dom_node()
|
||||
{
|
||||
client().inspect_dom_node(0);
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::js_console_initialize()
|
||||
{
|
||||
client().async_js_console_initialize();
|
||||
|
||||
Reference in New Issue
Block a user