1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +00:00

Ladybird+LibWebView: Move most of paint handling to LibWebView

Storing the backup bitmap is the same across Browser and Ladybird. Just
peform that work in LibWebView, and handle only the implementation-
specific nuances within the browsers.
This commit is contained in:
Timothy Flynn 2023-05-20 10:50:05 -04:00 committed by Tim Flynn
parent 15da77f4c4
commit ea7e1b5f53
10 changed files with 34 additions and 63 deletions

View file

@ -29,6 +29,10 @@ OutOfProcessWebView::OutOfProcessWebView()
create_client();
on_ready_to_paint = [this]() {
update();
};
on_request_file = [this](auto const& path, auto request_id) {
auto file = FileSystemAccessClient::Client::the().request_file_read_only_approved(window(), path);
@ -175,24 +179,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_paint(Badge<WebContentClient>, i32 bitmap_id, Gfx::IntSize size)
{
if (m_client_state.back_bitmap.id == bitmap_id) {
m_client_state.has_usable_bitmap = true;
m_client_state.back_bitmap.pending_paints--;
m_client_state.back_bitmap.last_painted_size = size;
swap(m_client_state.back_bitmap, m_client_state.front_bitmap);
// We don't need the backup bitmap anymore, so drop it.
m_backup_bitmap = nullptr;
update();
if (m_client_state.got_repaint_requests_while_painting) {
m_client_state.got_repaint_requests_while_painting = false;
request_repaint();
}
}
}
void OutOfProcessWebView::notify_server_did_invalidate_content_rect(Badge<WebContentClient>, [[maybe_unused]] Gfx::IntRect const& content_rect)
{
request_repaint();