diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-29 11:59:38 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-29 11:59:38 +0200 |
commit | b477aff843dce2b465ce351fb5e842c4c0cd3c27 (patch) | |
tree | 5d663df7774e5ff501616390d7567976185a266f /Libraries/LibHTML/HtmlView.cpp | |
parent | 88de955073a97df9c9099413eb0408771a824fc7 (diff) | |
download | serenity-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.cpp | 4 |
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) |