Bug 1733514 part 3: Rename xpcAccessibleHyperText::Intl to IntlLocal. r=eeejay

This is to make way for a new Intl which returns HyperTextAccessibleBase.

Differential Revision: https://phabricator.services.mozilla.com/D128033
This commit is contained in:
James Teh 2021-10-12 23:43:08 +00:00
Родитель 9c2435ba49
Коммит 76d1361d9b
2 изменённых файлов: 49 добавлений и 47 удалений

Просмотреть файл

@ -46,7 +46,7 @@ xpcAccessibleHyperText::GetCharacterCount(int32_t* aCharacterCount) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aCharacterCount = Intl()->CharacterCount();
*aCharacterCount = IntlLocal()->CharacterCount();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -65,7 +65,7 @@ xpcAccessibleHyperText::GetText(int32_t aStartOffset, int32_t aEndOffset,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->TextSubstring(aStartOffset, aEndOffset, aText);
IntlLocal()->TextSubstring(aStartOffset, aEndOffset, aText);
} else {
nsString text;
mIntl->AsRemote()->TextSubstring(aStartOffset, aEndOffset, text);
@ -86,8 +86,8 @@ xpcAccessibleHyperText::GetTextBeforeOffset(
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->TextBeforeOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset,
aText);
IntlLocal()->TextBeforeOffset(aOffset, aBoundaryType, aStartOffset,
aEndOffset, aText);
} else {
nsString text;
mIntl->AsRemote()->GetTextBeforeOffset(aOffset, aBoundaryType, text,
@ -110,8 +110,8 @@ xpcAccessibleHyperText::GetTextAtOffset(int32_t aOffset,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->TextAtOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset,
aText);
IntlLocal()->TextAtOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset,
aText);
} else {
mIntl->AsRemote()->TextAtOffset(aOffset, aBoundaryType, aStartOffset,
aEndOffset, aText);
@ -133,8 +133,8 @@ xpcAccessibleHyperText::GetTextAfterOffset(int32_t aOffset,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->TextAfterOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset,
aText);
IntlLocal()->TextAfterOffset(aOffset, aBoundaryType, aStartOffset,
aEndOffset, aText);
} else {
nsString text;
mIntl->AsRemote()->GetTextAfterOffset(aOffset, aBoundaryType, text,
@ -153,7 +153,7 @@ xpcAccessibleHyperText::GetCharacterAtOffset(int32_t aOffset,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aCharacter = Intl()->CharAt(aOffset);
*aCharacter = IntlLocal()->CharAt(aOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -180,7 +180,7 @@ xpcAccessibleHyperText::GetTextAttributes(
return NS_ERROR_NOT_IMPLEMENTED;
}
RefPtr<AccAttributes> attributes = Intl()->TextAttributes(
RefPtr<AccAttributes> attributes = IntlLocal()->TextAttributes(
aIncludeDefAttrs, aOffset, aStartOffset, aEndOffset);
RefPtr<nsPersistentProperties> props = new nsPersistentProperties();
nsAutoString unused;
@ -210,7 +210,7 @@ xpcAccessibleHyperText::GetDefaultTextAttributes(
return NS_ERROR_NOT_IMPLEMENTED;
}
RefPtr<AccAttributes> attributes = Intl()->DefaultTextAttributes();
RefPtr<AccAttributes> attributes = IntlLocal()->DefaultTextAttributes();
RefPtr<nsPersistentProperties> props = new nsPersistentProperties();
nsAutoString unused;
for (auto iter : *attributes) {
@ -243,7 +243,7 @@ xpcAccessibleHyperText::GetCharacterExtents(int32_t aOffset, int32_t* aX,
nsIntRect rect;
if (mIntl->IsLocal()) {
rect = Intl()->CharBounds(aOffset, aCoordType);
rect = IntlLocal()->CharBounds(aOffset, aCoordType);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -270,7 +270,7 @@ xpcAccessibleHyperText::GetRangeExtents(int32_t aStartOffset,
nsIntRect rect;
if (mIntl->IsLocal()) {
rect = Intl()->TextBounds(aStartOffset, aEndOffset, aCoordType);
rect = IntlLocal()->TextBounds(aStartOffset, aEndOffset, aCoordType);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -292,7 +292,7 @@ xpcAccessibleHyperText::GetOffsetAtPoint(int32_t aX, int32_t aY,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aOffset = Intl()->OffsetAtPoint(aX, aY, aCoordType);
*aOffset = IntlLocal()->OffsetAtPoint(aX, aY, aCoordType);
} else {
*aOffset = mIntl->AsRemote()->OffsetAtPoint(aX, aY, aCoordType);
}
@ -307,7 +307,7 @@ xpcAccessibleHyperText::GetCaretOffset(int32_t* aCaretOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aCaretOffset = Intl()->CaretOffset();
*aCaretOffset = IntlLocal()->CaretOffset();
} else {
*aCaretOffset = mIntl->AsRemote()->CaretOffset();
}
@ -319,7 +319,7 @@ xpcAccessibleHyperText::SetCaretOffset(int32_t aCaretOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->SetCaretOffset(aCaretOffset);
IntlLocal()->SetCaretOffset(aCaretOffset);
} else {
mIntl->AsRemote()->SetCaretOffset(aCaretOffset);
}
@ -334,7 +334,7 @@ xpcAccessibleHyperText::GetSelectionCount(int32_t* aSelectionCount) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aSelectionCount = Intl()->SelectionCount();
*aSelectionCount = IntlLocal()->SelectionCount();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -358,9 +358,11 @@ xpcAccessibleHyperText::GetSelectionBounds(int32_t aSelectionNum,
if (aSelectionNum < 0) return NS_ERROR_INVALID_ARG;
if (mIntl->IsLocal()) {
if (aSelectionNum >= Intl()->SelectionCount()) return NS_ERROR_INVALID_ARG;
if (aSelectionNum >= IntlLocal()->SelectionCount()) {
return NS_ERROR_INVALID_ARG;
}
Intl()->SelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset);
IntlLocal()->SelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -382,8 +384,8 @@ xpcAccessibleHyperText::SetSelectionBounds(int32_t aSelectionNum,
if (aSelectionNum < 0) return NS_ERROR_INVALID_ARG;
if (mIntl->IsLocal()) {
if (!Intl()->SetSelectionBoundsAt(aSelectionNum, aStartOffset,
aEndOffset)) {
if (!IntlLocal()->SetSelectionBoundsAt(aSelectionNum, aStartOffset,
aEndOffset)) {
return NS_ERROR_INVALID_ARG;
}
} else {
@ -404,7 +406,7 @@ xpcAccessibleHyperText::AddSelection(int32_t aStartOffset, int32_t aEndOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->AddToSelection(aStartOffset, aEndOffset);
IntlLocal()->AddToSelection(aStartOffset, aEndOffset);
} else {
mIntl->AsRemote()->AddToSelection(aStartOffset, aEndOffset);
}
@ -416,7 +418,7 @@ xpcAccessibleHyperText::RemoveSelection(int32_t aSelectionNum) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->RemoveFromSelection(aSelectionNum);
IntlLocal()->RemoveFromSelection(aSelectionNum);
} else {
mIntl->AsRemote()->RemoveFromSelection(aSelectionNum);
}
@ -430,7 +432,7 @@ xpcAccessibleHyperText::ScrollSubstringTo(int32_t aStartOffset,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->ScrollSubstringTo(aStartOffset, aEndOffset, aScrollType);
IntlLocal()->ScrollSubstringTo(aStartOffset, aEndOffset, aScrollType);
} else {
mIntl->AsRemote()->ScrollSubstringTo(aStartOffset, aEndOffset, aScrollType);
}
@ -445,8 +447,8 @@ xpcAccessibleHyperText::ScrollSubstringToPoint(int32_t aStartOffset,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoordinateType,
aX, aY);
IntlLocal()->ScrollSubstringToPoint(aStartOffset, aEndOffset,
aCoordinateType, aX, aY);
} else {
mIntl->AsRemote()->ScrollSubstringToPoint(aStartOffset, aEndOffset,
aCoordinateType, aX, aY);
@ -459,10 +461,10 @@ xpcAccessibleHyperText::GetEnclosingRange(nsIAccessibleTextRange** aRange) {
NS_ENSURE_ARG_POINTER(aRange);
*aRange = nullptr;
if (!Intl()) return NS_ERROR_FAILURE;
if (!IntlLocal()) return NS_ERROR_FAILURE;
RefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
Intl()->EnclosingRange(range->mRange);
IntlLocal()->EnclosingRange(range->mRange);
NS_ASSERTION(range->mRange.IsValid(),
"Should always have an enclosing range!");
@ -476,7 +478,7 @@ xpcAccessibleHyperText::GetSelectionRanges(nsIArray** aRanges) {
NS_ENSURE_ARG_POINTER(aRanges);
*aRanges = nullptr;
if (!Intl()) return NS_ERROR_FAILURE;
if (!IntlLocal()) return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
nsCOMPtr<nsIMutableArray> xpcRanges =
@ -484,7 +486,7 @@ xpcAccessibleHyperText::GetSelectionRanges(nsIArray** aRanges) {
NS_ENSURE_SUCCESS(rv, rv);
AutoTArray<TextRange, 1> ranges;
Intl()->SelectionRanges(&ranges);
IntlLocal()->SelectionRanges(&ranges);
uint32_t len = ranges.Length();
for (uint32_t idx = 0; idx < len; idx++) {
xpcRanges->AppendElement(
@ -500,7 +502,7 @@ xpcAccessibleHyperText::GetVisibleRanges(nsIArray** aRanges) {
NS_ENSURE_ARG_POINTER(aRanges);
*aRanges = nullptr;
if (!Intl()) return NS_ERROR_FAILURE;
if (!IntlLocal()) return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
nsCOMPtr<nsIMutableArray> xpcRanges =
@ -508,7 +510,7 @@ xpcAccessibleHyperText::GetVisibleRanges(nsIArray** aRanges) {
NS_ENSURE_SUCCESS(rv, rv);
nsTArray<TextRange> ranges;
Intl()->VisibleRanges(&ranges);
IntlLocal()->VisibleRanges(&ranges);
uint32_t len = ranges.Length();
for (uint32_t idx = 0; idx < len; idx++) {
xpcRanges->AppendElement(
@ -525,12 +527,12 @@ xpcAccessibleHyperText::GetRangeByChild(nsIAccessible* aChild,
NS_ENSURE_ARG_POINTER(aRange);
*aRange = nullptr;
if (!Intl()) return NS_ERROR_FAILURE;
if (!IntlLocal()) return NS_ERROR_FAILURE;
LocalAccessible* child = aChild->ToInternalAccessible();
if (child) {
RefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
Intl()->RangeByChild(child, range->mRange);
IntlLocal()->RangeByChild(child, range->mRange);
if (range->mRange.IsValid()) range.forget(aRange);
}
@ -543,10 +545,10 @@ xpcAccessibleHyperText::GetRangeAtPoint(int32_t aX, int32_t aY,
NS_ENSURE_ARG_POINTER(aRange);
*aRange = nullptr;
if (!Intl()) return NS_ERROR_FAILURE;
if (!IntlLocal()) return NS_ERROR_FAILURE;
RefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
Intl()->RangeAtPoint(aX, aY, range->mRange);
IntlLocal()->RangeAtPoint(aX, aY, range->mRange);
if (range->mRange.IsValid()) range.forget(aRange);
return NS_OK;
@ -560,7 +562,7 @@ xpcAccessibleHyperText::SetTextContents(const nsAString& aText) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->ReplaceText(aText);
IntlLocal()->ReplaceText(aText);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -577,7 +579,7 @@ xpcAccessibleHyperText::InsertText(const nsAString& aText, int32_t aOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->InsertText(aText, aOffset);
IntlLocal()->InsertText(aText, aOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -594,7 +596,7 @@ xpcAccessibleHyperText::CopyText(int32_t aStartOffset, int32_t aEndOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->CopyText(aStartOffset, aEndOffset);
IntlLocal()->CopyText(aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -610,7 +612,7 @@ xpcAccessibleHyperText::CutText(int32_t aStartOffset, int32_t aEndOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->CutText(aStartOffset, aEndOffset);
IntlLocal()->CutText(aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -626,7 +628,7 @@ xpcAccessibleHyperText::DeleteText(int32_t aStartOffset, int32_t aEndOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
Intl()->DeleteText(aStartOffset, aEndOffset);
IntlLocal()->DeleteText(aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -642,7 +644,7 @@ xpcAccessibleHyperText::PasteText(int32_t aOffset) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
RefPtr<HyperTextAccessible> acc = Intl();
RefPtr<HyperTextAccessible> acc = IntlLocal();
acc->PasteText(aOffset);
} else {
#if defined(XP_WIN)
@ -665,7 +667,7 @@ xpcAccessibleHyperText::GetLinkCount(int32_t* aLinkCount) {
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aLinkCount = Intl()->LinkCount();
*aLinkCount = static_cast<int32_t>(IntlLocal()->LinkCount());
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -685,7 +687,7 @@ xpcAccessibleHyperText::GetLinkAt(int32_t aIndex,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
NS_IF_ADDREF(*aLink = ToXPC(Intl()->LinkAt(aIndex)));
NS_IF_ADDREF(*aLink = ToXPC(IntlLocal()->LinkAt(aIndex)));
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -707,7 +709,7 @@ xpcAccessibleHyperText::GetLinkIndex(nsIAccessibleHyperLink* aLink,
nsCOMPtr<nsIAccessible> xpcLink(do_QueryInterface(aLink));
if (LocalAccessible* accLink = xpcLink->ToInternalAccessible()) {
*aIndex = Intl()->LinkIndexOf(accLink);
*aIndex = IntlLocal()->LinkIndexOf(accLink);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
@ -733,7 +735,7 @@ xpcAccessibleHyperText::GetLinkIndexAtOffset(int32_t aOffset,
if (!mIntl) return NS_ERROR_FAILURE;
if (mIntl->IsLocal()) {
*aLinkIndex = Intl()->LinkIndexAtOffset(aOffset);
*aLinkIndex = IntlLocal()->LinkIndexAtOffset(aOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;

Просмотреть файл

@ -37,7 +37,7 @@ class xpcAccessibleHyperText : public xpcAccessibleGeneric,
virtual ~xpcAccessibleHyperText() {}
private:
HyperTextAccessible* Intl() {
HyperTextAccessible* IntlLocal() {
if (LocalAccessible* acc = mIntl->AsLocal()) {
return acc->AsHyperText();
}