Commit Graph

1226 Commits

Author SHA1 Message Date
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
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
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
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
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
18c81c366f Bug 1467382 - Support aria-keyshortcuts. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D246695
2025-04-29 16:42:31 +00:00
Eitan Isaacson
1e2e799eb5 Bug 1954896 - Use weak reference in RemoteAccessible::GetCachedARIAAttributes. r=Jamie,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D242955
2025-04-01 15:09:34 +00:00
Morgan Rae Reschenberg
0d750ce645 Bug 1950235: Add markers to PlatformShowHideEvent call sites r=bdekoz
Differential Revision: https://phabricator.services.mozilla.com/D239457
2025-03-10 20:11:00 +00:00
Morgan Rae Reschenberg
766d0df3f6 Bug 1950235: Add PerfStats markers for medium and low priority non-platform-specific code r=bdekoz
Differential Revision: https://phabricator.services.mozilla.com/D239446
2025-03-10 20:11:00 +00:00
James Teh
4c4cebf7e8 Bug 1951573 part 3: Implement HyperTextAccessibleBase::SetCaretOffset using TextLeafRange::SetSelection. r=eeejay
TextLeafRange::SetSelection should now be the one place where all text selections are set.
Previously, we had a separate local implementation for SetCaretOffset which differed slightly from using TextLeafRange::SetSelection.
Now, these should be equivalent, so there's no need for this separate local implementation.

Differential Revision: https://phabricator.services.mozilla.com/D240276
2025-03-05 23:42:51 +00:00
Cristian Tuns
e9b5bd777c Backed out 2 changesets (bug 1950235) for causing build bustages in LocalAccessible.cpp CLOSED TREE
Backed out changeset a7ee39abfd2a (bug 1950235)
Backed out changeset f1de564abb08 (bug 1950235)
2025-03-03 20:57:45 -05:00
Morgan Rae Reschenberg
0006dac68c Bug 1950235: Add markers to PlatformShowHideEvent call sites r=bdekoz
Differential Revision: https://phabricator.services.mozilla.com/D239457
2025-03-04 00:42:26 +00:00
Morgan Rae Reschenberg
961806856f Bug 1950235: Add PerfStats markers for medium and low priority non-platform-specific code r=bdekoz
Differential Revision: https://phabricator.services.mozilla.com/D239446
2025-03-04 00:42:25 +00:00
Morgan Rae Reschenberg
769dc36069 Bug 1904263: Adjust RemoteAccessible relations code to handle legend/fieldset label relations explicitly r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D239426
2025-03-03 20:16:16 +00:00
James Teh
6d64eda0aa Bug 1948375: After sending all mutation events for a tick to the parent process, defer accessibility updates until we receive an ACK from the parent process. r=nlapre
See the code comments in NotificationController::WillRefresh for explanation.

Differential Revision: https://phabricator.services.mozilla.com/D238585
2025-02-19 21:49:24 +00:00
Jens Stutte
5eb5987ffa Bug 1948736 - Move the global impending shutdown flag to AppShutdown. r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D238522
2025-02-18 08:18:58 +00:00
Morgan Rae Reschenberg
d1ad962aa6 Bug 1919688: Add perfstats markers for high priority DocAccessibleParent functions r=bdekoz
Differential Revision: https://phabricator.services.mozilla.com/D237648
2025-02-13 23:39:49 +00:00
Morgan Rae Reschenberg
c13f441ae6 Bug 1919688: Add perfstats marker for DocAccessibleChild::ShowEvent r=bdekoz
Depends on D237276

Differential Revision: https://phabricator.services.mozilla.com/D237647
2025-02-13 23:39:49 +00:00
Nathan LaPre
b44ba6655f Bug 1938958: Set kMaxAccsPerMessage to 1000, send once one batch is full, r=Jamie
This revision modifies AppendMutationEventData such that it can actually send
mutation event batches over IPC. Previously, we were waiting for massive batches
of mutation events before sending, which leaves the parent process with little
to do until it receives one big message. While more efficient from the content
and parent process' perspective individually, the overall load time of pages
suffered from having such large batch sizes sent after all mutation events have
been calculated. The overall page load time benefits from having both content
and parent processes execute accessibility-related tree building code in
parallel, even though there is some inefficiency associated with interrupting
tree-building to serialize, send, and receive an IPC message more often.

