mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user