From e1bbbb144ce2041dff2dd817dfc02758fab528d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 23 May 2024 12:09:21 +0000 Subject: [PATCH] Bug 1896599 - Remove event-from-input support. r=Jamie,devtools-reviewers,eeejay,nchevobbe As per the comments it isn't supported with cache-the-world on, it's barely documented if at all, and a test for it seems to be failing without me being able to reproduce it at least (tried on both windows and Linux). I don't think it's worth digging too much more into it. My guess is a reentrant / differently timed a11y event caused by my scheduling changes, or so, which would override sEventTargetNode or the other static bool. The test has ~always failed on macOS too... Differential Revision: https://phabricator.services.mozilla.com/D210872 --- accessible/base/nsEventShell.cpp | 25 +----- accessible/base/nsEventShell.h | 14 --- accessible/generic/LocalAccessible.cpp | 2 - accessible/tests/mochitest/events/a11y.toml | 2 - .../tests/mochitest/events/test_attrs.html | 85 ------------------- .../browser_accessibility_node_events.js | 1 - xpcom/ds/StaticAtoms.py | 1 - 7 files changed, 1 insertion(+), 129 deletions(-) delete mode 100644 accessible/tests/mochitest/events/test_attrs.html diff --git a/accessible/base/nsEventShell.cpp b/accessible/base/nsEventShell.cpp index fcdc954919ee..96ccaa454af8 100644 --- a/accessible/base/nsEventShell.cpp +++ b/accessible/base/nsEventShell.cpp @@ -5,11 +5,9 @@ #include "nsEventShell.h" -#include "nsAccUtils.h" +#include "nsAccessibilityService.h" #include "Logging.h" -#include "AccAttributes.h" -#include "mozilla/StaticPtr.h" #include "mozilla/dom/DOMStringList.h" using namespace mozilla; @@ -25,12 +23,6 @@ void nsEventShell::FireEvent(AccEvent* aEvent) { LocalAccessible* accessible = aEvent->GetAccessible(); NS_ENSURE_TRUE_VOID(accessible); - nsINode* node = accessible->GetNode(); - if (node) { - sEventTargetNode = node; - sEventFromUserInput = aEvent->IsFromUserInput(); - } - #ifdef A11Y_LOG if (logging::IsEnabled(logging::eEvents)) { logging::MsgBegin("EVENTS", "events fired"); @@ -53,8 +45,6 @@ void nsEventShell::FireEvent(AccEvent* aEvent) { accessible->HandleAccEvent(aEvent); aEvent->mEventRule = AccEvent::eDoNotEmit; - - sEventTargetNode = nullptr; } void nsEventShell::FireEvent(uint32_t aEventType, LocalAccessible* aAccessible, @@ -66,16 +56,3 @@ void nsEventShell::FireEvent(uint32_t aEventType, LocalAccessible* aAccessible, FireEvent(event); } - -void nsEventShell::GetEventAttributes(nsINode* aNode, - AccAttributes* aAttributes) { - if (aNode != sEventTargetNode) return; - - aAttributes->SetAttribute(nsGkAtoms::eventFromInput, sEventFromUserInput); -} - -//////////////////////////////////////////////////////////////////////////////// -// nsEventShell: private - -bool nsEventShell::sEventFromUserInput = false; -StaticRefPtr nsEventShell::sEventTargetNode; diff --git a/accessible/base/nsEventShell.h b/accessible/base/nsEventShell.h index ff2e062750be..b71b659733d2 100644 --- a/accessible/base/nsEventShell.h +++ b/accessible/base/nsEventShell.h @@ -47,20 +47,6 @@ class nsEventShell { : mozilla::a11y::eNoUserInput)); FireEvent(stateChangeEvent); } - - /** - * Append 'event-from-input' object attribute if the accessible event has - * been fired just now for the given node. - * - * @param aNode [in] the DOM node - * @param aAttributes [in, out] the attributes - */ - static void GetEventAttributes(nsINode* aNode, - mozilla::a11y::AccAttributes* aAttributes); - - private: - static mozilla::StaticRefPtr sEventTargetNode; - static bool sEventFromUserInput; }; #endif diff --git a/accessible/generic/LocalAccessible.cpp b/accessible/generic/LocalAccessible.cpp index 7ecf5b711480..7e9ea5ebe7be 100644 --- a/accessible/generic/LocalAccessible.cpp +++ b/accessible/generic/LocalAccessible.cpp @@ -1182,8 +1182,6 @@ already_AddRefed LocalAccessible::NativeAttributes() { // xul tree item) then don't calculate content based attributes. if (!HasOwnContent()) return attributes.forget(); - nsEventShell::GetEventAttributes(GetNode(), attributes); - // Get container-foo computed live region properties based on the closest // container with the live region attribute. Inner nodes override outer nodes // within the same document. The inner nodes can be used to override live diff --git a/accessible/tests/mochitest/events/a11y.toml b/accessible/tests/mochitest/events/a11y.toml index 81f9fab3d9f3..33bc6597a182 100644 --- a/accessible/tests/mochitest/events/a11y.toml +++ b/accessible/tests/mochitest/events/a11y.toml @@ -22,8 +22,6 @@ support-files = [ ["test_attrchange.html"] -["test_attrs.html"] - ["test_bug1322593-2.html"] ["test_bug1322593.html"] diff --git a/accessible/tests/mochitest/events/test_attrs.html b/accessible/tests/mochitest/events/test_attrs.html deleted file mode 100644 index c09bd9cf1ee8..000000000000 --- a/accessible/tests/mochitest/events/test_attrs.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - Event object attributes tests - - - - - - - - - - - - - - - - - Mozilla Bug 540285 - -

- -
-  
- - - - -
- - diff --git a/devtools/server/tests/browser/browser_accessibility_node_events.js b/devtools/server/tests/browser/browser_accessibility_node_events.js index 77a1e7892f02..85b309724741 100644 --- a/devtools/server/tests/browser/browser_accessibility_node_events.js +++ b/devtools/server/tests/browser/browser_accessibility_node_events.js @@ -105,7 +105,6 @@ add_task(async function () { attributes: { "container-live": "polite", display: "inline-block", - "event-from-input": "false", "explicit-name": "true", id: "button", live: "polite", diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index daade1a7f29d..96699da0ed58 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -2341,7 +2341,6 @@ STATIC_ATOMS = [ Atom("contentinfo", "contentinfo"), Atom("cycles", "cycles"), Atom("datatable", "datatable"), - Atom("eventFromInput", "event-from-input"), Atom("feed", "feed"), Atom("grammar", "grammar"), Atom("gridcell", "gridcell"),