зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1901459 fixup: Cosmetic changes from code review that I applied locally and somehow neglected to push to Phabricator. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D216131
This commit is contained in:
Родитель
0fe2f1ffc7
Коммит
7075505067
|
@ -83,24 +83,24 @@ const Accessible* Accessible::GetClosestCommonInclusiveAncestor(
|
|||
}
|
||||
|
||||
// Build the chain of parents.
|
||||
const Accessible* thisP = this;
|
||||
const Accessible* otherP = aAcc;
|
||||
AutoTArray<const Accessible*, 30> thisParents, otherParents;
|
||||
const Accessible* thisAnc = this;
|
||||
const Accessible* otherAnc = aAcc;
|
||||
AutoTArray<const Accessible*, 30> thisAncs, otherAncs;
|
||||
do {
|
||||
thisParents.AppendElement(thisP);
|
||||
thisP = thisP->Parent();
|
||||
} while (thisP);
|
||||
thisAncs.AppendElement(thisAnc);
|
||||
thisAnc = thisAnc->Parent();
|
||||
} while (thisAnc);
|
||||
do {
|
||||
otherParents.AppendElement(otherP);
|
||||
otherP = otherP->Parent();
|
||||
} while (otherP);
|
||||
otherAncs.AppendElement(otherAnc);
|
||||
otherAnc = otherAnc->Parent();
|
||||
} while (otherAnc);
|
||||
|
||||
// Find where the parent chain differs.
|
||||
uint32_t thisPos = thisParents.Length(), otherPos = otherParents.Length();
|
||||
size_t thisPos = thisAncs.Length(), otherPos = otherAncs.Length();
|
||||
const Accessible* common = nullptr;
|
||||
for (uint32_t len = std::min(thisPos, otherPos); len > 0; --len) {
|
||||
const Accessible* thisChild = thisParents.ElementAt(--thisPos);
|
||||
const Accessible* otherChild = otherParents.ElementAt(--otherPos);
|
||||
for (size_t len = std::min(thisPos, otherPos); len > 0; --len) {
|
||||
const Accessible* thisChild = thisAncs.ElementAt(--thisPos);
|
||||
const Accessible* otherChild = otherAncs.ElementAt(--otherPos);
|
||||
if (thisChild != otherChild) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ static void RemoveExcludedAccessiblesFromRange(TextLeafRange& aRange) {
|
|||
return;
|
||||
}
|
||||
if (end.mOffset != 0) {
|
||||
// It is theoretically possible for start to be at the exclusive end of a
|
||||
// previous Accessible (i.e. mOffset is its length), so the range doesn't
|
||||
// really encompass that Accessible's text and we should thus exclude that
|
||||
// Accessible. However, that hasn't been seen in practice yet. If it does
|
||||
// occur and cause problems, we should adjust the start point here.
|
||||
return;
|
||||
}
|
||||
// end is at the start of its Accessible. This can happen because we always
|
||||
|
|
Загрузка…
Ссылка в новой задаче