Previously, we were not firing active state change events for the options in
<select> elements when the drop-down was expanded. This leads to possibly-stale
cached 'active' state in the parent process, which can cause Firefox to report
incorrect combo box values based on stale state. Rather than fire more 'active'
state change events to fix the problem, this revision addresses the problem by
not firing 'active' state change events for combo boxes at all, and instead
relying on the selection state when determining the combo box value in the
parent process. This revision also adds a test to verify that the behavior is
as expected.
Differential Revision: https://phabricator.services.mozilla.com/D156627
For methods supported by the cache, we already delegate to RemoteAccessibleBase where the caching implementation lives.
However, there are still some less used methods which aren't supported by the cache yet.
These methods are never called by the code which Windows a11y clients interact with (MsaaAccessible and friends).
However, they can be called from XPCOM; e.g. when using the Browser Console.
For now, just early return in these cases so we don't crash.
Eventually, we'll need to unify these methods and support them with the cache enabled.
Differential Revision: https://phabricator.services.mozilla.com/D156771
We expect acc to be a local OuterDocAccessible.
However, the OuterDocAccessible might die before the top level DocAccessibleParent, in which case acc will be null.
In this case, the DocAccessibleParent is about to die anyway, so it doesn't matter that the bounds we return are slightly wrong (since they can't take the OuterDoc into account).
Differential Revision: https://phabricator.services.mozilla.com/D156773
This variable was supposed to be removed long ago in bug 813019, but the
declaration was left behind by accident, it seems.
Differential Revision: https://phabricator.services.mozilla.com/D156879
JAWS won't expose MathML without this.
We can't fully support it; we don't cache info about namespaces, for example.
However, this implementation is enough to get MathML working with JAWS.
Differential Revision: https://phabricator.services.mozilla.com/D156150
This commit adds mappings for HTML sub and sup elements, as well as ARIA
role mappings for subscript, superscript roles, with the goal of properly
exposing this information to the accessibility tree. This commit also updates
text attribute code to account for the attributes implied by those roles.
Finally, this commit updates tests to verify that the role and attribute
information is working properly.
Differential Revision: https://phabricator.services.mozilla.com/D155523
Windows a11y clients retrieve MathML markup using ISimpleDOMNode::innerHTML.
We cache innerHTML to support this, but only on math elements and only on Windows.
sdnAccessible had to be modified to support RemoteAccessible and to use the cache for this method.
Differential Revision: https://phabricator.services.mozilla.com/D155806
This can happen in a container containing no actual characters.
Previously, we would end up in an infinite loop in this case.
Differential Revision: https://phabricator.services.mozilla.com/D155570
In bug 1772170, I added code to ensure that the cached offsets are valid.
However, this didn't account for the possibility that one of the containers contained 0 characters.
In that case, offset 0 is itself invalid.
If there were also no children, this might in GetChildAtOffset being called and returning null, causing a crash when retrieving selection.
Differential Revision: https://phabricator.services.mozilla.com/D154964
HTMLTableCellAccessible::GetCellIndexes can fail via its NS_ENSURE_STATE macro,
and this patch updates its callsites to account for that possibility. In each
case, I've just copied the existing graceful-fallback behavior that the
surrounding code uses for other unexpected conditions.
Note that I'm intentionally not using NS_ENSURE_SUCCESS in my error-handling
here, to avoid redundant warning-spam. (In the failure scenario,
GetCellIndexes will already have spammed a warning, via its own aforementioned
NS_ENSURE_STATE call; it's usually not useful to repeat the warning in the
caller.)
Differential Revision: https://phabricator.services.mozilla.com/D155123
Per the ARIA spec, children of progressbar elements are purely
presentational. So, we should prune their children from the
accessibility tree. This commit adds some logic to nsAccUtils::MustPrune
to forcibly prune these children, ultimately unbreaking the experience
for screen reader users who would otherwise not be told about some ARIA
progressbars.
Differential Revision: https://phabricator.services.mozilla.com/D155307
This commit remaps the HTML address element such that it is implicitly
mapped to the group role rather than being a generic element. It also
updates a test to reflect the new role.
Differential Revision: https://phabricator.services.mozilla.com/D154910
Most importantly, this means OffsetAtPoint is now supported for cached RemoteAccessible on Windows.
I also included a drive-by fix to make ATK use the unified CharacterCount method instead of the old unnecessary conditional local/remote paths.
Differential Revision: https://phabricator.services.mozilla.com/D154628
When the cache is disabled, MsaaAccessible::GetFrom won't give us an object we can return to the client.
Instead, we must use MsaaAccessible::NativeAccessible, which knows how to return a COM proxy in this case.
Differential Revision: https://phabricator.services.mozilla.com/D153694
This required changing the RemoteAccessible implementations to return Relation instead of an array of RemoteAccessible.
Platform implementations have been updated to use the unified method where appropriate.
Differential Revision: https://phabricator.services.mozilla.com/D152959
This is basically RemoteExplicitHeadersIterator with naming generalised.
Support has been added for transferring ownership of the array into the iterator, which will be needed when the cache is disabled.
Differential Revision: https://phabricator.services.mozilla.com/D152958
Previously, Relation::Next returned a LocalAccessible.
Now, it returns an Accessible so that it can support RemoteAccessible as well.
Relation::LocalNext has been added as a convenience to return a LocalAccessible when the caller is certain that only LocalAccessible is relevant.
Callers have either been updated to use LocalNext or to handle an Accessible returned from Next.
ia2AccessibleRelation now holds an array of MsaaAccessible, as we need to hold references and we can't hold references to RemoteAccessible.
Differential Revision: https://phabricator.services.mozilla.com/D152957
1. When we receive text for a text leaf, even for an initial cache push. Previously, we only did this for a cache update. However, a client call could arrive between the tree push and the initial cache push, resulting in an incorrect offsets cache.
2. When an Accessible is moved. Previously, if a client queried an Accessible while it was being moved or if an Accessible had children before the move but no children after, the cached HyperText offsets could be invalid.
Differential Revision: https://phabricator.services.mozilla.com/D153139
This is possible if a client query arrives between the two IPDL calls for the tree and the cache.
This might even happen for an ancestor in the case of an OOP iframe, where IPDL calls for the two documents might be interspersed.
Differential Revision: https://phabricator.services.mozilla.com/D153134
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.
In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.
These patches do the following major changes to the searching APIs:
1. The ASCII case-insensitive search method was split out as
LowerCaseFindASCII, rather than using a boolean. This should be less
error-prone and more explicit, and allows the method to continue to use
narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
matching character types. I considered adding a FindASCII method which would
use narrow string literals for both wide and narrow strings but it would've
been the same amount of work as changing all of the literals to unicode
literals.
This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
algorithm or stl algorithms to reduce code complexity, and avoid the need to
carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
to booleans normally implicitly coercing to `index_type`. This should
probably be removed at some point, but may be useful during the transition.
Differential Revision: https://phabricator.services.mozilla.com/D148300
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.
Non-virtual actors can still use `nsString` if they need to on the
receiving end.
Differential Revision: https://phabricator.services.mozilla.com/D152519
Add a pref for MouseEvent.region since that wasn't un-exposed. No other
browser supports it so we can probably safely remove it, but just in
case.
Differential Revision: https://phabricator.services.mozilla.com/D152274
Attributes() might do computation that we'll just throw away; e.g. building a CachedTableAccessible.
In a content process, cached data structures like this will never get used by a client, so building them will always be wasteful.
Instead, use nsAccUtils::SetLiveContainerAttributes, which only computes live region stuff.
Differential Revision: https://phabricator.services.mozilla.com/D151799
gfxFontCache acquires and releases its mutex during various operations.
In order to keep the state internally consistent, we should only release
the lock after the full operation is complete. This involves moving the
deletion of gfxFont to outside the lock via a temporary discard array.
The expiration state should not be protected by the gfxFont's mutex
since we don't hold it during most operations. Instead we should hold
gfxFontCache's mutex because then we can guarantee the operation is
atomic, particularly when a worker wants a font, and the main thread is
aging the generations.
When a font is returned from gfxFontCache, we now return it already
removed from the tracker, and with its refcount updated. This avoids any
potential races between the expiration timer and a worker accessing the
font, as well as simplying the callers so they don't need to be aware of
addref-ing manually in case the result is to be discarded (so that it
gets readded to the tracker).
Differential Revision: https://phabricator.services.mozilla.com/D151821
gfxFontCache acquires and releases its mutex during various operations.
In order to keep the state internally consistent, we should only release
the lock after the full operation is complete. This involves moving the
deletion of gfxFont to outside the lock via a temporary discard array.
The expiration state should not be protected by the gfxFont's mutex
since we don't hold it during most operations. Instead we should hold
gfxFontCache's mutex because then we can guarantee the operation is
atomic, particularly when a worker wants a font, and the main thread is
aging the generations.
When a font is returned from gfxFontCache, we now return it already
removed from the tracker, and with its refcount updated. This avoids any
potential races between the expiration timer and a worker accessing the
font, as well as simplying the callers so they don't need to be aware of
addref-ing manually in case the result is to be discarded (so that it
gets readded to the tracker).
Differential Revision: https://phabricator.services.mozilla.com/D151821
1. Move AccessKey to base Accessible.
2. Retrieve AccessKey from the cache for RemoteAccessible.
3. Update XPCOM and platform specific code accordingly.
Differential Revision: https://phabricator.services.mozilla.com/D151202
KeyboardShortcut is only supported for XUL menu items.
XUL menu items can never be remote, so there's no point in querying this via IPDL.
Differential Revision: https://phabricator.services.mozilla.com/D151199
1. Move AccessKey to base Accessible.
2. Retrieve AccessKey from the cache for RemoteAccessible.
3. Update XPCOM and platform specific code accordingly.
Differential Revision: https://phabricator.services.mozilla.com/D151202
KeyboardShortcut is only supported for XUL menu items.
XUL menu items can never be remote, so there's no point in querying this via IPDL.
Differential Revision: https://phabricator.services.mozilla.com/D151199
We don't create Accessibles for all elements.
If an element has a global ARIA attribute when it is shown, we do create an Accessible for it.
However, previously, if we didn't initially create an Accessible for an element (e.g. no global ARIA attributes) and it subsequently gained a global ARIA attribute, we didn't create an Accessible at that point.
We now explicitly handle this case when such an attribute is added.
Differential Revision: https://phabricator.services.mozilla.com/D151348
1. When updating the row/col map, there can be overlapping cells - we even have code to support that - so don't assert that there is no existing cell.
2. When retrieving the caption, the role assertion was accidentally reversed.
Differential Revision: https://phabricator.services.mozilla.com/D151569
Previously, we used CellAt, but this returns the Accessible, discarding the CachedTableCellAccessible.
RowHeaderCells needs both, so it then called AsTableCellBase, which must walk ancestors to get the table.
We already have the table and access to its private data, so use it directly.
This is probably an insignificant performance improvement, but the unnecessary indirection was bothering me.
Differential Revision: https://phabricator.services.mozilla.com/D151571
Some markup elements expose Accessible attributes which must be retrieved from DOM; e.g. the datetime attribute of the datetime element.
We don't cache these yet for RemoteAccessible.
Previously, these were unintentionally exposed from MarkupAttributes with null values.
For now, these should be skipped instead until we have caching code for them.
This fixes crashes whenever a client tries to fetch attributes from such an element.
Differential Revision: https://phabricator.services.mozilla.com/D151659
1. Make ia2AccessibleText::UpdateTextChangeData (and sLastTextChangeAcc) use HyperTextAccessibleBase instead of HyperTextAccessibleWrap.
2. Make ProxyTextChangeEvent call UpdateTextChangeData when the cache is enabled.
3. Don't send sync text change events when the cache is enabled. They don't need to be sync because clients query the cache, not the content process a11y tree. Even if the content process a11y tree mutates, the cache can't update until in-process clients have synchronously handled the event.
Differential Revision: https://phabricator.services.mozilla.com/D139677
As part of this, aria-relevant is now exposed via object attributes.
This is necessary to ensure it is included in the cache.
There's no good reason not to expose it anyway, since we already expose the other live region attributes.
Differential Revision: https://phabricator.services.mozilla.com/D150380
RemoteAccessibleBase::Attributes will soon use the service to query markup attributes.
Thus, the service must not shut down while a client call is being handled on the UI thread.
Differential Revision: https://phabricator.services.mozilla.com/D150722
This will be needed for easier checking of aria-atomic.
It is also more efficient in terms of cache storage, since we previously pushed strings for these values.
This moves the code from GetARIAToken into NormalizeARIAToken, since GetARIAToken isn't used any more and it makes sense to handle normalization in one place.
Differential Revision: https://phabricator.services.mozilla.com/D150379
This makes it possible for it to work for RemoteAccessible.
There is a functional change here in that using the a11y tree means we traverse parents set via aria-owns, where previously we only walked the DOM ancestry.
I doubt this will have any impact in the wild and Chromium already does this anyway.
Differential Revision: https://phabricator.services.mozilla.com/D150378
Previously, these methods took a DOM nsIContent, making it impossible for them to work for RemoteAccessible.
GetMarkupMapInfoForNode has been renamed to GetMarkupMapInfoFor and has overloads for nsIContent and Accessible.
MarkupAttribute is a template which can take either, as we still need the nsIContent version elsewhere.
MarkupAttributes now only takes an Accessible, as it can get the nsIContent from the Accessible if necessary.
Differential Revision: https://phabricator.services.mozilla.com/D150377
QuerySelector can fail if the id is invalid; e.g. if it contains a quote (") character.
ErrorResult treats a failure as an exception, so it asserts.
We explicitly check for and handle failure ourselves, so use IgnoredErrorResult instead.
Differential Revision: https://phabricator.services.mozilla.com/D151564