From 8ae1cd588c1060e309b8de482f5032ea38236d48 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Fri, 1 Aug 2025 22:50:12 +0200 Subject: [PATCH] ResizeObserver shouldn't always force a rendering update --- components/script/dom/document.rs | 3 --- components/script/script_thread.rs | 10 ++++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 68d0b4a2f16..80df1a4d003 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -3670,9 +3670,6 @@ impl Document { if self.has_pending_input_events() { return true; } - if self.has_resize_observers() { - return true; - } if self.window().has_unhandled_resize_event() { return true; } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index ce4c74d28ae..6c77be8c9ad 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1377,12 +1377,10 @@ impl ScriptThread { fn maybe_schedule_rendering_opportunity_after_rendering_update(&self, saw_any_reflows: bool) { // If there are any pending reflows and we are not having rendering opportunities // immediately after running "update the rendering," run it one more time. - if self - .documents - .borrow() - .iter() - .any(|(_, document)| document.needs_rendering_update()) - { + if self.documents.borrow().iter().any(|(_, document)| { + document.needs_rendering_update() || + (saw_any_reflows && document.has_resize_observers()) + }) { self.cancel_scheduled_update_the_rendering(); self.schedule_update_the_rendering_timer_if_necessary(Duration::ZERO); }