1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 22:45:06 +00:00

LibWeb: Paint page only if something that requires repaint happened

Resolves a performance regression from
8ba18dfd40, where moving paint scheduling
to `EventLoop::process()` led to unnecessary repaints.

This update introduces a flag to trigger repaints only when necessary,
addressing the issue where repaints previously occurred with each event
loop process, irrespective of actual changes.
This commit is contained in:
Aliaksandr Kalenik 2024-02-23 22:10:35 +01:00 committed by Andreas Kling
parent 906ac71eca
commit c3f5dbb101
4 changed files with 15 additions and 4 deletions

View file

@ -256,9 +256,11 @@ void EventLoop::process()
// 16. For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state.
for_each_fully_active_document_in_docs([&](DOM::Document& document) {
auto* browsing_context = document.browsing_context();
auto& page = browsing_context->page();
page.client().schedule_repaint();
if (document.navigable() && document.navigable()->needs_repaint()) {
auto* browsing_context = document.browsing_context();
auto& page = browsing_context->page();
page.client().schedule_repaint();
}
});
// 13. If all of the following are true