From 30731dd5aea075691dd143e3df203dfec149340a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=BClker?= Date: Fri, 6 Jun 2025 15:20:47 +0200 Subject: [PATCH] Add "composed" param to "fire_event_with_composed" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Wülker --- components/script/dom/event.rs | 8 +++++++- components/script/dom/eventtarget.rs | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 743ced42a4b..345038a08da 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -1124,7 +1124,13 @@ impl TaskOnce for EventTask { let target = self.target.root(); let bubbles = self.bubbles; let cancelable = self.cancelable; - target.fire_event_with_params(self.name, bubbles, cancelable, CanGc::note()); + target.fire_event_with_params( + self.name, + bubbles, + cancelable, + EventComposed::NotComposed, + CanGc::note(), + ); } } diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 1a5aafb0ae7..15f77f5fcd5 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -59,7 +59,7 @@ use crate::dom::bindings::trace::HashMapTracedValues; use crate::dom::document::Document; use crate::dom::element::Element; use crate::dom::errorevent::ErrorEvent; -use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus}; +use crate::dom::event::{Event, EventBubbles, EventCancelable, EventComposed, EventStatus}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlformelement::FormControlElementHelpers; use crate::dom::node::{Node, NodeTraits}; @@ -767,6 +767,7 @@ impl EventTarget { name, EventBubbles::DoesNotBubble, EventCancelable::NotCancelable, + EventComposed::NotComposed, can_gc, ) } @@ -777,6 +778,7 @@ impl EventTarget { name, EventBubbles::Bubbles, EventCancelable::NotCancelable, + EventComposed::NotComposed, can_gc, ) } @@ -787,6 +789,7 @@ impl EventTarget { name, EventBubbles::DoesNotBubble, EventCancelable::Cancelable, + EventComposed::NotComposed, can_gc, ) } @@ -801,19 +804,22 @@ impl EventTarget { name, EventBubbles::Bubbles, EventCancelable::Cancelable, + EventComposed::NotComposed, can_gc, ) } - // https://dom.spec.whatwg.org/#concept-event-fire + /// pub(crate) fn fire_event_with_params( &self, name: Atom, bubbles: EventBubbles, cancelable: EventCancelable, + composed: EventComposed, can_gc: CanGc, ) -> DomRoot { let event = Event::new(&self.global(), name, bubbles, cancelable, can_gc); + event.set_composed(composed.into()); event.fire(self, can_gc); event }