Bug 1766546: Implement SetCaretOffset for cached Windows RemoteAccessible. r=morgan

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
This commit is contained in:
James Teh
2022-06-01 19:34:09 +00:00
parent 2ababf8b79
commit 2c7ca10cac
17 changed files with 111 additions and 61 deletions

View File

@@ -277,11 +277,7 @@ xpcAccessibleHyperText::GetCaretOffset(int32_t* aCaretOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aCaretOffset = IntlLocal()->CaretOffset();
} else {
*aCaretOffset = mIntl->AsRemote()->CaretOffset();
}
*aCaretOffset = Intl()->CaretOffset();
return NS_OK;
}
@@ -289,11 +285,7 @@ NS_IMETHODIMP
xpcAccessibleHyperText::SetCaretOffset(int32_t aCaretOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
IntlLocal()->SetCaretOffset(aCaretOffset);
} else {
mIntl->AsRemote()->SetCaretOffset(aCaretOffset);
}
Intl()->SetCaretOffset(aCaretOffset);
return NS_OK;
}