mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +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
|
@ -4,8 +4,10 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibGfx/Point.h>
|
||||
#include <LibWebView/ViewImplementation.h>
|
||||
|
||||
#pragma once
|
||||
|
@ -24,6 +26,10 @@ public:
|
|||
void select_default_node();
|
||||
void clear_selection();
|
||||
|
||||
Function<void(Gfx::IntPoint)> on_requested_dom_node_text_context_menu;
|
||||
Function<void(Gfx::IntPoint, String const&)> on_requested_dom_node_tag_context_menu;
|
||||
Function<void(Gfx::IntPoint, String const&)> on_requested_dom_node_attribute_context_menu;
|
||||
|
||||
private:
|
||||
void load_inspector();
|
||||
|
||||
|
@ -50,6 +56,9 @@ private:
|
|||
|
||||
bool m_dom_tree_loaded { false };
|
||||
|
||||
Optional<i32> m_context_menu_dom_node_id;
|
||||
Optional<String> m_context_menu_tag_or_attribute_name;
|
||||
|
||||
i32 m_highest_notified_message_index { -1 };
|
||||
i32 m_highest_received_message_index { -1 };
|
||||
bool m_waiting_for_messages { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue