зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1574428: IAccessible2_2::relationTargetsOfType: Support 0 for all targets and fix off-by-one error. r=MarcoZ
1. As per the spec, if maxTargets is 0, return all targets. 2. Where maxTargets > 0, fix the loop condition so it doesn't incorrectly fetch one more target than requested. Differential Revision: https://phabricator.services.mozilla.com/D42446 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
87aa804651
Коммит
bda9b87fdb
|
@ -493,8 +493,9 @@ ia2Accessible::get_relationTargetsOfType(BSTR aType, long aMaxTargets,
|
|||
MOZ_ASSERT(!acc->IsProxy());
|
||||
Relation rel = acc->RelationByType(*relationType);
|
||||
Accessible* target = nullptr;
|
||||
while ((target = rel.Next()) &&
|
||||
static_cast<long>(targets.Length()) <= aMaxTargets) {
|
||||
while (
|
||||
(target = rel.Next()) &&
|
||||
(aMaxTargets == 0 || static_cast<long>(targets.Length()) < aMaxTargets)) {
|
||||
targets.AppendElement(target);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче