mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +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
Notes:
sideshowbarker
2024-07-18 04:51:46 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/1ccf10789e3 Pull-request: https://github.com/SerenityOS/serenity/pull/9725 Issue: https://github.com/SerenityOS/serenity/issues/8935 Reviewed-by: https://github.com/awesomekling
5 changed files with 18 additions and 0 deletions
|
@ -424,6 +424,11 @@ void OutOfProcessWebView::clear_inspected_dom_node()
|
|||
client().inspect_dom_node(0);
|
||||
}
|
||||
|
||||
i32 OutOfProcessWebView::get_hovered_node_id()
|
||||
{
|
||||
return client().get_hovered_node_id();
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::js_console_initialize()
|
||||
{
|
||||
client().async_js_console_initialize();
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
};
|
||||
Optional<DOMNodeProperties> inspect_dom_node(i32 node_id);
|
||||
void clear_inspected_dom_node();
|
||||
i32 get_hovered_node_id();
|
||||
|
||||
void js_console_initialize();
|
||||
void js_console_input(const String& js_source);
|
||||
|
|
|
@ -261,6 +261,16 @@ Messages::WebContentServer::InspectDomNodeResponse ClientConnection::inspect_dom
|
|||
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()
|
||||
{
|
||||
if (auto* document = page().top_level_browsing_context().document()) {
|
||||
|
|
|
@ -50,6 +50,7 @@ private:
|
|||
virtual void get_source() override;
|
||||
virtual void inspect_dom_tree() 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_input(String const&) override;
|
||||
virtual void run_javascript(String const&) override;
|
||||
|
|
|
@ -28,6 +28,7 @@ endpoint WebContentServer
|
|||
get_source() =|
|
||||
inspect_dom_tree() =|
|
||||
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_input(String js_source) =|
|
||||
|
||||
|
|
Loading…
Reference in a new issue