Event dispatch rewritten to resemble spec more often, activate on clicks better

This commit is contained in:
Patrick Shaughnessy 2020-01-09 15:33:52 -05:00
parent ed9b584344
commit 01aba1fcc4
29 changed files with 466 additions and 556 deletions

View file

@ -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