LibWeb+WebContent: Change event loop to synchronously paint next frame

...instead of scheduling repaint timer in PageClient.

This change fixes flickering on Discord that happened because:
- Event loop schedules repainting by activating repaint timer
- `Document::tear_down_layout_tree()` destroys paintable tree
- Repaint timer invokes callback and renders an empty frame because
  paintable tree was destroyed
This commit is contained in:
Aliaksandr Kalenik
2024-05-28 15:51:53 +02:00
committed by Andreas Kling
parent e806136116
commit b8d18ebcf7
7 changed files with 29 additions and 24 deletions

View File

@@ -327,7 +327,10 @@ void EventLoop::process()
if (navigable && navigable->needs_repaint()) {
auto* browsing_context = document.browsing_context();
auto& page = browsing_context->page();
page.client().schedule_repaint();
if (navigable->is_traversable()) {
VERIFY(page.client().is_ready_to_paint());
page.client().paint_next_frame();
}
}
});