summaryrefslogtreecommitdiff
path: root/Applications/Browser
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-09 11:58:50 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-09 11:58:50 +0100
commit70a4678d77a2ff93022f6bcd3e707142f7f3e35f (patch)
tree2fe662a23964a4dd80e12377fc5ccd9180617ec1 /Applications/Browser
parent7fcb21c935a125398a40203747cfa73ca35b7728 (diff)
downloadserenity-70a4678d77a2ff93022f6bcd3e707142f7f3e35f.zip
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.
Diffstat (limited to 'Applications/Browser')
-rw-r--r--Applications/Browser/main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp
index b17894207c..623a4ca929 100644
--- a/Applications/Browser/main.cpp
+++ b/Applications/Browser/main.cpp
@@ -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())