After performance testing, we've found that we can accumulate Accessibles in
events up to a reasonable max before sending the batch. From testing, 1000 looks
like a good number. This gives us big performance wins for loading pages, while
maintaining our performance in fast-mutating pages.

Differential Revision: https://phabricator.services.mozilla.com/D235515
2025-02-05 23:54:40 +00:00
James Teh
915b26b603 Bug 1945036: RemoteAccessible::ContainsPoint: When walking the lines of a text leaf, if the line ends with an empty rect (line feed), use the rect for the previous character. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D236332
2025-02-05 07:27:19 +00:00
James Teh
5514186a41 Bug 1945354: Remove unnecessary retrieval of BrowserBridgeParent in DocAccessibleParent::AddChildDoc. r=nlapre
Previously, there was code here that needed to use the BrowserBridgeParent, but this has since been removed.
The IsToplevelInContentProcess check is sufficient by itself for the purpose here.
This is just cleanup; there should be no functional change.

Differential Revision: https://phabricator.services.mozilla.com/D236488
2025-02-03 01:51:44 +00:00
James Teh
c27eb29aff Bug 1938624 part 5: Remove Accessible::InputType, which is now unused. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D233325
2025-02-03 01:47:44 +00:00
Alexandru Marc
6ac9f66aa8 Backed out 5 changesets (bug 1938624) for causing multiple perma failures CLOSED TREE
Backed out changeset 7d0d375749dd (bug 1938624)
Backed out changeset d94f65a880a8 (bug 1938624)
Backed out changeset b5eb92a5953f (bug 1938624)
Backed out changeset 90842ecb4293 (bug 1938624)
Backed out changeset 7c0e1419e6b5 (bug 1938624)
2025-01-29 11:33:36 +02:00
James Teh
7e0c702662 Bug 1938624 part 5: Remove Accessible::InputType, which is now unused. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D233325
2025-01-29 04:30:52 +00:00
Nathan LaPre
38dde5b1b0 Bug 1939665: Fix counting error in a11y mutation event batching, r=Jamie
This revision modifies the way that Gecko batches accessibility mutation
events to avoid a couple bad situations. Before this patch,
AppendMutationEvent would allow mCurrentBatchAccCount to be equal to
kMaxAccsPerMessage when it returned. This seems fine, but causes
problems because InsertIntoIpcTree checks mCurrentBatchAccCount when
creating perfectly-sized show events. If we enter InsertIntoIpcTree when
mCurrentBatchAccCount is equal to kMaxAccsPerMessage, we'll push an
empty show event erroneously. If we push a batch of size
kMaxAccsPerMessage within InsertIntoIpcTree, the next batch we try to
send may be larger than kMaxAccsPerMessage, causing an assert.

This patch addresses both issues by resetting mCurrentBatchAccCount to 0
when we append a mutation event that gets the batch count to
kMaxAccsPerMessage. This makes mCurrentBatchAccCount work properly in
InsertIntoIpcTree.

Differential Revision: https://phabricator.services.mozilla.com/D233565
2025-01-09 01:19:10 +00:00
Nathan LaPre
93ff9682eb Bug 1774918: Consolidate accessibility mutation events in fewer IPC messages, r=Jamie,geckoview-reviewers,m_kato
This revision modifies the way that ProcessMutationEvents works. Rather than
firing mutation events immediately, it instead causes them to be queued on
DocAccessibleChild via HandleAccEvent. The code then fires the events in batches
with a new IPC method, SendMutationEvents. The net effect of this change is a
significant reduction in pressure on the IPC system, in favor of fewer, larger
messages. For pages that generate many mutation events often, this represents a
big win for performance. Without this, the IPC queue can get backed up, failing
to keep up with the amount of accessibility IPC messages as they flood in.

