mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Tweak PageView::on_link_hover hook
Change: on_link_hover(String) -> on_link_hover(URL) Also, we now fire the hook when a link is unhovered as well, allowing the embedder to react to nothing being hovered anymore.
This commit is contained in:
parent
58b1ba2545
commit
63d796312d
Notes:
sideshowbarker
2024-07-19 05:07:58 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/63d796312d1
3 changed files with 9 additions and 4 deletions
|
@ -228,8 +228,11 @@ Tab::Tab()
|
|||
|
||||
m_statusbar = widget.add<GUI::StatusBar>();
|
||||
|
||||
m_page_view->on_link_hover = [this](auto& href) {
|
||||
m_statusbar->set_text(href);
|
||||
m_page_view->on_link_hover = [this](auto& url) {
|
||||
if (url.is_valid())
|
||||
m_statusbar->set_text(url.to_string());
|
||||
else
|
||||
m_statusbar->set_text("");
|
||||
};
|
||||
|
||||
m_page_view->on_url_drop = [this](auto& url) {
|
||||
|
|
|
@ -232,11 +232,13 @@ void PageView::page_did_leave_tooltip_area()
|
|||
void PageView::page_did_hover_link(const URL& url)
|
||||
{
|
||||
if (on_link_hover)
|
||||
on_link_hover(url.to_string());
|
||||
on_link_hover(url);
|
||||
}
|
||||
|
||||
void PageView::page_did_unhover_link()
|
||||
{
|
||||
if (on_link_hover)
|
||||
on_link_hover({});
|
||||
}
|
||||
|
||||
void PageView::page_did_invalidate(const Gfx::IntRect&)
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
Function<void(const String& href, const String& target, unsigned modifiers)> on_link_click;
|
||||
Function<void(const String& href, const Gfx::IntPoint& screen_position)> on_link_context_menu_request;
|
||||
Function<void(const String& href)> on_link_middle_click;
|
||||
Function<void(const String&)> on_link_hover;
|
||||
Function<void(const URL&)> on_link_hover;
|
||||
Function<void(const String&)> on_title_change;
|
||||
Function<void(const URL&)> on_load_start;
|
||||
Function<void(const Gfx::Bitmap&)> on_favicon_change;
|
||||
|
|
Loading…
Add table
Reference in a new issue