LibWeb: Update layout before running intersection observations

Layout may have been invalidated by previous rendering steps (e.g. view
transitions). Re-run layout before intersection observations since they
need up-to-date geometry.
This commit is contained in:
Andreas Kling
2026-02-26 11:37:40 +01:00
committed by Andreas Kling
parent 787a83b50a
commit 3e3fcfa41e
Notes: github-actions[bot] 2026-02-26 20:11:17 +00:00

View File

@@ -511,6 +511,10 @@ void EventLoop::update_the_rendering()
// 19. For each doc of docs, run the update intersection observations steps for doc, passing in the relative high resolution time given now and doc's relevant global object as the timestamp. [INTERSECTIONOBSERVER]
for (auto& document : docs) {
// NB: Layout may have been invalidated by previous steps (e.g. view transitions at step 18).
// Re-run layout here since intersection observations need up-to-date geometry.
document->update_layout(DOM::UpdateLayoutReason::HTMLEventLoopRenderingUpdate);
auto now = HighResolutionTime::relative_high_resolution_time(frame_timestamp, relevant_global_object(*document));
document->run_the_update_intersection_observations_steps(now);
}