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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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