1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 11:54:57 +00:00

Ladybird+LibWebView: Migrate scrolling changes to LibWebView callbacks

This commit is contained in:
Timothy Flynn 2023-08-23 10:57:09 -04:00 committed by Tim Flynn
parent 00fe122b0a
commit 78d9339aa9
10 changed files with 73 additions and 98 deletions

View file

@ -46,6 +46,20 @@ OutOfProcessWebView::OutOfProcessWebView()
client().async_handle_file_return(0, IPC::File(file.value().stream()), request_id);
};
on_scroll_by_delta = [this](auto x_delta, auto y_delta) {
horizontal_scrollbar().increase_slider_by(x_delta);
vertical_scrollbar().increase_slider_by(y_delta);
};
on_scroll_to_point = [this](auto position) {
horizontal_scrollbar().set_value(position.x());
vertical_scrollbar().set_value(position.y());
};
on_scroll_into_view = [this](auto rect) {
scroll_into_view(rect, true, true);
};
on_cursor_change = [this](auto cursor) {
set_override_cursor(cursor);
};
@ -187,23 +201,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_scroll(Badge<WebContentClient>, i32 x_delta, i32 y_delta)
{
horizontal_scrollbar().increase_slider_by(x_delta);
vertical_scrollbar().increase_slider_by(y_delta);
}
void OutOfProcessWebView::notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint scroll_position)
{
horizontal_scrollbar().set_value(scroll_position.x());
vertical_scrollbar().set_value(scroll_position.y());
}
void OutOfProcessWebView::notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const& rect)
{
scroll_into_view(rect, true, true);
}
void OutOfProcessWebView::notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint, DeprecatedString const& title)
{
GUI::Application::the()->show_tooltip(title, nullptr);