mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
Ladybird+LibWebView: Migrate tooltip changes to LibWebView callbacks
This commit is contained in:
parent
78d9339aa9
commit
5116e97a9d
10 changed files with 27 additions and 53 deletions
|
@ -63,6 +63,14 @@ OutOfProcessWebView::OutOfProcessWebView()
|
|||
on_cursor_change = [this](auto cursor) {
|
||||
set_override_cursor(cursor);
|
||||
};
|
||||
|
||||
on_enter_tooltip_area = [](auto, auto tooltip) {
|
||||
GUI::Application::the()->show_tooltip(tooltip, nullptr);
|
||||
};
|
||||
|
||||
on_leave_tooltip_area = []() {
|
||||
GUI::Application::the()->hide_tooltip();
|
||||
};
|
||||
}
|
||||
|
||||
OutOfProcessWebView::~OutOfProcessWebView() = default;
|
||||
|
@ -201,16 +209,6 @@ void OutOfProcessWebView::screen_rects_change_event(GUI::ScreenRectsChangeEvent&
|
|||
client().async_update_screen_rects(event.rects(), event.main_screen_index());
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint, DeprecatedString const& 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::did_scroll()
|
||||
{
|
||||
client().async_set_viewport_rect(visible_content_rect());
|
||||
|
|
|
@ -82,8 +82,6 @@ private:
|
|||
// ^WebView::ViewImplementation
|
||||
virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override;
|
||||
virtual void update_zoom() override;
|
||||
virtual void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint, DeprecatedString const&) override;
|
||||
virtual void notify_server_did_leave_tooltip_area(Badge<WebContentClient>) override;
|
||||
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
|
||||
|
||||
virtual Gfx::IntRect viewport_rect() const override;
|
||||
|
|
|
@ -119,6 +119,8 @@ public:
|
|||
Function<void(Gfx::IntPoint)> on_scroll_to_point;
|
||||
Function<void(Gfx::IntRect)> on_scroll_into_view;
|
||||
Function<void(Gfx::StandardCursor)> on_cursor_change;
|
||||
Function<void(Gfx::IntPoint, DeprecatedString const&)> on_enter_tooltip_area;
|
||||
Function<void()> on_leave_tooltip_area;
|
||||
Function<void(String const& message)> on_request_alert;
|
||||
Function<void(String const& message)> on_request_confirm;
|
||||
Function<void(String const& message, String const& default_)> on_request_prompt;
|
||||
|
@ -144,8 +146,6 @@ public:
|
|||
Function<Gfx::IntRect()> on_minimize_window;
|
||||
Function<Gfx::IntRect()> on_fullscreen_window;
|
||||
|
||||
virtual void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint, DeprecatedString const&) = 0;
|
||||
virtual void notify_server_did_leave_tooltip_area(Badge<WebContentClient>) = 0;
|
||||
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) = 0;
|
||||
|
||||
virtual Gfx::IntRect viewport_rect() const = 0;
|
||||
|
|
|
@ -128,12 +128,14 @@ void WebContentClient::did_request_scroll_into_view(Gfx::IntRect const& rect)
|
|||
|
||||
void WebContentClient::did_enter_tooltip_area(Gfx::IntPoint content_position, DeprecatedString const& title)
|
||||
{
|
||||
m_view.notify_server_did_enter_tooltip_area({}, content_position, title);
|
||||
if (m_view.on_enter_tooltip_area)
|
||||
m_view.on_enter_tooltip_area(m_view.to_widget_position(content_position), title);
|
||||
}
|
||||
|
||||
void WebContentClient::did_leave_tooltip_area()
|
||||
{
|
||||
m_view.notify_server_did_leave_tooltip_area({});
|
||||
if (m_view.on_leave_tooltip_area)
|
||||
m_view.on_leave_tooltip_area();
|
||||
}
|
||||
|
||||
void WebContentClient::did_hover_link(AK::URL const& url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue