mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
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:
parent
87aa804651
commit
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user