1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:07:34 +00:00

Ladybird+LibWebView: Migrate cursor changes to LibWebView callbacks

This commit is contained in:
Timothy Flynn 2023-08-23 10:43:27 -04:00 committed by Tim Flynn
parent bf464665a7
commit 00fe122b0a
9 changed files with 14 additions and 20 deletions

View file

@ -45,6 +45,10 @@ OutOfProcessWebView::OutOfProcessWebView()
else
client().async_handle_file_return(0, IPC::File(file.value().stream()), request_id);
};
on_cursor_change = [this](auto cursor) {
set_override_cursor(cursor);
};
}
OutOfProcessWebView::~OutOfProcessWebView() = default;
@ -183,11 +187,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_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor)
{
set_override_cursor(cursor);
}
void OutOfProcessWebView::notify_server_did_request_scroll(Badge<WebContentClient>, i32 x_delta, i32 y_delta)
{
horizontal_scrollbar().increase_slider_by(x_delta);

View file

@ -82,7 +82,6 @@ private:
// ^WebView::ViewImplementation
virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override;
virtual void update_zoom() override;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) override;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) override;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) override;
virtual void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const&) override;

View file

@ -115,6 +115,7 @@ public:
Function<void()> on_navigate_forward;
Function<void()> on_refresh;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<void(Gfx::StandardCursor)> on_cursor_change;
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;
@ -140,7 +141,6 @@ public:
Function<Gfx::IntRect()> on_minimize_window;
Function<Gfx::IntRect()> on_fullscreen_window;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) = 0;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) = 0;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) = 0;
virtual void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const&) = 0;

View file

@ -82,7 +82,9 @@ void WebContentClient::did_request_cursor_change(i32 cursor_type)
dbgln("DidRequestCursorChange: Bad cursor type");
return;
}
m_view.notify_server_did_request_cursor_change({}, (Gfx::StandardCursor)cursor_type);
if (m_view.on_cursor_change)
m_view.on_cursor_change(static_cast<Gfx::StandardCursor>(cursor_type));
}
void WebContentClient::did_layout(Gfx::IntSize content_size)