The method of batching is carefully written to maximize the amount of
accessibles that can be touched in a mutation event batch without going
over the IPC message size limit. This revision does not implement size
tracking, but does make a reasonable approximation. With these changes,
heterogenous mutation event types can sit together in batches, including
sub-batches of show events. A side effect of this change is that initial
page load is further amalgamated; multiple document children that
produce separate calls to InsertIntoIpcTree now use this queueing
mechanism and can have their show events sent together.

Some messages may fire differently from their former ordering with this change,
particularly EVENT_MENUPOPUP_END for content processes. However, that event
appears to have been fired out of order with the existing code, meaning
that this change represents a fix to that ordering issue as well.

Finally, this revision makes a slight modification to an Android test
for clarity and correctness. I discovered this issue while debugging
event ordering and realized it was valuable to fix.

Differential Revision: https://phabricator.services.mozilla.com/D229842
2024-12-18 20:53:52 +00:00
James Teh
b8f1e1a37e Bug 1794780: Don't expose group position attributes in Accessible::Attributes. r=eeejay
Windows screen readers must call IAccessible2::attributes for every show or text inserted event in order to determine whether the inserted content is within a live region, since this is only exposed via an object attribute.
These attributes include group position attributes: posinset, setsize and level.
When thousands of items are being inserted into a container such as a list, these queries can become expensive, even despite some of the information being cached.
For IA2, including group position attributes is redundant in most cases, since there is a dedicated IAccessible2::groupPosition property for this purpose.

Similarly, Mac code sometimes calls Accessible::Attributes, but it never uses the group position attributes, since it can use Accessible::GroupPosition() instead.
That said, I don't know of a case where this is actually a problem in practice on mac.

To address this:

1. No longer return group position attributes in Accessible::Attributes.
2. XPCOM clients, including tests and DevTools, still depend on these attributes, so update xpcAccessible::GetAttributes to include them.
3. ATK has no dedicated group position query, so update the ATK code to include these attributes too.
4. On Android, we could call GroupPosition directly, but it's easier to just pass AccAttributes to AccessibleWrap::GetRoleDescription, so include these attributes there too.
5. As an exception, IA2 requires the level attribute for headings, so include them just for roles::HEADING.

Differential Revision: https://phabricator.services.mozilla.com/D231653
2024-12-18 06:01:37 +00:00
Morgan Rae Reschenberg
298696a753 Bug 1899658: Cache visual viewport offset and consider it in bounds calculation. r=nlapre,botond,Jamie,emilio
Differential Revision: https://phabricator.services.mozilla.com/D228266
2024-11-23 08:55:19 +00:00
Norisz Fay
067619a122 Backed out changeset 17c06ee2f513 (bug 1899658) for causing bustages on RootAccessible.cpp CLOSED TREE 2024-11-23 06:58:50 +02:00
Morgan Rae Reschenberg
625470f083 Bug 1899658: Cache visual viewport offset and consider it in bounds calculation. r=nlapre,botond,Jamie,emilio
Differential Revision: https://phabricator.services.mozilla.com/D228266
2024-11-23 02:03:11 +00:00
Andrew McCreight
b3623f30a2 Bug 1931877, part 2 - Replace 2 arg MOZ_DIAGNOSTIC_ASSERT(false) with MOZ_DIAGNOSTIC_CRASH. r=necko-reviewers,win-reviewers,glandium,rkraesig,valentin
Differential Revision: https://phabricator.services.mozilla.com/D229361
2024-11-20 16:37:50 +00:00
serge-sans-paille
262f78c07f Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Alexandru Marc
a5eb905bf4 Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille
07101ac24d Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
004e704b22 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille
2c916d4973 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Nathan LaPre
bdd96ccf33 Bug 1794974: Part 5: Add code that requests new cache domains to remote accessibles, r=Jamie
This revision adds code everywhere necessary to request cache domains. These
requests are a response to assistive technology queries. The revision also adds
asserts and other safety mechanisms to ensure that we have the right information
before responding. If an AT requests something that Gecko doesn't have an answer
for, we return a default value and hope they'll ask again once we have the info.

Differential Revision: https://phabricator.services.mozilla.com/D220039
2024-09-09 23:02:20 +00:00
Nathan LaPre
85ad293bff Bug 1794974: Part 2: Add ability to query and send individual cache domains, r=Jamie
This revision adds the capability of querying and sending information about
individual cache domains. It introduces the concept of active cache domains to
the accessibility service: cache domains that we think clients need. Conversely,
cache domains that clients don't need are inactive, and we avoid doing any work
to push information about those domains. This revision adds an IPC mechanism for
setting cache domains. It adds a way for content process documents to enable,
gather, and send to the parent process information from all of their accessibles
that's newly needed. It adds a way to instantiate new accessibility services
with a predetermined set of cache domains. It adds a mechanism for local accs to
use in BundleFieldsForCache, but doesn't implement it yet (see next revision).

Differential Revision: https://phabricator.services.mozilla.com/D220036
2024-09-09 23:02:19 +00:00
James Teh
06bd8e797f Bug 1917132: When clearing a RemoteAccessible's parent, set its cached IndexInParent to -1. r=nlapre
We set the cached IndexInParent to -1 in RemoveChild, among other places.
However, when a RemoteAccessible is moved, we clear its children array without calling RemoveChild (in DocAccessibleParent::ShutdownOrPrepareForMove).
We already call SetParent(nullptr) on the children to clear the parent, so set the cached IndexInParent to -1 in SetParent when the supplied new parent is null.

Differential Revision: https://phabricator.services.mozilla.com/D221288
2024-09-06 09:54:46 +00:00
James Teh
d62a020f3e Bug 1768396: Cache IndexInParent on RemoteAccessible. r=nlapre
Similar to LocalAccessible, IndexInParent is kept in an instance variable.
Upon insertion or removal, the index is updated on all impacted children.

Differential Revision: https://phabricator.services.mozilla.com/D172756
2024-09-04 02:22:43 +00:00
James Teh
826253cb88 Bug 1798620 part 2: Remove DocAccessibleParent::mParentDoc. r=eeejay
We have RemoteAccessible::mParent and RemoteAccessible::mDoc, so DocAccessibleParent::mParentDoc was redundant.
Aside from the redundancy, this was one extra thing we needed to keep up to date and reason about.

This involved changing the call to RemoveChildDoc in Destroy to use Unbind instead because Unbind clears the parent RemoteAccessible, but RemoveChildDoc didn't.
That meant we had a dangling RemoteAccessible::mParent pointer, which was always a problem, but is more problematic now that we no longer have mParentDoc and the destructor checks the parent document.
Since Unbind is the only caller of RemoveChildDoc, RemoveChildDoc has been merged into Unbind.
This means there is now only a single place where child documents are unbound from their parent, which should make things easier to reason about.

Differential Revision: https://phabricator.services.mozilla.com/D218802
2024-08-09 01:45:31 +00:00
James Teh
eaee070607 Bug 1798620 part 1: Make RemoteAccessible::mParent a pointer instead of an id. r=eeejay
While an id was slightly safer, it also required a hash lookup every time we retrieved a parent.
This got expensive when there was a lot of tree walking, particularly given that we walk ancestors in some cases and we have to get the parent for NextSibling and PrevSibling.
Instead, mParent is now a RemoteAccessible pointer.
mChildren is already raw pointers (even when crossing documents) and we haven't encountered problems there recently, so I don't anticipate safety problems here.

Differential Revision: https://phabricator.services.mozilla.com/D218801
2024-08-09 01:45:31 +00:00
James Teh
49df0104b0 Bug 1905211 part 3: Introduce TextOffsetAttribute struct and support it as a serialisable attribute value. r=morgan
See the code comments for details.
We will soon use this for spelling errors, etc.

Differential Revision: https://phabricator.services.mozilla.com/D217064
2024-08-05 02:54:36 +00:00
Masayuki Nakano
44aae6e962 Bug 1909577 - Make some nsFocusManager::GetFocusedElement() users use its static version instead r=emilio,credential-management-reviewers,issammani
Now, we have `nsFocusManager::GetFocusedElementStatic()` which returns focused
element if the `nsFocusManager` instance is available.  Therefore, if
`nsFocusManager::GetFocusedElement()` users do not use other methods of
`nsFocusManager`, they can use `nsFocusManager::GetFocusedElementStatic()` and
make themselves simpler.

Note that some callers return early if `nsFocusManager` is not available, but
they do not return error and `nsFocusManager` instance is available in most
time of the life time of the process.  Therefore, we can simply stop using the
early return.

Differential Revision: https://phabricator.services.mozilla.com/D217527
2024-07-25 00:33:58 +00:00
Eemeli Aro
453c4e04ad Bug 1907422 - Rename "click ancestor" as "clickAncestor". r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D216335
2024-07-15 04:46:18 +00:00
James Teh
1c4d2bfbb4 Bug 1901676: Set lastParent and lastParentID in DocAccessibleParent::RecvShowEvent. r=eeejay
In bug 1779578, I changed the way a11y trees are serialised such that the parent id is included for each Accessible.
When de-serialising in DocAccessibleParent::RecvShowEvent, in order to avoid a theoretical performance regression caused by repeatedly looking up the same parent, I added an optimisation to use the last parent if it is the same as the current parent.
Unfortunately, it seems I never actually set the lastParent and lastParentID variables, so this optimisation was a no-op!

This is a micro-optimisation: it doesn't seem to make any observable difference.
However, it seems silly to have effectively dead code and it's a very straightforward fix.

Differential Revision: https://phabricator.services.mozilla.com/D213177
2024-06-12 00:56:29 +00:00
James Teh
1d5a160e2e Bug 1813976: Support RemoteAccessible::Language on non-HyperText Accessibles. r=morgan
1. HyperTextAccessibles already cache language and RemoteAccessible::Language uses this.
2. Previously, we didn't cache language for a non-text, non-HyperText Accessible at all. This includes images and HTML radio buttons. Now we cache it as a top level attribute in this case and return it in RemoteAccessible::Language.
3. We previously cached language for a text (leaf) Accessible where the language differed from its parent, but we never used this in RemoteAccessible::Language, only when calculating text attributes. Now we use it in RemoteAccessible::Language as well.
4. Where a text (leaf) Accessible's language is the same as its parent, RemoteAccessible::Language now gets this from the parent.

Differential Revision: https://phabricator.services.mozilla.com/D212503
2024-06-05 23:51:11 +00:00
James Teh
ed6f0308c6 Bug 1898198: Fix RemoteAccessible::TakeFocus when the browser UI has focus. r=eeejay
Previously, this didn't move the focus at all in this case.

Differential Revision: https://phabricator.services.mozilla.com/D211314
2024-05-26 21:50:29 +00:00
Morgan Rae Reschenberg
3c047cfc64 Bug 1895408: Add support for exposing critical, supoptimal, optimal meter values via AXValueDescription r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D209615
2024-05-21 22:11:05 +00:00
Nika Layzell
35816da309 Bug 1875528 - Part 1: Make IProtocol hold a strong reference to manager, r=ipc-reviewers,mccr8
This makes accessing `Manager()` on an IPDL protocol safer, and replaces the
previous ActorLifecycleProxy reference, which would only keep the manager alive
until IPDL drops its reference.

Unfortunately this introduces some leaks due to reference cycles, which will be
fixed in follow-up parts.

Differential Revision: https://phabricator.services.mozilla.com/D198624
2024-04-22 17:13:22 +00:00