mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
LibWeb+WebContent: Support displaying tooltips in OOPWV
This commit is contained in:
parent
c503047c71
commit
5b617df496
7 changed files with 39 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "WebContentClient.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/URLParser.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/InputBox.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
|
@ -255,6 +256,16 @@ void OutOfProcessWebView::notify_server_did_request_scroll_into_view(Badge<WebCo
|
|||
scroll_into_view(rect, true, true);
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_enter_tooltip_area(Badge<WebContentClient>, const Gfx::IntPoint&, const String& title)
|
||||
{
|
||||
GUI::Application::the()->show_tooltip(title, nullptr);
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_leave_tooltip_area(Badge<WebContentClient>)
|
||||
{
|
||||
GUI::Application::the()->hide_tooltip();
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const URL& url)
|
||||
{
|
||||
if (on_link_hover)
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
void notify_server_did_change_title(Badge<WebContentClient>, const String&);
|
||||
void notify_server_did_request_scroll(Badge<WebContentClient>, int);
|
||||
void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect&);
|
||||
void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, const Gfx::IntPoint&, const String&);
|
||||
void notify_server_did_leave_tooltip_area(Badge<WebContentClient>);
|
||||
void notify_server_did_hover_link(Badge<WebContentClient>, const URL&);
|
||||
void notify_server_did_unhover_link(Badge<WebContentClient>);
|
||||
void notify_server_did_click_link(Badge<WebContentClient>, const URL&, const String& target, unsigned modifiers);
|
||||
|
|
|
@ -106,6 +106,16 @@ void WebContentClient::handle(const Messages::WebContentClient::DidRequestScroll
|
|||
m_view.notify_server_did_request_scroll_into_view({}, message.rect());
|
||||
}
|
||||
|
||||
void WebContentClient::handle(const Messages::WebContentClient::DidEnterTooltipArea& message)
|
||||
{
|
||||
m_view.notify_server_did_enter_tooltip_area({}, message.content_position(), message.title());
|
||||
}
|
||||
|
||||
void WebContentClient::handle(const Messages::WebContentClient::DidLeaveTooltipArea&)
|
||||
{
|
||||
m_view.notify_server_did_leave_tooltip_area({});
|
||||
}
|
||||
|
||||
void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& message)
|
||||
{
|
||||
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidHoverLink! url={}", message.url());
|
||||
|
|
|
@ -59,6 +59,8 @@ private:
|
|||
virtual void handle(const Messages::WebContentClient::DidChangeTitle&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidRequestScroll&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidRequestScrollIntoView&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidEnterTooltipArea&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidLeaveTooltipArea&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidHoverLink&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidUnhoverLink&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidClickLink&) override;
|
||||
|
|
|
@ -133,6 +133,16 @@ void PageHost::page_did_request_scroll_into_view(const Gfx::IntRect& rect)
|
|||
m_client.post_message(Messages::WebContentClient::DidRequestScrollIntoView(rect));
|
||||
}
|
||||
|
||||
void PageHost::page_did_enter_tooltip_area(const Gfx::IntPoint& content_position, const String& title)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidEnterTooltipArea(content_position, title));
|
||||
}
|
||||
|
||||
void PageHost::page_did_leave_tooltip_area()
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidLeaveTooltipArea());
|
||||
}
|
||||
|
||||
void PageHost::page_did_hover_link(const URL& url)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidHoverLink(url));
|
||||
|
|
|
@ -61,6 +61,8 @@ private:
|
|||
virtual void page_did_change_title(const String&) override;
|
||||
virtual void page_did_request_scroll(int) override;
|
||||
virtual void page_did_request_scroll_into_view(const Gfx::IntRect&) override;
|
||||
virtual void page_did_enter_tooltip_area(const Gfx::IntPoint&, const String&) override;
|
||||
virtual void page_did_leave_tooltip_area() override;
|
||||
virtual void page_did_hover_link(const URL&) override;
|
||||
virtual void page_did_unhover_link() override;
|
||||
virtual void page_did_click_link(const URL&, const String& target, unsigned modifiers) override;
|
||||
|
|
|
@ -10,6 +10,8 @@ endpoint WebContentClient = 90
|
|||
DidChangeTitle(String title) =|
|
||||
DidRequestScroll(int wheel_delta) =|
|
||||
DidRequestScrollIntoView(Gfx::IntRect rect) =|
|
||||
DidEnterTooltipArea(Gfx::IntPoint content_position, String title) =|
|
||||
DidLeaveTooltipArea() =|
|
||||
DidHoverLink(URL url) =|
|
||||
DidUnhoverLink() =|
|
||||
DidClickLink(URL url, String target, unsigned modifiers) =|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue