We implement setting of the caret using HyperText rather than TextLeafPoint because caret stuff, including events, still uses HyperText internally for now.
This moves the async IPDL method already used on non-Windows into the base classes so Windows can use it.
We keep the COM implementation for Windows RemoteAccessible without the cache.
SetCaretOffset was moved into HyperTextAccessibleBase and platform methods were updated accordingly.
Finally, I did some drive-by cleanup (no user impact) and changed GetCaretOffset in ATK and XPCOM to use HyperTextAccessibleBase.
GetCaretOffset was moved to the base some time ago, but ATK and XPCOM weren't updated at the time.
Differential Revision: https://phabricator.services.mozilla.com/D147852
Layout sends a11y text update notifications during reflow even if the text hasn't changed.
TextUpdater already detects this case, so just move our cache update calls to TextUpdater.
Differential Revision: https://phabricator.services.mozilla.com/D147656
I originally thought we didn't need to be explicitly notified about removals because a correction always triggers a text change and we push a cache update for spelling errors whenever the text changes.
However, it seems that even when a correction is made and the text changes, the spell check ranges aren't yet up to date.
Previously, we were pushing a cache update whenever text was reflowed, which was taking care of this.
Soon, we don't want to push text cache updates if the text doesn't actually change.
We remove the reliance on these redundant text updates by having an explicit notification for spell check removals.
Differential Revision: https://phabricator.services.mozilla.com/D147655
The BrowsingContext already has this information, so we use that instead of redundantly caching it in RemoteAccessible.
This implementation works even when the a11y cache is disabled, so stop using the sync IPDL URL method.
We can't entirely unify the URL method because we don't have a base class for local/remote documents.
However, a method was added in nsAccUtils to unify this as much as possible.
Differential Revision: https://phabricator.services.mozilla.com/D147717
Previously, even for remote in-process iframes, it was only possible to retrieve the top level BrowsingContext for the remote process by getting the managing BrowserParent.
This makes it possible to get the correct BrowsingContext even for in-process iframes.
Differential Revision: https://phabricator.services.mozilla.com/D147716
None of the consumer need to mutate styles, and this saves some ugly
const_casting on the next patch.
Doesn't change behavior.
Differential Revision: https://phabricator.services.mozilla.com/D147555
We already have an nsISelectionListener, but that only tells us that a change happened somewhere in the selection, not which range changed.
We don't want to push a cache update for all ranges when only one changed.
Therefore, this patch adds an accessibility notification in mozInlineSpellChecker::AddRange.
We don't need this for removed ranges because the text will change for any spelling error corrections and text updates trigger spelling error cache updates.
Differential Revision: https://phabricator.services.mozilla.com/D147244
Even though spelling errors can cross Accessibles and are represented in the DOM as ranges, we cache them for each text leaf.
This is necessary so that we correctly update the offsets when text is inserted or removed from a leaf.
We cache them as an array of offsets, including both the start and end offset for each range.
We use -1 as the start offset to indicate when a spelling error starts in a previous Accessible.
When a spelling error starts in an Accessible but ends in a subsequent one, we simply don't include an end offset in the array.
This structure means we can easily query spelling error points or ranges with a binary search.
Differential Revision: https://phabricator.services.mozilla.com/D147243
The implementation searches for spelling errors in each leaf, as this is how we will need to do it for RemoteAccessibles.
Differential Revision: https://phabricator.services.mozilla.com/D147242
This was done for LocalAccessibles to avoid the need to fetch attributes twice when we're simultaneously fetching boundaries and returning the attributes to a client.
However, GetTextAttributes will soon handle spelling errors, so it will no longer return the same data as GetTextAttributesLocalAcc (which doesn't handle spelling errors).
This breaks the equality checks in FindTextAttrsStart.
Aside from this, this argument was somewhat confusing.
For now, just remove aOriginAttrs, which means there will be some redundant calls to GetTextAttributesLocalAcc.
Parent process documents shouldn't be that large anyway.
If this ends up being a real problem, we can either revert to the local HyperTextAccessible implementation of text attributes or implement a smarter temporary cache.
Differential Revision: https://phabricator.services.mozilla.com/D147241
We detect this in the same way that we detect whether we need to push line starts; i.e. a text update or a bounds change.
Since this is tied to the Text and Bounds domains, I removed the separate TextBounds domain.
Differential Revision: https://phabricator.services.mozilla.com/D147396
For block frames, nsLineIterator doesn't use the line cursor, so switch to nsBlockInFlowLineIterator.
We don't actually care about the line number here anyway.
Differential Revision: https://phabricator.services.mozilla.com/D147237
There can be LocalAccessibles which don't die until the final cycle collection during XPCOM shutdown.
MsaaIdGenerator::ReleaseID (called during deletion of a LocalAccessible) uses a timer when the cache is enabled, but timers can't be used after XPCOM shutdown.
This was causing an assertion.
In addition, because MsaaIdGenerator is a static instance, the timer could be deleted after XPCOM shutdown, causing a warning.
To fix this:
1. If accessibility is shut down, just release ids immediately.
2. Clean up any remaining ids and the timer on XPCOM shutdown.
A better solution would be to create and terminate MsaaIdGenerator during a11y startup and shutdown, but this is a bit tricky while we still have the non-cache code paths.
Once we don't need the non-cache code, MsaaIdGenerator will become a lot simpler, so this refactor will be easier then.
Differential Revision: https://phabricator.services.mozilla.com/D146866
This change allows us to remove the `FullZoom` multiplier and fixes text
bounds caclulations in a zoomed page.
Testing: The current browser scroll/bounds tests pass (with the
exception of fission iframes which were already broken).
Differential Revision: https://phabricator.services.mozilla.com/D146507
This patch won't actually build, because a few bits of code are used
for both nsIFactory::createInstance and static components, and static
components are not fixed until the next patch.
The first place is nsLoadGroupConstructor, which uses an nsIFactory
macro to create a static component constructor. (This could be worked
around by expanding the macro to the state before this patch.)
The other issue is that nsAppShellConstructor is used in an nsIFactory
on OSX, but as a static component on all other platforms. This could
be worked around by wrapping nsAppShellConstructor in an adaptor that
passes in the extra null argument to nsAppShellConstructor.
Differential Revision: https://phabricator.services.mozilla.com/D146456
This was causing a performance regression.
We now only do this for text leaf and image Accessibles, which gets us back to where we were before bug 1395181.
This means we can't support "click ancestor" on ATK.
There weren't requests for this on ATK anyway.
In future, we can probably support this using the information in the cache.
Differential Revision: https://phabricator.services.mozilla.com/D146528
This interface should no longer be required due to the changes in part 1
limiting the complexity of IPCStream instances and limiting the number of file
descriptors which a single stream can attach to a message.
Removing this interface is necessary to serialize nsIInputStream instances over
arbitrary toplevel protocols and non-protocol IPC in the future.
Differential Revision: https://phabricator.services.mozilla.com/D141039
We can't use the StringBundle object off the main thread. We need to
pre-load all the strings we may use. This is a small set of roles. We
also need formatted heading levels, so we preload heading level 1 to 6.
Differential Revision: https://phabricator.services.mozilla.com/D146112
We rely on Recv events to be called from child processes and not from
other Recv events. If this happens we risk reentry in regards to the
android monitor lock. So this patch introduces FireEvent for internal
use where secondary events need to be fired like a reorder when a new
sub-document is added.
Differential Revision: https://phabricator.services.mozilla.com/D146134
In Android we need to keep the remote accessible methods thread safe. That means no direct references to local accessibles, or anything DOM or layout.
We have the advantage of always being remote except for a 0 offset browser element, and no support for full page zoom.
Also removed the visual/layout viewport offset in the bounds method since
the top level doc will always have its visual and layout viewport match.
Differential Revision: https://phabricator.services.mozilla.com/D146006
Previously, we invalidated this cache when the reorder event arrived.
Because the mutation and the reorder event happen in separate IPDL calls, it's possible for a client call to arrive between them.
If that client call queried HyperText offsets, this could result in returning incorrect information to the client or even a parent process crash.
Now, we invalidate the cache during the mutation, so there's no possibility of an intervening client call.
It made sense to put this invalidation call in RemoteAccessibleBase, so I also moved the call to invalidate for text leaf updates into RemoteAccessibleBase so that they're both in the same class.
Differential Revision: https://phabricator.services.mozilla.com/D145845
This interface should no longer be required due to the changes in part 1
limiting the complexity of IPCStream instances and limiting the number of file
descriptors which a single stream can attach to a message.
Removing this interface is necessary to serialize nsIInputStream instances over
arbitrary toplevel protocols and non-protocol IPC in the future.
Differential Revision: https://phabricator.services.mozilla.com/D141039
The code checks whether the origin is inside the block, since if not, the block ends before the origin.
However, it previously didn't handle the case where there was a leaf outside the block between the block and the origin.
An additional check has now been added to handle this case.
This required the code to be restructured somewhat, which hopefully also makes it easier to read/debug.
Differential Revision: https://phabricator.services.mozilla.com/D145867
It's critical that we fire mutation events first because our RemoteAccessible tree is created thus and we can't fire events on RemoteAccessibles we haven't created yet.
Beyond that, though, focus events are of primary importance.
See the comments in EventQueue::ProcessEventQueue for the reasons.
Differential Revision: https://phabricator.services.mozilla.com/D145319
This interface should no longer be required due to the changes in part 1
limiting the complexity of IPCStream instances and limiting the number of file
descriptors which a single stream can attach to a message.
Removing this interface is necessary to serialize nsIInputStream instances over
arbitrary toplevel protocols and non-protocol IPC in the future.
Differential Revision: https://phabricator.services.mozilla.com/D141039
We already had a similar cache in local HyperTextAccessible.
This improves performance significantly when walking the text attributes of a container with a large number of text leaf children, such as is encountered when using view source.
This patch unifies that cache across local and remote.
For simplicity, the cache invalidation strategy is more naive/aggressive.
Differential Revision: https://phabricator.services.mozilla.com/D145079
We already had a similar cache in local HyperTextAccessible.
This improves performance significantly when walking the text attributes of a container with a large number of text leaf children, such as is encountered when using view source.
This patch unifies that cache across local and remote.
For simplicity, the cache invalidation strategy is more naive/aggressive.
Differential Revision: https://phabricator.services.mozilla.com/D145079