mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
LibWeb+LibWebView+WebContent: Add an Inspector IPC to open context menus
The Inspector will have context menu support to manipulate the DOM, e.g. adding or removing nodes/attributes. This context menu will require some detailed knowledge about what element in the Inspector has been clicked. To support this, we intercept the `contextmenu` event and collect the required information to be sent to the Inspector client over IPC.
This commit is contained in:
parent
2d69a009fb
commit
2633ea8c79
13 changed files with 89 additions and 1 deletions
|
@ -61,6 +61,11 @@ void Inspector::replace_dom_node_attribute(i32 node_id, String const& name, JS::
|
|||
global_object().browsing_context()->page().client().inspector_did_replace_dom_node_attribute(node_id, name, replacement_attributes);
|
||||
}
|
||||
|
||||
void Inspector::request_dom_tree_context_menu(i32 node_id, i32 client_x, i32 client_y, String const& type, Optional<String> const& tag_or_attribute_name)
|
||||
{
|
||||
global_object().browsing_context()->page().client().inspector_did_request_dom_tree_context_menu(node_id, { client_x, client_y }, type, tag_or_attribute_name);
|
||||
}
|
||||
|
||||
void Inspector::execute_console_script(String const& script)
|
||||
{
|
||||
global_object().browsing_context()->page().client().inspector_did_execute_console_script(script);
|
||||
|
|
|
@ -25,6 +25,8 @@ public:
|
|||
void set_dom_node_tag(i32 node_id, String const& tag);
|
||||
void replace_dom_node_attribute(i32 node_id, String const& name, JS::NonnullGCPtr<DOM::NamedNodeMap> replacement_attributes);
|
||||
|
||||
void request_dom_tree_context_menu(i32 node_id, i32 client_x, i32 client_y, String const& type, Optional<String> const& tag_or_attribute_name);
|
||||
|
||||
void execute_console_script(String const& script);
|
||||
|
||||
private:
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
undefined setDOMNodeTag(long nodeID, DOMString tag);
|
||||
undefined replaceDOMNodeAttribute(long nodeID, DOMString name, NamedNodeMap replacementAttributes);
|
||||
|
||||
undefined requestDOMTreeContextMenu(long nodeID, long clientX, long clientY, DOMString type, DOMString? tagOrAttributeName);
|
||||
|
||||
undefined executeConsoleScript(DOMString script);
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue