1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibHTML: Paint a magenta rectangle around the currently inspected node

Document now tracks one "inspected" node, set by set_inspected_node()
which is called by Browser's DOM inspector view on_selection callback.
This commit is contained in:
Andreas Kling 2019-11-09 11:58:50 +01:00
parent 7fcb21c935
commit 70a4678d77
5 changed files with 30 additions and 0 deletions

View file

@ -141,6 +141,10 @@ int main(int argc, char** argv)
dom_inspector_window->set_rect(100, 100, 300, 500);
dom_inspector_window->set_title("DOM inspector");
dom_tree_view = GTreeView::construct(nullptr);
dom_tree_view->on_selection = [](auto& index) {
auto* node = static_cast<Node*>(index.internal_data());
node->document().set_inspected_node(node);
};
dom_inspector_window->set_main_widget(dom_tree_view);
}
if (html_widget->document())