LibWeb: Don't throw away new scroll events after processing the old ones

Dispatching scroll events could cause new scroll events to get lined up
and added to `m_pending_scroll_events`. The spec then asks us to empty
out that list, removing those newly added events.

Prevent doing that by emptying out the list before iterating over the
events. Fixes part of the WPT test `html/webappapis/scripting/event-
loops/new-scroll-event-dispatched-at-next-updating-rendering-time.html`.
This commit is contained in:
Jelle Raaijmakers
2026-02-13 20:55:44 +01:00
committed by Alexander Kalenik
parent 14b118c8ea
commit 3576f4a53a
Notes: github-actions[bot] 2026-02-13 21:45:37 +00:00
2 changed files with 5 additions and 4 deletions

View File

@@ -406,9 +406,8 @@ void EventLoop::update_the_rendering()
}
// 9. For each doc of docs, run the scroll steps for doc. [CSSOMVIEW]
for (auto& document : docs) {
for (auto& document : docs)
document->run_the_scroll_steps();
}
// 10. For each doc of docs, evaluate media queries and report changes for doc. [CSSOMVIEW]
for (auto& document : docs) {