LibWeb: Create clip and scroll frame trees separately for each navigable

While introducing clip and scroll frame trees, I made a mistake by
assuming that the paintable tree includes boxes from nested navigables.
Therefore, this comment in the code was incorrect, and clip/scroll
frames were simply not assigned for iframes:
// NOTE: We only need to refresh the scroll state for traversables
//       because they are responsible for tracking the state of all
//       nested navigables.

As a result, anything with "overflow: scroll" is currently not
scrollable inside an iframe

This change fixes that by ensuring clip and scroll frames are assigned
and refreshed for each navigable. To achieve this, I had to modify the
display list building process to record a separate display list for each
navigable. This is necessary because scroll frame ids are local to a
navigable, making it impossible to call
`DisplayList::apply_scroll_offsets()` on a display list that contains
ids from multiple navigables.
This commit is contained in:
Aliaksandr Kalenik 2024-08-08 14:17:54 +03:00 committed by Andreas Kling
commit ea8d0304e9
Notes: github-actions[bot] 2024-08-10 08:40:33 +00:00
15 changed files with 156 additions and 46 deletions

View file

@ -1156,12 +1156,10 @@ void Document::update_layout()
navigable->set_needs_display();
set_needs_to_resolve_paint_only_properties();
if (navigable->is_traversable()) {
// NOTE: The assignment of scroll frames only needs to occur for traversables because they take care of all
// nested navigable documents.
paintable()->assign_scroll_frames();
paintable()->assign_clip_frames();
paintable()->assign_scroll_frames();
paintable()->assign_clip_frames();
if (navigable->is_traversable()) {
page().client().page_did_layout();
}