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/htmlelement.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/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index c5b7e6d0251..9a2deebf55a 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::dom::activation::{synthetic_click_activation, ActivationSource}; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use crate::dom::bindings::codegen::Bindings::HTMLElementBinding; @@ -359,16 +358,18 @@ impl HTMLElementMethods for HTMLElement { // https://html.spec.whatwg.org/multipage/#dom-click fn Click(&self) { - if !self.upcast::<Element>().disabled_state() { - synthetic_click_activation( - self.upcast::<Element>(), - false, - false, - false, - false, - ActivationSource::FromClick, - ) + let element = self.upcast::<Element>(); + if element.disabled_state() { + return; } + if element.click_in_progress() { + return; + } + element.set_click_in_progress(true); + + self.upcast::<Node>() + .fire_synthetic_mouse_event_not_trusted(DOMString::from("click")); + element.set_click_in_progress(false); } // https://html.spec.whatwg.org/multipage/#dom-focus |