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/window.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/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 208d7f1d87e..c1a6ba0c4c4 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -33,7 +33,7 @@ use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration use crate::dom::customelementregistry::CustomElementRegistry; use crate::dom::document::{AnimationFrameCallback, Document}; use crate::dom::element::Element; -use crate::dom::event::Event; +use crate::dom::event::{Event, EventStatus}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::hashchangeevent::HashChangeEvent; @@ -528,6 +528,14 @@ impl Window { pub fn get_event_loop_waker(&self) -> Option<Box<dyn EventLoopWaker>> { self.event_loop_waker.as_ref().map(|w| (*w).clone_box()) } + + // see note at https://dom.spec.whatwg.org/#concept-event-dispatch step 2 + pub fn dispatch_event_with_target_override(&self, event: &Event) -> EventStatus { + if self.has_document() { + assert!(self.Document().can_invoke_script()); + } + event.dispatch(self.upcast(), true) + } } // https://html.spec.whatwg.org/multipage/#atob |