summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/HtmlView.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-29 11:59:38 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-29 11:59:38 +0200
commitb477aff843dce2b465ce351fb5e842c4c0cd3c27 (patch)
tree5d663df7774e5ff501616390d7567976185a266f /Libraries/LibHTML/HtmlView.cpp
parent88de955073a97df9c9099413eb0408771a824fc7 (diff)
downloadserenity-b477aff843dce2b465ce351fb5e842c4c0cd3c27.zip
LibHTML: Detect hovering over links
HtmlView now calls Node::enclosing_link_element() to find the nearest ancestor <a> element. This patch also adds HTMLElement and HTMLAnchorElement.
Diffstat (limited to 'Libraries/LibHTML/HtmlView.cpp')
-rw-r--r--Libraries/LibHTML/HtmlView.cpp4
1 files changed, 4 insertions, 0 deletions
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 <LibGUI/GPainter.h>
#include <LibGUI/GScrollBar.h>
#include <LibHTML/DOM/Element.h>
+#include <LibHTML/DOM/HTMLAnchorElement.h>
#include <LibHTML/Dump.h>
#include <LibHTML/HtmlView.h>
#include <LibHTML/Layout/LayoutNode.h>
@@ -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)