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/element.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/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index c26e492d544..7a3b056a71b 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -11,7 +11,6 @@ use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use crate::dom::bindings::codegen::Bindings::ElementBinding; use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; -use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function; use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; @@ -39,7 +38,6 @@ use crate::dom::document::{determine_policy_for_token, Document, LayoutDocumentH use crate::dom::documentfragment::DocumentFragment; use crate::dom::domrect::DOMRect; use crate::dom::domtokenlist::DOMTokenList; -use crate::dom::event::Event; use crate::dom::eventtarget::EventTarget; use crate::dom::htmlanchorelement::HTMLAnchorElement; use crate::dom::htmlbodyelement::{HTMLBodyElement, HTMLBodyElementLayoutHelpers}; @@ -3222,52 +3220,6 @@ impl Element { } } - /// Please call this method *only* for real click events - /// - /// <https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps> - /// - /// Use an element's synthetic click activation (or handle_event) for any script-triggered clicks. - /// If the spec says otherwise, check with Manishearth first - pub fn authentic_click_activation(&self, event: &Event) { - // Not explicitly part of the spec, however this helps enforce the invariants - // required to save state between pre-activation and post-activation - // since we cannot nest authentic clicks (unlike synthetic click activation, where - // the script can generate more click events from the handler) - assert!(!self.click_in_progress()); - - let target = self.upcast(); - // Step 2 (requires canvas support) - // Step 3 - self.set_click_in_progress(true); - // Step 4 - let e = self.nearest_activable_element(); - match e { - Some(ref el) => match el.as_maybe_activatable() { - Some(elem) => { - // Step 5-6 - elem.pre_click_activation(); - event.fire(target); - if !event.DefaultPrevented() { - // post click activation - elem.activation_behavior(event, target); - } else { - elem.canceled_activation(); - } - }, - // Step 6 - None => { - event.fire(target); - }, - }, - // Step 6 - None => { - event.fire(target); - }, - } - // Step 7 - self.set_click_in_progress(false); - } - // https://html.spec.whatwg.org/multipage/#language pub fn get_lang(&self) -> String { self.upcast::<Node>() |