mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibWeb: Coalesce nested repaint requests instead of swallowing them
Previously we would ignore repaint requests that came in via OOPWV while the WebContent process was busy with a previous paint request. This caused some easy-to-trigger bugs where the painted content would be "one paint behind", especially noticeable when scrolling.
This commit is contained in:
parent
f9e814826f
commit
f72a37b9d4
2 changed files with 9 additions and 1 deletions
|
@ -207,6 +207,11 @@ void OutOfProcessWebView::notify_server_did_paint(Badge<WebContentClient>, i32 b
|
|||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,8 +404,10 @@ void OutOfProcessWebView::request_repaint()
|
|||
if (!m_client_state.back_bitmap.bitmap)
|
||||
return;
|
||||
// Don't request a repaint until pending paint requests have finished.
|
||||
if (m_client_state.back_bitmap.pending_paints)
|
||||
if (m_client_state.back_bitmap.pending_paints) {
|
||||
m_client_state.got_repaint_requests_while_painting = true;
|
||||
return;
|
||||
}
|
||||
m_client_state.back_bitmap.pending_paints++;
|
||||
client().async_paint(m_client_state.back_bitmap.bitmap->rect().translated(horizontal_scrollbar().value(), vertical_scrollbar().value()), m_client_state.back_bitmap.id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue