forked from mirrors/gecko-dev
Bug 1782563 - Support END_OF_TEXT offset in TextLeafPoint constructor. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D153386
This commit is contained in:
parent
92afd6db93
commit
d66b7102eb
1 changed files with 13 additions and 3 deletions
|
|
@ -439,14 +439,24 @@ TextLeafPoint::TextLeafPoint(Accessible* aAcc, int32_t aOffset) {
|
||||||
if (aOffset != nsIAccessibleText::TEXT_OFFSET_CARET && aAcc->HasChildren()) {
|
if (aOffset != nsIAccessibleText::TEXT_OFFSET_CARET && aAcc->HasChildren()) {
|
||||||
// Find a leaf. This might not necessarily be a TextLeafAccessible; it
|
// Find a leaf. This might not necessarily be a TextLeafAccessible; it
|
||||||
// could be an empty container.
|
// could be an empty container.
|
||||||
for (Accessible* acc = aAcc->FirstChild(); acc; acc = acc->FirstChild()) {
|
auto GetChild = [&aOffset](Accessible* acc) -> Accessible* {
|
||||||
|
return aOffset != nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT
|
||||||
|
? acc->FirstChild()
|
||||||
|
: acc->LastChild();
|
||||||
|
};
|
||||||
|
|
||||||
|
for (Accessible* acc = GetChild(aAcc); acc; acc = GetChild(acc)) {
|
||||||
mAcc = acc;
|
mAcc = acc;
|
||||||
}
|
}
|
||||||
mOffset = 0;
|
mOffset = aOffset != nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT
|
||||||
|
? 0
|
||||||
|
: nsAccUtils::TextLength(mAcc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mAcc = aAcc;
|
mAcc = aAcc;
|
||||||
mOffset = aOffset;
|
mOffset = aOffset != nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT
|
||||||
|
? aOffset
|
||||||
|
: nsAccUtils::TextLength(mAcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextLeafPoint::operator<(const TextLeafPoint& aPoint) const {
|
bool TextLeafPoint::operator<(const TextLeafPoint& aPoint) const {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue