LibWeb: Fix scroll state refresh in cached display list for iframes

6507d23 introduced a bug when snapshot for iframe is saved in
`PaintNestedDisplayList` and, since display lists are immutable, it's
not possible to update before the next repaint.

This change fixes the issue by moving `ScrollStateSnapshot` for
nested display lists from `PaintNestedDisplayList` to
`HashMap<NonnullRefPtr<DisplayList>, ScrollStateSnapshot>` that is
placed into pending rendering task, making it possible to update
snapshots for all display lists before the next repaint.

This change doesn't have a test because it's really hard to make a ref
test that will specifically check scenario when scroll offset of an
iframe is advanced after display list is cached. We already have
`Tests/LibWeb/Ref/input/scroll-iframe.html` but unfortunately it did
not catch this bug.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/5486
This commit is contained in:
Aliaksandr Kalenik 2025-07-25 01:39:31 +02:00 committed by Alexander Kalenik
parent 124bdce99c
commit 8569124b87
Notes: github-actions[bot] 2025-07-26 15:54:30 +00:00
18 changed files with 63 additions and 28 deletions

View file

@ -6405,6 +6405,11 @@ void Document::invalidate_display_list()
}
}
RefPtr<Painting::DisplayList> Document::cached_display_list() const
{
return m_cached_display_list;
}
RefPtr<Painting::DisplayList> Document::record_display_list(HTML::PaintConfig config)
{
if (m_cached_display_list && m_cached_display_list_paint_config == config) {