1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

Browser: Add "Inspect Element" to context menu :^)

This opens the DOM Inspector window, with the target element already
selected. (If the window is already open, it just selects the element.)

Note that this only applies to single-process mode for now. In OOP mode,
the "inspect element" action is disabled.
This commit is contained in:
Sam Atkins 2021-08-17 17:00:27 +01:00 committed by Andreas Kling
parent 8eef509c1b
commit 37f060b873
6 changed files with 69 additions and 19 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include "BookmarksBarWidget.h"
#include "Tab.h"
#include "WindowActions.h"
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Window.h>
@ -34,6 +35,7 @@ public:
GUI::Action& select_all_action() { return *m_select_all_action; }
GUI::Action& view_source_action() { return *m_view_source_action; }
GUI::Action& inspect_dom_tree_action() { return *m_inspect_dom_tree_action; }
GUI::Action& inspect_dom_node_action() { return *m_inspect_dom_node_action; }
private:
explicit BrowserWindow(CookieJar&, URL);
@ -49,6 +51,7 @@ private:
RefPtr<GUI::Action> m_select_all_action;
RefPtr<GUI::Action> m_view_source_action;
RefPtr<GUI::Action> m_inspect_dom_tree_action;
RefPtr<GUI::Action> m_inspect_dom_node_action;
CookieJar& m_cookie_jar;
WindowActions m_window_actions;