1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00
serenity/Userland/Libraries/LibWeb/Internals/Inspector.h
Timothy Flynn 2633ea8c79 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.
2023-12-06 13:04:50 +01:00

38 lines
1.1 KiB
C++

/*
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Forward.h>
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::Internals {
class Inspector final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(Inspector, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(Inspector);
public:
virtual ~Inspector() override;
void inspector_loaded();
void inspect_dom_node(i32 node_id, Optional<i32> const& pseudo_element);
void set_dom_node_text(i32 node_id, String const& text);
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:
explicit Inspector(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}