diff options
author | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-01-09 15:33:52 -0500 |
---|---|---|
committer | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-02-12 15:57:37 -0500 |
commit | 01aba1fcc453192da64272dcc180135ce11e4ea7 (patch) | |
tree | 31f92472dca740a63a91a51188a0f3325a00481b /components/script/dom/eventtarget.rs | |
parent | ed9b5843443db7164bda6eb6f3cb7caff2ff5a3c (diff) | |
download | servo-01aba1fcc453192da64272dcc180135ce11e4ea7.tar.gz servo-01aba1fcc453192da64272dcc180135ce11e4ea7.zip |
Event dispatch rewritten to resemble spec more often, activate on clicks better
Diffstat (limited to 'components/script/dom/eventtarget.rs')
-rw-r--r-- | components/script/dom/eventtarget.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 1d80781a2fb..91d24759697 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -73,7 +73,7 @@ impl CommonEventHandler { } } -#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)] +#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)] pub enum ListenerPhase { Capturing, Bubbling, @@ -248,6 +248,8 @@ impl CompiledEventListener { } } +// https://dom.spec.whatwg.org/#concept-event-listener +// (as distinct from https://dom.spec.whatwg.org/#callbackdef-eventlistener) #[derive(Clone, DenyPublicFields, JSTraceable, MallocSizeOf)] /// A listener in a collection of event listeners. struct EventListenerEntry { @@ -367,23 +369,13 @@ impl EventTarget { }) } - pub fn dispatch_event_with_target(&self, target: &EventTarget, event: &Event) -> EventStatus { - if let Some(window) = target.global().downcast::<Window>() { - if window.has_document() { - assert!(window.Document().can_invoke_script()); - } - }; - - event.dispatch(self, Some(target)) - } - pub fn dispatch_event(&self, event: &Event) -> EventStatus { if let Some(window) = self.global().downcast::<Window>() { if window.has_document() { assert!(window.Document().can_invoke_script()); } }; - event.dispatch(self, None) + event.dispatch(self, false) } pub fn remove_all_listeners(&self) { |