mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-06 03:02:55 +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:
parent
88de955073
commit
b477aff843
Notes:
sideshowbarker
2024-07-19 11:53:50 +09:00
Author: https://github.com/awesomekling
Commit: b477aff843
9 changed files with 60 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue