LibWeb: Fix infinite repaint loop when cached display list is used

Before this change, `m_needs_repaint` was reset in
`Document::record_display_list()` only when the cached display list was
absent. This meant that if the last triggered repaint used the cached
display list, we would keep repainting indefinitely until the display
list was invalidated (We schedule a task that checks if repainting is
required 60/s).

This change also moves `m_needs_repaint` from Document to
TraversableNavigable as we only ever need to repaint a document that
belongs to traversable.
This commit is contained in:
Aliaksandr Kalenik 2025-02-01 19:33:18 +01:00 committed by Andreas Kling
parent 0cfe90b59e
commit 0c5b61b7e1
Notes: github-actions[bot] 2025-02-01 22:32:14 +00:00
9 changed files with 17 additions and 25 deletions

View file

@ -411,13 +411,13 @@ void EventLoop::update_the_rendering()
for (auto& document : docs) {
document->page().client().process_screenshot_requests();
auto navigable = document->navigable();
if (navigable && document->needs_repaint()) {
auto* browsing_context = document->browsing_context();
auto& page = browsing_context->page();
if (navigable->is_traversable()) {
VERIFY(page.client().is_ready_to_paint());
page.client().paint_next_frame();
}
if (!navigable->is_traversable())
continue;
auto traversable = navigable->traversable_navigable();
if (traversable && traversable->needs_repaint()) {
auto& page = traversable->page();
VERIFY(page.client().is_ready_to_paint());
page.client().paint_next_frame();
}
}