mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibWeb+WebContent: Add query for hovered DOM node to OOPWV
This is needed for the "Inspect Element" context menu action.
This commit is contained in:
parent
3b07f49d48
commit
1ccf10789e
5 changed files with 18 additions and 0 deletions
|
@ -424,6 +424,11 @@ void OutOfProcessWebView::clear_inspected_dom_node()
|
||||||
client().inspect_dom_node(0);
|
client().inspect_dom_node(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i32 OutOfProcessWebView::get_hovered_node_id()
|
||||||
|
{
|
||||||
|
return client().get_hovered_node_id();
|
||||||
|
}
|
||||||
|
|
||||||
void OutOfProcessWebView::js_console_initialize()
|
void OutOfProcessWebView::js_console_initialize()
|
||||||
{
|
{
|
||||||
client().async_js_console_initialize();
|
client().async_js_console_initialize();
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
};
|
};
|
||||||
Optional<DOMNodeProperties> inspect_dom_node(i32 node_id);
|
Optional<DOMNodeProperties> inspect_dom_node(i32 node_id);
|
||||||
void clear_inspected_dom_node();
|
void clear_inspected_dom_node();
|
||||||
|
i32 get_hovered_node_id();
|
||||||
|
|
||||||
void js_console_initialize();
|
void js_console_initialize();
|
||||||
void js_console_input(const String& js_source);
|
void js_console_input(const String& js_source);
|
||||||
|
|
|
@ -261,6 +261,16 @@ Messages::WebContentServer::InspectDomNodeResponse ClientConnection::inspect_dom
|
||||||
return { false, "", "" };
|
return { false, "", "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Messages::WebContentServer::GetHoveredNodeIdResponse ClientConnection::get_hovered_node_id()
|
||||||
|
{
|
||||||
|
if (auto* document = page().top_level_browsing_context().document()) {
|
||||||
|
auto hovered_node = document->hovered_node();
|
||||||
|
if (hovered_node)
|
||||||
|
return hovered_node->id();
|
||||||
|
}
|
||||||
|
return (i32)0;
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::js_console_initialize()
|
void ClientConnection::js_console_initialize()
|
||||||
{
|
{
|
||||||
if (auto* document = page().top_level_browsing_context().document()) {
|
if (auto* document = page().top_level_browsing_context().document()) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
virtual void get_source() override;
|
virtual void get_source() override;
|
||||||
virtual void inspect_dom_tree() override;
|
virtual void inspect_dom_tree() override;
|
||||||
virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32) override;
|
virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32) override;
|
||||||
|
virtual Messages::WebContentServer::GetHoveredNodeIdResponse get_hovered_node_id() override;
|
||||||
virtual void js_console_initialize() override;
|
virtual void js_console_initialize() override;
|
||||||
virtual void js_console_input(String const&) override;
|
virtual void js_console_input(String const&) override;
|
||||||
virtual void run_javascript(String const&) override;
|
virtual void run_javascript(String const&) override;
|
||||||
|
|
|
@ -28,6 +28,7 @@ endpoint WebContentServer
|
||||||
get_source() =|
|
get_source() =|
|
||||||
inspect_dom_tree() =|
|
inspect_dom_tree() =|
|
||||||
inspect_dom_node(i32 node_id) => (bool has_style, String specified_style, String computed_style)
|
inspect_dom_node(i32 node_id) => (bool has_style, String specified_style, String computed_style)
|
||||||
|
get_hovered_node_id() => (i32 node_id)
|
||||||
js_console_initialize() =|
|
js_console_initialize() =|
|
||||||
js_console_input(String js_source) =|
|
js_console_input(String js_source) =|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue