Commit Graph

11577 Commits

Author SHA1 Message Date
Morgan Rae Reschenberg
48ff0757ca Bug 1990785: Verify text attributes exist before adding to them r=Jamie, a=RyanVM DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D266937
2025-10-03 01:41:15 +00:00
Eitan Isaacson
a5ebf1856c Bug 1975696 - Revert suppression of AXTitle introduced in bug 1901324. r=Jamie a=RyanVM
Original Revision: https://phabricator.services.mozilla.com/D261165

Differential Revision: https://phabricator.services.mozilla.com/D261203
2025-08-23 00:27:18 +00:00
James Teh
d06a39a730 Bug 1977166: When moving a RemoteAccessible, ensure it doesn't still have a parent. a=diannaS
Original Revision: https://phabricator.services.mozilla.com/D257206

Differential Revision: https://phabricator.services.mozilla.com/D258841
2025-07-28 19:33:50 +00:00
Eitan Isaacson
c288da1122 Bug 1968956 - Use await when waiting for cache in browser_invalid.js. r=morgan a=test-only
Differential Revision: https://phabricator.services.mozilla.com/D253379
2025-07-12 13:54:17 +00:00
James Teh
4f6ac0b0d5 Bug 1971642: When falling back to the next valid ARIA role, use a case insensitive comparison when skipping roles. a=dmeehan
We assume ARIA roles are case insensitive when setting up the role map entry.
In contrast, previously, when falling back to the next valid role due to the criteria for an earlier role not being met, we were using a case sensitive comparison.
This resulted in infinite recursion when an invalid role contained upper case characters because we kept trying to process the ARIA role we were already processing.
To fix this, use a case sensitive comparison here, making it consistent with other ARIA role checks.

Original Revision: https://phabricator.services.mozilla.com/D253617

Differential Revision: https://phabricator.services.mozilla.com/D253753
2025-06-16 00:16:07 +00:00
Mikhail Galanin
23319d2ebb Bug 1968547 - Modify loop to for-each to avoid indexing error. r=morgan, a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D253233
2025-06-12 21:45:24 +00:00
Morgan Rae Reschenberg
889171cae3 Bug 1968547: Add test to verify no error message event is fired when aria-invalid=false r=Jamie a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D253399
2025-06-12 21:45:22 +00:00
Mark Banner
0dae27506b Bug 1881701 - Change new .eslintrc.mjs files to modules (misc), and export as flat config. r=frontend-codestyle-reviewers,webdriver-reviewers,perftest-reviewers,geckoview-reviewers,devtools-reviewers,sync-reviewers,android-reviewers,mossop,spidermonkey-reviewers,Gijs,ohall,whimboo,nchevobbe,arai,sparky,skhamis,webcompat-reviewers,twisniewski
Differential Revision: https://phabricator.services.mozilla.com/D249951
2025-05-24 17:11:10 +00:00
Mark Banner
d7c7c5369b Bug 1881701 - Rename many ESLint files to use .mjs. r=frontend-codestyle-reviewers,perftest-reviewers,Gijs,sparky,webcompat-reviewers,twisniewski
This is separate to help preserve history of the files.

Differential Revision: https://phabricator.services.mozilla.com/D249945
2025-05-24 17:10:51 +00:00
Serban Stanca
254eb70a9d Revert "Bug 1899960 - P2: Imply an unavailable state if focusable is in unavailable subtree. r=Jamie" for casuing junit failures.
This reverts commit 5906bff6eb.

This reverts commit f491f2de6e.

This reverts commit 047d7acfa2.
2025-05-23 22:39:55 +00:00
Boris Chiou
20bcd70f17 Bug 1968217 - Fix the typo of the preference name of view transition. r=layout-reviewers,TYLin
Just a quick fix because I used the wrong preference name in the a11y test.

Differential Revision: https://phabricator.services.mozilla.com/D251037
2025-05-23 19:17:15 +00:00
Eitan Isaacson
5906bff6eb Bug 1899960 - P2: Imply an unavailable state if focusable is in unavailable subtree. r=Jamie
I decided not to use aria-disabled directly because we currently don't
cache it in the parent, and I don't think the benefit would be great
enough.

Differential Revision: https://phabricator.services.mozilla.com/D250357
2025-05-23 19:09:23 +00:00
Eitan Isaacson
f491f2de6e Bug 1899960 - P1: Don't cache implicit states. r=Jamie
This also removes some duplication and unifies the logic we use for
states that are calculated from other ones.

Differential Revision: https://phabricator.services.mozilla.com/D250356
2025-05-23 19:09:19 +00:00
Eitan Isaacson
047d7acfa2 Bug 1967813 - Check menu's frame IsOpen to determine if menu is active. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D250492
2025-05-23 19:09:16 +00:00
Boris Chiou
b628cb1e09 Bug 1922301 - Add test to make sure the view transition tree is not exposed to the accessibility tree. r=morgan,view-transitions-reviewers,emilio
We don't expose the view transition tree to the accessibility tree per
our current implementation, so only a test in this patch.

In the test, we shouldn't see any view transition pseudo-elements in the
accessibility tree.

Differential Revision: https://phabricator.services.mozilla.com/D250840
2025-05-23 01:29:02 +00:00
Atila Butkovits
f645ec7ded Revert "Bug 1899960 - P2: Imply an unavailable state if focusable is in unavailable subtree. r=Jamie" for causing Geckoview failures.
This reverts commit d4794289e7.

Revert "Bug 1899960 - P1: Don't cache implicit states. r=Jamie"

This reverts commit dd5d2cd561.

Revert "Bug 1967813 - Check menu's frame IsOpen to determine if menu is active. r=morgan"

This reverts commit 2d6a0f17e3.
2025-05-22 23:36:44 +00:00
Eitan Isaacson
d4794289e7 Bug 1899960 - P2: Imply an unavailable state if focusable is in unavailable subtree. r=Jamie
I decided not to use aria-disabled directly because we currently don't
cache it in the parent, and I don't think the benefit would be great
enough.

Differential Revision: https://phabricator.services.mozilla.com/D250357
2025-05-22 20:15:23 +00:00
Eitan Isaacson
dd5d2cd561 Bug 1899960 - P1: Don't cache implicit states. r=Jamie
This also removes some duplication and unifies the logic we use for
states that are calculated from other ones.

Differential Revision: https://phabricator.services.mozilla.com/D250356
2025-05-22 20:15:19 +00:00
Eitan Isaacson
2d6a0f17e3 Bug 1967813 - Check menu's frame IsOpen to determine if menu is active. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D250492
2025-05-22 20:15:16 +00:00
Mikhail Galanin
921153b34f Bug 1625915 - Expose validation error message via AXValidationError. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D214679
2025-05-22 18:19:40 +00:00
James Teh
eff6d5c17a Bug 360003: Add a test for character bounds of list item bullets. r=morgan
This was fixed in bug 1951833.

Differential Revision: https://phabricator.services.mozilla.com/D249711
2025-05-22 13:04:45 +00:00
James Teh
1b591364ab Bug 1951833 part 2: Make ITextRangeProvider::GetBoundingRectangles return a rectangle for a collapsed range. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D249710
2025-05-20 23:01:23 +00:00
James Teh
f66cf4466a Bug 1951833 part 1: Support line feed characters in TextLeafPoint::CharBounds. r=morgan
Previously, both literal line feed characters in pre-formatted text and HTMl <br> elements returned a rect with 0 width and/or height.
Because of the way CharBounds() was implemented, this also returned 0 for x and y.
This caused problems for clients such as Windows Text Cursor Indicator which need the rectangle for the character at the caret.
Now, we return the correct x and y coordinates.
We also return a minimum width and height of 1 to ensure clients treat it as an actual rectangle.

As part of this, CharBounds() has been refactored slightly for consistency and readability.
As a bonus, this also fixes character bounds for list item bullets (bug 360003), but a test for that will be added in a subsequent patch.

This patch also removes the special case line feed code added to TextLeafRange::WalkLineRects() in bug 1946552, since CharBounds() now handles this.

Differential Revision: https://phabricator.services.mozilla.com/D249709
2025-05-20 23:01:19 +00:00
Morgan Rae Reschenberg
9c1c6ef7b9 Bug 1966243: Expose states::INVALID via moxInvalid in mozAccessible r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D249460
2025-05-20 17:52:04 +00:00
Sylvestre Ledru
8ae54ea4f9 Bug 1519636 - Reformat recent changes to the Google coding style r=geckoview-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,nalexander,gstoll,tcampbell,janv,julienw
Updated with clang-format version 19.1.7 (taskcluster-DYvBxDZJRVqTi8E7pTSJAQ)

Differential Revision: https://phabricator.services.mozilla.com/D249880
2025-05-17 19:11:13 +00:00
Eitan Isaacson
77a5fc0c85 Bug 1867044 - Fire name change for xul labels. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D248979
2025-05-15 19:18:00 +00:00
Mark Banner
46ce829d46 Bug 1964677 - Make UrlbarProvider.isActive consistently async for inheritance consistency. r=urlbar-reviewers,jteow
Differential Revision: https://phabricator.services.mozilla.com/D247923
2025-05-15 10:40:33 +00:00
James Teh
37f125f5e9 Bug 1965607: Gracefully handle anonymous children in TextLeafPoint::ToDOMPoint. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D248723
2025-05-13 04:53:51 +00:00
James Teh
77343be3df Bug 1965216: Fail gracefully for calls to LazyInstantiator::get_accChild on the wrong thread. r=morgan
This shouldn't happen, but the COM runtime seems to do this sometimes.
I can't reproduce it and I haven't been able to fathom what causes it.
I suspect a Windows bug or a bug in some third party software.
This leads to trying to check the UIA pref from the wrong thread, which is not allowd and causes a crash.

Differential Revision: https://phabricator.services.mozilla.com/D248558
2025-05-13 04:06:23 +00:00
James Teh
1276a883d6 Bug 1965405: When reconstituting a TextLeafRange for a UiaTextRange, restrict offsets to the current lengths of Accessibles. r=morgan
This is the scenario for this bug:

1. A UIA client retrieved a range for the caret at the end of a text input at the end of a document, collapsed at (input, 2).
2. Backspace was pressed, removing the last character, so (input, 2) was no longer valid.
3. The UIA client attempted to call GetAttributeValue on the previously fetched range.
4. FindTextAttrsStart couldn't move further, so it returned the document end point, (input, 1).
5. Because the range contained (input, 2), the search point was never less than the end point, so we got stuck in an infinite loop in GetAttributeValue.

To fix this, UiaTextRange now restricts offsets to the length of the leaf Accessibles when reconstructing the TextLeafRange.

Differential Revision: https://phabricator.services.mozilla.com/D248734
2025-05-13 04:05:58 +00:00
serge-sans-paille
bf3516e81e Bug 1964489 - Avoid duplication in NS_DECLARE_STATIC_IID_ACCESSOR / NS_DEFINE_STATIC_IID_ACCESSOR r=nika,necko-reviewers,media-playback-reviewers,places-reviewers,win-reviewers,dom-storage-reviewers,xpcom-reviewers,gstoll,janv,emilio,padenot,valentin,asuth
In modern C++, static constexpr member variables are automatically
inline (aka weak) so the template trick is not needed. This also avoid
duplication and reduces the amount of parsed code. No impact on
generated binary (actually: smaller debuginfo, close to identical
binary).

Differential Revision: https://phabricator.services.mozilla.com/D247825
2025-05-08 08:05:51 +00:00
James Teh
7932ffe32b Bug 1963996: Clear the selection if IAccessibleTextSelectionContainer::setSelections is called with nSelections set to 0. r=eeejay
I removed this behaviour in bug 1951573.
Unfortunately, it turns out that contrary to the spec (which says "1 or more selections"), NVDA depends on this behaviour.
Reinstate this by supporting kRemoveAllExistingSelectedRanges in HyperTextAccessibleBase::RemoveFromSelection and using that.

Differential Revision: https://phabricator.services.mozilla.com/D247875
2025-05-08 06:52:14 +00:00
James Teh
c1029be8ea Bug 1869971: When calculating a DOM point for the end of a non-text node, use the child index for the node after that node. r=eeejay
A TextLeafPoint is always a leaf Accessible and an offset within that Accessible.
When a TextLeafPoint is created for the end of a container and the last Accessible in the container isn't text (e.g. it is an image), TextLeafPoint represents this as offset 1 within the image.
When calculating a DOM point for such a TextLeafPoint, we need to use the child index for the next DOM node.
This indicates to DOM that the point should be positioned after the node.

Differential Revision: https://phabricator.services.mozilla.com/D247874
2025-05-07 04:30:12 +00:00
James Teh
123bc5b115 Bug 1869966 part 3: When calculating a DOM point from a TextLeafPoint for a non-text node, use the child index within the parent, not an offset within the node itself. r=eeejay
For text nodes, DOM points use the character offset within the node itself, just like accessibility does.
For non-text nodes, DOM points use the child index within the parent to specify the position before or after the node.
Previously, TextLeafPoint::ToDOMPoint always used an offset within the node itself.
This meant that when the (exclusive) end point of a range was an image, we converted to a DOM point of offset 0 within the image.
As far as DOM is concerned, this includes the image.
This patch adjusts ToDOMPoint as appropriate.

As part of this, ToDOMPoint now returns a uint32_t instead of an int32_t.
This is because DOM offsets are actually uint32_t and calculating int32_t child indices is deprecated.

Differential Revision: https://phabricator.services.mozilla.com/D247873
2025-05-06 23:12:52 +00:00
James Teh
5c140ae138 Bug 1869966 part 2: Do not descend to the end of an embedded object when calculating a TextLeafPoint for the end of an IA2 selection. r=eeejay
When we descend to the end for an embedded object character, we get the position after the last character inside that embedded object.
This isn't what we want for selections because the end offset should be exclusive, not inclusive.
Descending to the end means we include the entire content of the embedded object instead of excluding it.
Instead, always descend to the start.

Differential Revision: https://phabricator.services.mozilla.com/D247872
2025-05-06 23:12:48 +00:00
James Teh
7f3da64a12 Bug 1869966 part 1: Add tests for existing IAccessibleSelectionContainer behaviour. r=eeejay
We did have support for IA2 testing when this was added.
However, because this interface is a relatively recent addition to the IA2 spec, it isn't included in the COM proxy dll included in Windows.
This means we can't run these tests without building and installing our own proxy DLL.
This has to be integrated into the Windows CI images, so we can't run these tests on CI for now and thus they're disabled on CI.
Even so, it's better to have local-only tests for this than no tests at all.

Differential Revision: https://phabricator.services.mozilla.com/D247871
2025-05-06 23:12:45 +00:00
Eitan Isaacson
052a96baee Bug 1901324 - Don't give accessibles AXTitle if they have a labelling relation. r=morgan
This is a bit risky, but I hope worthwhile.

I also changed the single labelling relation check in moxTitle and moxLabel to not allocate an NSArray.

Differential Revision: https://phabricator.services.mozilla.com/D247369
2025-05-06 22:11:11 +00:00
Eitan Isaacson
3872b9b621 Bug 1880533 - Update name when hidden text changes in aria-labelledby. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D247808
2025-05-06 08:25:41 +00:00
James Teh
f2254a1d58 Bug 1963625: Fix some cases where UIA is enabled or disabled at runtime. r=eeejay
When a UIA client first queries us, the accessibility engine hasn't yet been initialised.
Previously, this also meant that we hadn't yet called InitConsumers() to figure out which Windows clients were present.
This in turn meant that we would initially believe UIA should be enabled, even if we later realised NVDA/a Vispero product was present and then believed it should be disabled.
To fix this, call InitConsumers() appropriately if it hasn't been called yet.

Even with the above fix, the following scenario might still be possible:

1. UIA is enabled.
2. A client QueryInterfaces to IRawElementProviderSimple.
3. UIA gets disabled.
4. Only then does the client try to call a method on IRawElementProviderSimple.

In this scenario, LazyInstantiator::MaybeResolveRoot won't set mWeakUia, but the IRawElementProviderSimple method will try to use mWeakUia, causing a crash.
To fix this, add a new RESOLVE_ROOT_UIA macro used by IRawElementProviderSimple methods.
In addition to calling RESOLVE_ROOT, this also checks mWeakUia and fails gracefully if that is null.

Differential Revision: https://phabricator.services.mozilla.com/D247504
2025-05-02 00:39:31 +00:00
James Teh
fdf464542a Bug 1962317: Initial framework for accessibility engine performance testing, plus some initial tests. r=morgan
Tests go in accessible/tests/browser/performance.
They use the usual addAccessibleTask function to add a test.
Inside the task, they can time operations using the timeThis() function, which takes a name and a function to time.
As well as logging the time, this also logs all accessibility PerfStats captured during the function.
For now, output is simply logged using info().
In future, we may wish to output this data elsewhere; e.g. so it can be picked up by performance monitoring tools.
Having this single function should make extending this fairly easy without needing to rewrite tests.

Two initial tests have been included:
- browser_manyMutations.js: Test for bug 1948375.
- browser_spellingErrors.js: Test for bug 1961832.

Differential Revision: https://phabricator.services.mozilla.com/D246544
2025-04-30 04:06:36 +00:00
Eitan Isaacson
18c81c366f Bug 1467382 - Support aria-keyshortcuts. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D246695
2025-04-29 16:42:31 +00:00
Stanca Serban
430ce50b99 Backed out changeset ab60f9ab2024 (bug 1962317) for causing Linux mochitests failures in PerfStats.cpp. 2025-04-29 07:30:25 +03:00
James Teh
64fb4d889f Bug 1962317: Initial framework for accessibility engine performance testing, plus some initial tests. r=morgan
Tests go in accessible/tests/browser/performance.
They use the usual addAccessibleTask function to add a test.
Inside the task, they can time operations using the timeThis() function, which takes a name and a function to time.
As well as logging the time, this also logs all accessibility PerfStats captured during the function.
For now, output is simply logged using info().
In future, we may wish to output this data elsewhere; e.g. so it can be picked up by performance monitoring tools.
Having this single function should make extending this fairly easy without needing to rewrite tests.

Two initial tests have been included:
- browser_manyMutations.js: Test for bug 1948375.
- browser_spellingErrors.js: Test for bug 1961832.

Differential Revision: https://phabricator.services.mozilla.com/D246544
2025-04-28 22:42:59 +00:00
James Teh
a8d5b9aaf3 Bug 1957314 part 1: nsAccUtils::GetLiveRegionSetting: Don't assume the accessibility service is running. r=morgan
Some tests (e.g. Marionette and WPT) can start the accessibility service in a content process without starting it in the parent process.
When this happens, the content process will still send the accessibility tree, events, etc. to the parent process via IPDL, and the parent process will create the RemoteAccessible tree.
However, the accessibility service still isn't running in the parent process unless a client instantiates it.
Previously, nsAccUtils::GetLiveRegionSetting assumed the accessibility service was running without checking.
UIA calls this method when firing certain events, so this was causing a crash.
To fix this, just null check it.
In future, we may wish to consider not firing events if the service isn't running or some other broader solution for this situation, but I don't think it's worth investing in that now, especially as this is only relevant to tests.

I also added an assertion for the presence of the service in nsAccUtils::SetLiveContainerAttributes.
Because this is only used for setting attributes, callers already check that the service exists before calling this, but an assertion should help enforce this.

Differential Revision: https://phabricator.services.mozilla.com/D244275
2025-04-28 00:15:57 +00:00
Morgan Rae Reschenberg
65889d32d2 Bug 1960416: Skip aria-hidden subtrees during initial tree creation when aria-hidden is specified on the root element r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D246057
2025-04-24 22:15:41 +00:00
James Teh
eb0f0a9790 Bug 1961832: When queuing an event, don't append it to the array at all if it is a duplicate and duplicates aren't allowed. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D246400
2025-04-23 23:46:12 +00:00
Emilio Cobos Álvarez
5d8a203f5c Bug 1961534 - Call IMEStateManager::OnChangeFocus from nsFocusManager::FixUpFocusAfterFrameLoaderChange. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D246280
2025-04-23 11:45:00 +00:00
Makoto Kato
b97f0d47dc Bug 1961452 - Don't call SetAttached until native handle is set. r=geckoview-reviewers,ohall
This issue is a possible crash case.

Actually `SessionAccessibility.NativeProvider.setAttached` is called in
C++ constructor of `SessionAccessibility`.  But native handle is set
after calling the constructor. So when `NativeProvider.setAttached` is
called, C++ side might not set native handle yet.

So we should not call `setAttached` in the constructor.

Differential Revision: https://phabricator.services.mozilla.com/D246070
2025-04-23 06:49:59 +00:00
Butkovits Atila
5f164c40f8 Backed out changeset f7afd5cab91c (bug 1960416) for causing bustages at TreeWalker.cpp. 2025-04-23 04:20:06 +03:00
Eitan Isaacson
5e15843b04 Bug 1838502 - Don't expose a title for labels. r=morgan
THis is what VO expects, we apparently knew that but decided it wasn't worth fixing in the past

Differential Revision: https://phabricator.services.mozilla.com/D244050
2025-04-22 22:07:02 +00:00