1. Text nodes can be created in the DOM just because there was white space in the source, but this isn't always visible.
We shouldn't create an Accessible in the invisible case.
However, there could be an inline frame after/before an invisible text node, so we still need to check for that.
2. We should create div Accessibles if there are inline-block children such as buttons.
Previously, we weren't doing this because these aren't caught by IsInlineFrame.
We now use IsInlineOutside, which also catches text and br.
Aside from being a bug, this fix was needed in this patch to fix tests which previously created div Accessibles because of invisible text nodes, but lost the Accessibles once this was fixed.
3. Similarly, we should create div Accessibles if there is a previous text sibling.
Again, IsInlineFrame wasn't catching these, but IsInlineOutside does.
4. Adjust various tests to fix assumptions based on the previous behaviour.
Some needed role="none" to force flattening, while some needed an id to force creation.
Differential Revision: https://phabricator.services.mozilla.com/D92170
This uses the Pivot class to search backwards and forwards from the current offsets until either end is reached, or an accessible that is either a line break or has a block frame, is found, and therefore constitutes a boundary of interest.
Differential Revision: https://phabricator.services.mozilla.com/D91407
In many cases with wpt, most of the tests in the file pass, but it is rather time consuming to annotate
.ini files case by case.
Differential Revision: https://phabricator.services.mozilla.com/D91977
This uses the Pivot class to search backwards and forwards from the current offsets until either end is reached, or an accessible that is either a line break or has a block frame, is found, and therefore constitutes a boundary of interest.
Differential Revision: https://phabricator.services.mozilla.com/D91407
Instead of having the web area be the implicit root, the search results should
exclusively be descendants of the target element that the search is called on.
Differential Revision: https://phabricator.services.mozilla.com/D91826
The left and right line getters don't seem to be used often by voiceover,
so I am not sure if they always return the expected result.
Differential Revision: https://phabricator.services.mozilla.com/D90938
There are going to be a whole bunch of things we want to check for each
text marker in a document. I think loops should be avoided as much as possible,
but this lets us store a single array with everything we expect for each marker.
This is going to expand in the future.
Differential Revision: https://phabricator.services.mozilla.com/D90937
There are at least 8 different methods for getting a range from an offset:
1. left word
2. right word
3. line
4. left line
5. right line
6. sentence
7. paragraph
8. range with same style.
Having a single wrapper and IPDL method for all of those with an enum would remove
a lot of redundancies.
Differential Revision: https://phabricator.services.mozilla.com/D90936
This check is a remnant of the first version of e10s a11y, where there was no sandbox and content processes could expose their own HWNDs.
We return early if IPCAccessibilityActive(), which is now always true when running in a content process, so this check will never be hit.
If it *were* hit, this would cause serious breakage now, so having this in the code only serves to confuse things at best.
Differential Revision: https://phabricator.services.mozilla.com/D91233
This patch is similar to part 4 but for Android a11y.
Conversions over to `NativeWeakPtr` are pretty straight forward thanks to the
type system. Basically we take a `NativeWeakPtr`, call `Access()` on it, and
if the accessor is truthy, then we call whatever methods we need to call.
Creation of new pointers is done using `NativeWeakPtrHolder::Attach()` and
detaching of strong references is done by `NativeWeakPtr::Detach()`.
Differential Revision: https://phabricator.services.mozilla.com/D87365
Changes to nsIScrollableFrame.h cause the world to rebuild which I find annoying.
This removes the inclusion into Element.h which is responsible for the
world-rebuilding and is relatively easy to eliminate. A bunch of usages of
nsIScrollableFrame get moved from .h files into .cpp files and I include the
header into .cpp files as needed.
Differential Revision: https://phabricator.services.mozilla.com/D90735
If in a textarea, a blank line is inserted, we need to return the offsets of just that new inner paragraph, or the braille display of a screen reader will show the previous line and not a blank one.
Differential Revision: https://phabricator.services.mozilla.com/D90655
1. Make sure the paragraph text and start and end ofsets returned for offsets on either the text or its adjacent br always match.
2. For a single line break at the beginning of the enclosing paragraph, or two consecutive line breaks, treat the second one as its own paragraph without text, and its start offset corresponding to its offset, and end offset being 1 greater.
3. Add a test case exercising all cases.
Differential Revision: https://phabricator.services.mozilla.com/D90355
Tagging onto what we already do for getting line offsets, also doing the same when the paragraph selection is requested.
Differential Revision: https://phabricator.services.mozilla.com/D90238
For TextBeforeOffset and TextAfterOffset, bail out with an empty text and 0-initialized out integers if the boundary type is nsIAccessibleText::BOUNDARY_PARAGRAPH.
Differential Revision: https://phabricator.services.mozilla.com/D90115
When a doc does not have top-level DOM group, or consists of a single leaf,
we need to insert a generated root group. The rotor API expects this and uses
it for boundary detection.
Differential Revision: https://phabricator.services.mozilla.com/D90174
1. Make sure the paragraph text and start and end ofsets returned for offsets on either the text or its adjacent br always match.
2. For two consecutive line breaks, treat the second one as its own paragraph without text, and its start offset corresponding to its offset, and end offset being 1 greater.
3. Add a test case exercising all cases.
Differential Revision: https://phabricator.services.mozilla.com/D90355
Tagging onto what we already do for getting line offsets, also doing the same when the paragraph selection is requested.
Differential Revision: https://phabricator.services.mozilla.com/D90238
For TextBeforeOffset and TextAfterOffset, bail out with an empty text and 0-initialized out integers if the boundary type is nsIAccessibleText::BOUNDARY_PARAGRAPH.
Differential Revision: https://phabricator.services.mozilla.com/D90115
When a doc does not have top-level DOM group, or consists of a single leaf,
we need to insert a generated root group. The rotor API expects this and uses
it for boundary detection.
Differential Revision: https://phabricator.services.mozilla.com/D90174
Mostly mechanical change, with some extra work where non-literal names are provided.
Also, when this is the only profiler call in a file, `#include "GeckoProfiler.h"` can be changed to `#include "mozilla/ProfilerMarkers.h"`.
Differential Revision: https://phabricator.services.mozilla.com/D89415
Currently used mostly by Twitter and Facebook to allow them to specify which virtual quick navigation keys assistive technologies should not use when in those web applications, but instead pass them through to the browser. JAWS is currently the only known assistive technology making use of this feature.
This works in Chrome and the new Edge, but not in Firefox, because JAWS stopped using ISimpleDOM in Firefox, which no longer gave them access to this attribute.
This bug is to allow exposure of the non-standardized data-at-shortcutkeys attribute value via a same-named IAccessible2 and ATK Object Attribute.
Differential Revision: https://phabricator.services.mozilla.com/D86181
Canvas only has one context, and that assumption is pretty baked into
the code, so having an API that pretends otherwise is silly.
Differential Revision: https://phabricator.services.mozilla.com/D88990
This patch was generated by running:
```
perl -p -i \
-e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF8toUTF16\((.*)\);/\1CopyUTF8toUTF16(\3, \2);/;' \
-e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF16toUTF8\((.*)\);/\1CopyUTF16toUTF8(\3, \2);/;' \
$FILE
```
against every .cpp and .h in mozilla-central, and then fixing up the
inevitable errors that happen as a result of matching C++ expressions with
regexes. The errors fell into three categories:
1. Calling the convert functions with `std::string::c_str()`; these were
changed to simply pass the string instead, relying on implicit conversion
to `mozilla::Span`.
2. Calling the convert functions with raw pointers, which is not permitted
with the copy functions; these were changed to invoke `MakeStringSpan` first.
3. Other miscellaneous errors resulting from over-eager regexes and/or the
replacement not being type-aware. These changes were reverted.
Differential Revision: https://phabricator.services.mozilla.com/D88903
This patch is similar to part 4 but for Android a11y.
Conversions over to `NativeWeakPtr` are pretty straight forward thanks to the
type system. Basically we take a `NativeWeakPtr`, call `Access()` on it, and
if the accessor is truthy, then we call whatever methods we need to call.
Creation of new pointers is done using `NativeWeakPtrHolder::Attach()` and
detaching of strong references is done by `NativeWeakPtr::Detach()`.
Differential Revision: https://phabricator.services.mozilla.com/D87365
It seems that VoiceOver expects AXDescriptionList and AXDescription
as subroles in order to report the correct number of items in a dl.
Differential Revision: https://phabricator.services.mozilla.com/D88890
Print preview documents don't get DocAccessibles because this currently causes crashes and doesn't provide much value.
However, we still want to tell a11y clients something useful when a print preview document gets focus, rather than a11y focus just going nowhere.
Therefore, we allow a11y focus to land on the OuterDocAccessible (browser element) in this case.
Differential Revision: https://phabricator.services.mozilla.com/D87997
This patch is similar to part 4 but for Android a11y.
Conversions over to `NativeWeakPtr` are pretty straight forward thanks to the
type system. Basically we take a `NativeWeakPtr`, call `Access()` on it, and
if the accessor is truthy, then we call whatever methods we need to call.
Creation of new pointers is done using `NativeWeakPtrHolder::Attach()` and
detaching of strong references is done by `NativeWeakPtr::Detach()`.
Differential Revision: https://phabricator.services.mozilla.com/D87365
Before Fission, FocusManager::FocusedDOMNode rejected a11y focus on remote XUL browsers by checking EventStateManager::IsRemoteTarget.
In bug 1594623, code was added to FocusManager::ProcessDOMFocus to prevent a11y focus on OuterDocAccessibles in order to reject focus on OOP iframes.
In bug 1635784, EventStateManager::IsRemoteTarget was renamed to EventStateManager::IsTopLevelRemoteTarget, and EventStateManager::IsRemoteTarget now checks for OOP iframes as well.
This allows us to unify rejection of a11y focus on remote OuterDocAccessibles in FocusManager::FocusedDOMNode.
Differential Revision: https://phabricator.services.mozilla.com/D87996
We need a sync IPC call for this because otherwise the number of smaller sync messages we would need to call would be variable.
Differential Revision: https://phabricator.services.mozilla.com/D88076
Print preview documents don't get DocAccessibles because this currently causes crashes and doesn't provide much value.
However, we still want to tell a11y clients something useful when a print preview document gets focus, rather than a11y focus just going nowhere.
Therefore, we allow a11y focus to land on the OuterDocAccessible (browser element) in this case.
Differential Revision: https://phabricator.services.mozilla.com/D87997
Before Fission, FocusManager::FocusedDOMNode rejected a11y focus on remote XUL browsers by checking EventStateManager::IsRemoteTarget.
In bug 1594623, code was added to FocusManager::ProcessDOMFocus to prevent a11y focus on OuterDocAccessibles in order to reject focus on OOP iframes.
In bug 1635784, EventStateManager::IsRemoteTarget was renamed to EventStateManager::IsTopLevelRemoteTarget, and EventStateManager::IsRemoteTarget now checks for OOP iframes as well.
This allows us to unify rejection of a11y focus on remote OuterDocAccessibles in FocusManager::FocusedDOMNode.
Differential Revision: https://phabricator.services.mozilla.com/D87996
We need to navigate past bullets when moving markers by character or word,
but we need to still include bullets when retrieving the string of a given
marker range.
Differential Revision: https://phabricator.services.mozilla.com/D87813
The fact that this control is a slider is communicated through its role.
Having the word "slider" in the label is thus redundant and results in unnecessary verbosity for screen reader users.
Differential Revision: https://phabricator.services.mozilla.com/D87401
1. Label it.
2. Expose the position and duration as its value text.
The raw numeric value exposed previously wasn't meaningful to users.
3. Hide the progressBar for a11y.
While the scrubber and progressBar are visually combined, they are exposed as entirely separate controls for a11y.
As well as duplicating information, progress bars are automatically reported by screen readers even if they aren't focused, which intrudes on the audio being played.
4. Remove tabindex="-1" on the progressBar.
A progress element isn't focusable by default.
tabindex="-1" makes it programmatically focusable (but not tabbable).
This isn't interactive, so there's no reason for this to be programmatically focusable.
Moreover, this is now aria-hidden and aria-hidden elements should never be focusable.
Differential Revision: https://phabricator.services.mozilla.com/D87400
This uses the Gecko logging framework. To get debug logs set MOZ_LOG to
"MacAccessibility:4". To get verbose logging, set it to "MacAccessibility:5".
Differential Revision: https://phabricator.services.mozilla.com/D86618
It was only ever set to the same value as its default, except in
comm-central, where it is unset, but in directories that now don't link
anything (they did back when binary components were a thing).
Differential Revision: https://phabricator.services.mozilla.com/D85381
It was only ever set to the same value as its default, except in
comm-central, where it is unset, but in directories that now don't link
anything (they did back when binary components were a thing).
Differential Revision: https://phabricator.services.mozilla.com/D85381
The abstract observer base classes are moved to a separate header file
nsRefreshObservers.h and the includes are adjusted accordingly.
Some method implementations are moved to the corresponding implementation files
to avoid the need to include the nsRefreshDriver.h file in the header.
Differential Revision: https://phabricator.services.mozilla.com/D85764
The new pivot boundaries might consist of accessibles that don't exist
yet in the parent process proxy tree.
I guess we can tweak the timing of the pivot boundaries message to be
sent only after remote tree construction. But this seems like an edge
case that quickly gets corrected after the next cache refresh.
Differential Revision: https://phabricator.services.mozilla.com/D85912
There's two issues being fixed here - the first is that no-unused-vars now reports against the last instance of the unused variable. The second is no-dupe-else-if is now on by default.
Depends on D84816
Differential Revision: https://phabricator.services.mozilla.com/D84818
When an Accessible is shut down, there might still be external references to it, so we keep the instance alive.
We don't want to reuse the id until all references are released, so we only release the id in the destructor (which runs when all references are released).
Previously, we were clearing the id variable in Shutdown, which meant we couldn't release the id in the destructor!
This meant we always leaked ids, never reusing them.
Now, we don't clear the id in Shutdown.
Differential Revision: https://phabricator.services.mozilla.com/D84653
I split the switch statement into two: the first switch determines the
MOX target accessible. The second one does all the rest. This makes it more
readable and scalable when we add more events that need to be accompanied with
data.
Differential Revision: https://phabricator.services.mozilla.com/D84053
This patch adds several new parameters:
* AXLeftWordTextMarkerRangeForTextMarker
* AXRightWordTextMarkerRangeForTextMarker
* AXStartTextMarkerForTextMarkerRange
* AXEndTextMarkerForTextMarkerRange
* AXNextTextMarkerForTextMarker
* AXPreviousTextMarkerForTextMarker
Our word boundaries API is pretty buggy. Instead of trying to
resolve or triage each issue I found, I added todo tests
for them.
Differential Revision: https://phabricator.services.mozilla.com/D83680
For remote documents, the DocAccessibleChild isn't created until the tree is constructed.
This means we can't send events to the parent process and thus to the client.
We shouldn't fire these events in the first place, since this makes events inconsistent for local and remote documents.
Differential Revision: https://phabricator.services.mozilla.com/D83605
This causes the browser to steal focus from any element that was focused prior
to the completion of the remoteness flip. This is particularly a problem for
fission because every cross-origin navigation requires a process switch.
This code is still necessary for "normal" session restores (see bug 1410591),
but focus is handled elsewhere for remote navigations.
Differential Revision: https://phabricator.services.mozilla.com/D82783
An accessible can be hidden twice in a mutation event queue. With the first
time representing a move. Instead of queueing a second hide event,
simply drop it.
Differential Revision: https://phabricator.services.mozilla.com/D83373
Accessible::RootAccessible() returns null on the ApplicationAccessible.
We weren't null checking this previously, so QueryService for SID_IAccessibleContentDocument on the ApplicationAccessible in a content process would crash.
This is rare, but JAWS does sometimes trigger it.
Differential Revision: https://phabricator.services.mozilla.com/D83452
DynamicIA2Data can be built to be transmitted in two different ways:
1. As part of the payload included in the stream when an accessible is marshaled; or
2. As an out parameter returned by IGeckoBackChannel::Refresh().
DynamicIA2Data includes arrays for row/column header ids.
Normally, such arrays would be allocated by CoTaskMemAlloc and freed by CoTaskMemFree.
However, in the first case, the struct is actually marshaled by RPC encoding functions, not by COM itself.
This means we must use midl_user_allocate/free, lest we crash.
We previously used midl_user_allocate/free for the second case as well.
Unfortunately, it turns out that this too causes crashes.
To fix this, we now use different memory allocation functions depending on how the struct is transmitted.
This patch also cleans up the old DynamicIA2Data in the client before calling IGeckoBackChannel::Refresh.
Previously, we didn't do this, which would have resulted in a leak.
Differential Revision: https://phabricator.services.mozilla.com/D82823
These classes do a few things:
1. They implement and abstract common text operations, for example:
(a) comparing two markers to know which one precedes the other.
(b) text retrieval for ranges
(c) geometric bounds for ranges
(d) etc.
2. They can be converted to and from AXTextMarker(Range)s. Since the AXTextMarker
should not contain a raw pointer since there is a potential for use-after-free,
we need to lookup the referenced accessible in its document to know that it still exists.
Note: mozTextAccessible got pushed to another unified source file, so we need to
declare some stuff for it. Ideally we would be detecting these kinds of things sooner.
Differential Revision: https://phabricator.services.mozilla.com/D81760
The delegate is associated with accessible documents (either local or remote).
I made a separate protocol for all the text marker stuff as it really is a seperate API.
Differential Revision: https://phabricator.services.mozilla.com/D81759
AXTextMarker and AXTextMarkerRange are opaque types that are not queried or
manipulated by the AT. For tests, we need to be able to retrieve them,
and pass them back.
This patch generalizes the wrapper we already had in nsIAccessibleMacInterface
and allows other types to be wrapped.
Differential Revision: https://phabricator.services.mozilla.com/D81758
The DocProxyAccessibleWrap for an OOP iframe document is always created before we know its parent.
Previously, this resulted in the document getting an id of -1, which is only valid for the root document.
It also broke subsequent assumptions once the parent was set later.
Because we don't have the parent in this case, we can't add the document's id to its parent's hash table.
To deal with this, we no longer add any document to its parent's hash table.
Instead, when finding an accessible by id, we just check the id of each child document before checking that child document's hash table.
Differential Revision: https://phabricator.services.mozilla.com/D81959
The IPC docs of the first/last nodes are not guaranteed to exist. This
could happen early on when the child docs are still hanging and have not
yet been processed in the NotificationController.
Differential Revision: https://phabricator.services.mozilla.com/D81883