1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 00:47:45 +00:00

Ladybird: Move ownership of the JS console/inspector to the tab object

This is to match Browser, where ownership of all "subwidgets" is placed
on the tab as well. This further lets us align the web view callbacks to
match Browser's OOPWV as well, which will later let us move them into
the base LibWebView class.
This commit is contained in:
Timothy Flynn 2023-05-17 11:54:36 -04:00 committed by Andreas Kling
parent 2d51b8c286
commit c113d780c6
9 changed files with 147 additions and 134 deletions

View file

@ -19,10 +19,16 @@
class BrowserWindow;
namespace Ladybird {
class ConsoleWidget;
class InspectorWidget;
}
class Tab final : public QWidget {
Q_OBJECT
public:
Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling);
virtual ~Tab() override;
WebContentView& view() { return *m_view; }
@ -36,6 +42,15 @@ public:
void update_reset_zoom_button();
enum class InspectorTarget {
Document,
HoveredElement
};
void show_inspector_window(InspectorTarget = InspectorTarget::Document);
void show_console_window();
Ladybird::ConsoleWidget* console() { return m_console_widget; };
public slots:
void focus_location_editor();
void location_edit_return_pressed();
@ -60,6 +75,8 @@ private:
void open_link_in_new_tab(URL const&);
void copy_link_url(URL const&);
void close_sub_widgets();
QBoxLayout* m_layout;
QToolBar* m_toolbar { nullptr };
QToolButton* m_reset_zoom_button { nullptr };
@ -91,4 +108,7 @@ private:
int tab_index();
bool m_is_history_navigation { false };
Ladybird::ConsoleWidget* m_console_widget { nullptr };
Ladybird::InspectorWidget* m_inspector_widget { nullptr };
};