mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-11 21:52:53 +00:00
LibWebView+Ladybird: Move DOM inspection helpers to ViewImplementation
This commit is contained in:
parent
f313708237
commit
2428e3e675
Notes:
sideshowbarker
2024-07-17 01:47:17 +09:00
Author: https://github.com/linusg
Commit: 2428e3e675
Pull-request: https://github.com/SerenityOS/serenity/pull/16983
9 changed files with 56 additions and 96 deletions
|
@ -532,28 +532,6 @@ bool WebContentView::is_inspector_open() const
|
|||
return m_inspector_widget && m_inspector_widget->isVisible();
|
||||
}
|
||||
|
||||
void WebContentView::inspect_dom_tree()
|
||||
{
|
||||
client().async_inspect_dom_tree();
|
||||
}
|
||||
|
||||
ErrorOr<Ladybird::DOMNodeProperties> WebContentView::inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element)
|
||||
{
|
||||
auto response = client().inspect_dom_node(node_id, pseudo_element);
|
||||
if (!response.has_style())
|
||||
return Error::from_string_view("Inspected node returned no style"sv);
|
||||
return Ladybird::DOMNodeProperties {
|
||||
.computed_style_json = TRY(String::from_deprecated_string(response.take_computed_style())),
|
||||
.resolved_style_json = TRY(String::from_deprecated_string(response.take_resolved_style())),
|
||||
.custom_properties_json = TRY(String::from_deprecated_string(response.take_custom_properties())),
|
||||
};
|
||||
}
|
||||
|
||||
void WebContentView::clear_inspected_dom_node()
|
||||
{
|
||||
(void)inspect_dom_node(0, {});
|
||||
}
|
||||
|
||||
void WebContentView::show_inspector()
|
||||
{
|
||||
ensure_inspector_widget();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue