aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-02-13 17:37:12 -0500
committerGitHub <noreply@github.com>2020-02-13 17:37:12 -0500
commite697e6cca70bec57b5ed9512b95c2a72359d6ca1 (patch)
tree99fa07d2761b0ff18f7c166b8f0a98e1fc8b513e /components/script/dom/element.rs
parent9c135f0e9554bd78bb7a432a872257e2cae13a48 (diff)
parent01aba1fcc453192da64272dcc180135ce11e4ea7 (diff)
downloadservo-e697e6cca70bec57b5ed9512b95c2a72359d6ca1.tar.gz
servo-e697e6cca70bec57b5ed9512b95c2a72359d6ca1.zip
Auto merge of #25488 - pshaughn:clickactivate, r=jdm
Event dispatch rewritten to align to spec, activate on clicks better I went over the changes to the event dispatch spec that had accumulated over the past few years, rewriting dispatch/invoke/inner-invoke almost completely and modifying other code where it was relevant. Most of the remaining obvious deviations from spec are things that will only come up when we start handling events in shadow DOM. I am pushing now because I want to see CI test results, but please do not approve this PR just if automated test improvements look good. I may have broken some actual UI interactions in the course of fixing synthetic events, and some manual testing is needed, including checking that manual interactions with interactive content continue to fire the events they're supposed to. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25384 and fix #22783 and fix #25199 <!-- Either: --> - [ ] There are automated tests for the synthetic-click parts of these changes, BUT the effects on real UI events need some manual testing before merging <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs48
1 files changed, 0 insertions, 48 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index a7c45562209..e6485bec5af 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};
@@ -3283,52 +3281,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>()