From 13eeb2987827503fa6de8e1b5cac92bb6f9a26ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=BClker?= Date: Fri, 4 Jul 2025 09:11:04 +0200 Subject: [PATCH] Don't explicitly handle dirty roots that are shadow roots (#37862) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dirty roots are never shadow roots, since we use the flat tree for invalidation. The flat tree does not contain shadow roots. Reverts https://github.com/servo/servo/pull/35132. When that patch was submitted we used the DOM tree for invalidation, so it was possible to encounter shadow roots. Testing: Covered by `shadow-dom/untriaged/events/event-dispatch/test-003.html` Signed-off-by: Simon Wülker --- components/script/dom/document.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 1488cdbd351..2b2613e0b6e 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -663,14 +663,8 @@ impl Document { has_dirty_descendants &= *ancestor != *new_dirty_root; } - let maybe_shadow_host = new_dirty_root - .downcast::() - .map(ShadowRootMethods::Host); - let new_dirty_root_element = new_dirty_root - .downcast::() - .or(maybe_shadow_host.as_deref()); - - self.dirty_root.set(new_dirty_root_element); + self.dirty_root + .set(Some(new_dirty_root.downcast::().unwrap())); } pub(crate) fn take_dirty_root(&self) -> Option> {