1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

LibWeb+LibWebView+WebContent: Add an Inspector IDL object to the Window

This is an internal object that must be explicitly enabled by the chrome
before it is added to the Window. The Inspector object will be used by a
special WebView that will replace all chrome-specific inspector windows.
The IDL defines methods that this WebView will need to inform the chrome
of various events, such as the user clicking a DOM node.
This commit is contained in:
Timothy Flynn 2023-11-23 12:22:23 -05:00 committed by Andreas Kling
parent 30e96749de
commit ffdc2d8add
21 changed files with 156 additions and 1 deletions

View file

@ -383,4 +383,9 @@ void ViewImplementation::use_native_user_style_sheet()
set_user_style_sheet(MUST(String::from_utf8(native_stylesheet_source)));
}
void ViewImplementation::enable_inspector_prototype()
{
client().async_enable_inspector_prototype();
}
}

View file

@ -106,6 +106,8 @@ public:
// native GUI widgets as possible.
void use_native_user_style_sheet();
void enable_inspector_prototype();
Function<void(Gfx::IntSize)> on_did_layout;
Function<void()> on_ready_to_paint;
Function<String(Web::HTML::ActivateTab)> on_new_tab;
@ -161,6 +163,8 @@ public:
Function<void()> on_text_test_finish;
Function<void(Gfx::Color)> on_theme_color_change;
Function<void(String const&, String const&, String const&)> on_insert_clipboard_entry;
Function<void()> on_inspector_loaded;
Function<void(i32, Optional<Web::CSS::Selector::PseudoElement> const&)> on_inspector_selected_dom_node;
virtual Gfx::IntRect viewport_rect() const = 0;
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const = 0;

View file

@ -402,4 +402,16 @@ void WebContentClient::did_insert_clipboard_entry(String const& data, String con
m_view.on_insert_clipboard_entry(data, presentation_style, mime_type);
}
void WebContentClient::inspector_did_load()
{
if (m_view.on_inspector_loaded)
m_view.on_inspector_loaded();
}
void WebContentClient::inspector_did_select_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> const& pseudo_element)
{
if (m_view.on_inspector_selected_dom_node)
m_view.on_inspector_selected_dom_node(node_id, pseudo_element);
}
}

View file

@ -86,6 +86,8 @@ private:
virtual void did_finish_text_test() override;
virtual void did_change_theme_color(Gfx::Color color) override;
virtual void did_insert_clipboard_entry(String const& data, String const& presentation_style, String const& mime_type) override;
virtual void inspector_did_load() override;
virtual void inspector_did_select_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> const& pseudo_element) override;
ViewImplementation& m_view;
};