From b477aff843dce2b465ce351fb5e842c4c0cd3c27 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 29 Sep 2019 11:59:38 +0200 Subject: LibHTML: Detect hovering over links HtmlView now calls Node::enclosing_link_element() to find the nearest ancestor element. This patch also adds HTMLElement and HTMLAnchorElement. --- Libraries/LibHTML/HtmlView.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Libraries/LibHTML/HtmlView.cpp') diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp index 69904481a7..c845d05135 100644 --- a/Libraries/LibHTML/HtmlView.cpp +++ b/Libraries/LibHTML/HtmlView.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -93,6 +94,9 @@ void HtmlView::mousemove_event(GMouseEvent& event) hovered_node_changed = node == m_document->hovered_node(); if (node) { dbg() << "HtmlView: mousemove: " << node->tag_name() << "{" << node << "}"; + if (auto* link = node->enclosing_link_element()) { + dbg() << "HtmlView: hovering over a link to " << link->href(); + } } } if (hovered_node_changed) -- cgit v1.2.3