diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-03-30 12:10:06 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-30 21:21:17 +0200 |
commit | 5b617df49659ff302fc0aa590c26aedd6473e053 (patch) | |
tree | cdb3a2555d9bc556e3fad71ba58d7bba3698cf6a /Userland/Libraries | |
parent | c503047c71acbb9f1650f6c877cd9e53af3f2541 (diff) | |
download | serenity-5b617df49659ff302fc0aa590c26aedd6473e053.zip |
LibWeb+WebContent: Support displaying tooltips in OOPWV
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/OutOfProcessWebView.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/OutOfProcessWebView.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/WebContentClient.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/WebContentClient.h | 2 |
4 files changed, 25 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 6484b9828f..637dc76c38 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -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) diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h index 11405a98a2..e0fccc6ae7 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h @@ -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); diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index f049f21cb2..3988db3d8e 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -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()); diff --git a/Userland/Libraries/LibWeb/WebContentClient.h b/Userland/Libraries/LibWeb/WebContentClient.h index 9357930f2a..17ae95d91c 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.h +++ b/Userland/Libraries/LibWeb/WebContentClient.h @@ -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; |