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

Ladybird: Reimplement the DOM inspector :^)

This has been broken since the switch to the multiprocess architecture
(and even before then was very limited).

This restores the previous functionally and also implements the ability
to inspect individual elements (by selecting them in the tree view).
The inspector also now correctly updates when navigating between pages.
This commit is contained in:
MacDue 2022-12-18 00:50:53 +00:00 committed by Andrew Kaster
parent 0313814d3b
commit aa85a88158
5 changed files with 176 additions and 24 deletions

View file

@ -16,6 +16,7 @@
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
#include <LibGfx/StandardCursor.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWebView/ViewImplementation.h>
#include <LibWeb/Forward.h>
@ -27,6 +28,7 @@ class QLineEdit;
namespace Ladybird {
class ConsoleWidget;
class InspectorWidget;
}
namespace WebView {
@ -185,13 +187,19 @@ private:
void ensure_js_console_widget();
void ensure_inspector_widget();
bool is_inspector_open() const;
void inspect_dom_tree();
void inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element);
void clear_inspected_dom_node();
void clear_inspector_callbacks();
qreal m_inverse_pixel_scaling_ratio { 1.0 };
bool m_should_show_line_box_borders { false };
QPointer<QWidget> m_inspector_widget;
QPointer<QDialog> m_dialog;
Ladybird::ConsoleWidget* m_console_widget { nullptr };
Ladybird::InspectorWidget* m_inspector_widget { nullptr };
Gfx::IntRect m_viewport_rect;