Previously, scrolling start events always fired on an Accessible for an element, never a text leaf.
However, a text fragment starts in a text leaf node and there may be many other children of the parent element prior to the start of the text fragment.
We want to get a11y clients as close as possible to the fragment, so fire the event on the text leaf node instead.
Unfortunately, we can't fire the Windows event on text leaf nodes, so we have to override this to use the parent in Windows specific code.
Fortunately, we can expose the highlight on Windows via text attributes, so clients can find out exactly what is highlighted, albeit with a bit more work.
This text leaf change is of most benefit on Android, where we can't expose the highlight, but we can move accessibility focus to a text leaf.
Differential Revision: https://phabricator.services.mozilla.com/D226587
The target might be an element for which we don't create an Accessible; e.g. a <b> element.
Previously, we wouldn't fire an event in NotifyOfAnchorJumpTo and would instead defer the event until the next document focus.
However, the document might already have focus, in which case we won't fire this event when the user expects it (if ever).
Instead, use GetAccessibleOrContainer, which is also consistent with the deferred anchor jump code in FocusManager.
This means we will fire the event on the correct container Accessible immediately.
Differential Revision: https://phabricator.services.mozilla.com/D226437
If no text is selected, this is the same as passing the caret offset, since the selection range is already where we want it.
However, if text is selected, this allows the caller to replace it, just as it would be when pasting using the keyboard or GUI.
Note that this doesn't break any existing expectations because TEXT_OFFSET_CARET was never supported for this method previously.
This allows us to remove the DeleteText call from Android SessionAccessibility::Paste.
This separate DeleteText call was causing problems because it could result in the deletion and the insertion happening in two separate ticks, resulting in incorrect events.
Now, this should always happen in a single tick.
Differential Revision: https://phabricator.services.mozilla.com/D226108
Since the method is deferred we need to do extra guesswork for possible
situtations where the name has changed because we don't have the
privilege to calculate the name in-line when content is deleted.
I tried to account for all cases as we have in our test coverage. I
hope that if there are edge cases they are false positives, and we are
firing extra name changes and not the opposite.
Differential Revision: https://phabricator.services.mozilla.com/D223877
This revision adds an operator<< that writes a text representation of an
AccAttributes object to an ostream object. This makes it possible to call
ToString on an AccAttributes object, which is useful for printing AccAttributes
objects embedded in AccAttributes objects, and relevant to how Gecko stores
ARIA and text attributes. This revision rewrites DebugPrint in terms of ToString
and uses ToString in StringFromNameAndValue to print AccAttributes in AccAttributes.
Differential Revision: https://phabricator.services.mozilla.com/D224558
Since the method is deferred we need to do extra guesswork for possible
situtations where the name has changed because we don't have the
privilege to calculate the name in-line when content is deleted.
I tried to account for all cases as we have in our test coverage. I
hope that if there are edge cases they are false positives, and we are
firing extra name changes and not the opposite.
Differential Revision: https://phabricator.services.mozilla.com/D223877
This revision adds a null check on mBounds in BundleFieldsForCache, in order to
avoid crashing in release when mBounds is empty.
Differential Revision: https://phabricator.services.mozilla.com/D225273
Introduce a gecko live region changed event and fire it from within content.
This way it gets coalesced in the case of many insertions/deletions.
Also, rely on text insert/delete instead of reorder because there can be cases
where the text in a leaf changes as opposed to a tree mutation.
We get text insert/delete on mutations too, so that should cover it.
Differential Revision: https://phabricator.services.mozilla.com/D224388
This revision adds a pref, read only on startup, that enables all cache domains.
By default, cache domains are only enabled as-needed. This pref is uesful for
test environments, such as fuzzing.
Differential Revision: https://phabricator.services.mozilla.com/D224187
This revision adds an operator<< that writes a text representation of an
AccAttributes object to an ostream object. This makes it possible to call
ToString on an AccAttributes object, which is useful for printing AccAttributes
objects embedded in AccAttributes objects, and relevant to how Gecko stores
ARIA and text attributes. This revision rewrites DebugPrint in terms of ToString
and uses ToString in StringFromNameAndValue to print AccAttributes in AccAttributes.
Differential Revision: https://phabricator.services.mozilla.com/D224558
Introduce a gecko live region changed event and fire it from within content.
This way it gets coalesced in the case of many insertions/deletions.
Also, rely on text insert/delete instead of reorder because there can be cases
where the text in a leaf changes as opposed to a tree mutation.
We get text insert/delete on mutations too, so that should cover it.
Differential Revision: https://phabricator.services.mozilla.com/D224388
These exceptions exist because of Linux platform code which can cause caching of
certain domains before the test begins. Previously, we thought that these
platform issues were 100% consistent, but it turns out that they only happen
most of the time, and can fail to happen in test verify, causing test failure.
To ensure that we don't fail in unexpected situations, call the query function
even for these Linux platform exceptions. In the best case, it won't affect
anything, and in the worst case, it'll save us from TV failure.
Differential Revision: https://phabricator.services.mozilla.com/D222880
This revision implements GetBoundingRectangles by walking the text range line by
line, adding each line rect to an output array, then returning that array to UIA
clients. Since this logic was tied up in TextLeafRange::Bounds, this revision
first creates function WalkLineRects which encapsulates the logic of walking
a TextLeafRange line-by-line. Then, it uses that function to rewrite Bounds and
implement new function LineRects, which stores all non-empty onscreen line rects
in an nsTArray and returns them. The implementation of GetBoundingRectangles has
been filled out; it's mostly straightforward but contains some SAFEARRAY work
since UIA expects rects as doubles, rather than our internal uint32_t
representation. Finally, this revision adds a test for GetBoundingRectangles.
Differential Revision: https://phabricator.services.mozilla.com/D222198
This revision implements RangeFromPoint by hittesting the screen location with
ChildAtPoint. Though the UIA documentation suggests that it may be correct to
find the closest text leaf to the screen coordinate, this revision restricts the
search to nodes under the screen coordinate directly. To accomplish this, it
creates two new functions: TextLeafPointAtScreenPoint, which manages the logic for
hit testing within a TextLeafRange, and FromAccessible, which creates a
TextLeafRange spanning the entire text leaf. Finally, this revision adds Windows
platform tests for the new functionality.
Differential Revision: https://phabricator.services.mozilla.com/D221902
Per Bug 1916578, some cache domains may be present before the document is
finished loading. This can be triggered by platform-level code event handling.
This issue makes cache absence checks unreliable on macOS. We are intermittently
seeing failures on macOS where viewport is cached before doc load, despite not
explicitly requesting it. As we've done with other such issues, this revision
excludes the cache absence check on macOS.
Differential Revision: https://phabricator.services.mozilla.com/D222367