Only handle most recent resize event in script thread (#33297)

This avoids having to do unnecessary layout work and
prevents resize events from accumulating, which looks
weird.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2024-09-04 13:30:39 +02:00 committed by GitHub
parent fc5f8e9237
commit 961fcfc46d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View file

@ -1688,7 +1688,7 @@ impl ScriptThread {
// TODO(#31665): Implement the "run the scroll steps" from
// https://drafts.csswg.org/cssom-view/#document-run-the-scroll-steps.
for (size, size_type) in document.window().steal_resize_events().into_iter() {
if let Some((size, size_type)) = document.window().take_unhandled_resize_event() {
// Resize steps.
self.run_the_resize_steps(pipeline_id, size, size_type);