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

Ladybird: Add a very simple DOM inspector

We use a ModelTranslator to expose a DOMTreeModel from LibWebView :^)
It allows you to select the currently inspected node, which causes
the engine to render a little box model overlay above the web content.
This commit is contained in:
Andreas Kling 2022-09-25 12:17:53 +02:00 committed by Andrew Kaster
parent 98b6aea234
commit 5ac5fef468
5 changed files with 53 additions and 2 deletions

View file

@ -112,6 +112,16 @@ BrowserWindow::BrowserWindow()
}
});
auto* inspector_action = new QAction("Open &Inspector");
inspector_action->setIcon(QIcon(QString("%1/res/icons/browser/dom-tree.png").arg(s_serenity_resource_root.characters())));
inspector_action->setShortcut(QKeySequence("Ctrl+Shift+I"));
inspect_menu->addAction(inspector_action);
QObject::connect(inspector_action, &QAction::triggered, this, [this] {
if (m_current_tab) {
m_current_tab->view().show_inspector();
}
});
auto* debug_menu = menuBar()->addMenu("&Debug");
auto* dump_dom_tree_action = new QAction("Dump DOM Tree");