Bug 723427 - dexpcom GetUnignoredChildren(), r=tbsaunde, f=surkov

This commit is contained in:
Lavina Thong 2012-04-03 18:54:07 +09:00
Родитель 064b2240a5
Коммит 91ee28a3e2
3 изменённых файлов: 15 добавлений и 23 удалений

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

@ -403,17 +403,15 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
return mChildren; return mChildren;
mChildren = [[NSMutableArray alloc] init]; mChildren = [[NSMutableArray alloc] init];
// get the array of children. // get the array of children.
nsTArray<nsRefPtr<nsAccessibleWrap> > childrenArray; nsAutoTArray<nsAccessible*, 10> childrenArray;
mGeckoAccessible->GetUnignoredChildren(childrenArray); mGeckoAccessible->GetUnignoredChildren(&childrenArray);
// now iterate through the children array, and get each native accessible. // now iterate through the children array, and get each native accessible.
int totalCount = childrenArray.Length(); PRUint32 totalCount = childrenArray.Length();
int index = 0; for (PRUint32 idx = 0; idx < totalCount; idx++) {
nsAccessible* curAccessible = childrenArray.ElementAt(idx);
for (; index < totalCount; index++) {
nsAccessibleWrap *curAccessible = childrenArray.ElementAt(index);
if (curAccessible) { if (curAccessible) {
mozAccessible *curNative = GetNativeFromGeckoAccessible(curAccessible); mozAccessible *curNative = GetNativeFromGeckoAccessible(curAccessible);
if (curNative) if (curNative)

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

@ -99,7 +99,7 @@ public: // construction, destruction
* Returns this accessible's all children, adhering to "flat" accessibles by * Returns this accessible's all children, adhering to "flat" accessibles by
* not returning their children. * not returning their children.
*/ */
void GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> >& aChildrenArray); void GetUnignoredChildren(nsTArray<nsAccessible*>* aChildrenArray);
nsAccessible* GetUnignoredParent() const; nsAccessible* GetUnignoredParent() const;
protected: protected:

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

@ -261,7 +261,7 @@ nsAccessibleWrap::IsIgnored()
} }
void void
nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aChildrenArray) nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsAccessible*>* aChildrenArray)
{ {
// we're flat; there are no children. // we're flat; there are no children.
if (nsAccUtils::MustPrune(this)) if (nsAccUtils::MustPrune(this))
@ -272,19 +272,13 @@ nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aC
nsAccessibleWrap *childAcc = nsAccessibleWrap *childAcc =
static_cast<nsAccessibleWrap*>(GetChildAt(childIdx)); static_cast<nsAccessibleWrap*>(GetChildAt(childIdx));
// If element is ignored, then add its children as substitutes.
if (childAcc->IsIgnored()) { if (childAcc->IsIgnored()) {
// element is ignored, so try adding its children as substitutes, if it has any. childAcc->GetUnignoredChildren(aChildrenArray);
if (!nsAccUtils::MustPrune(childAcc)) { continue;
nsTArray<nsRefPtr<nsAccessibleWrap> > children; }
childAcc->GetUnignoredChildren(children);
if (!children.IsEmpty()) { aChildrenArray->AppendElement(childAcc);
// add the found unignored descendants to the array.
aChildrenArray.AppendElements(children);
}
}
} else
// simply add the element, since it's not ignored.
aChildrenArray.AppendElement(childAcc);
} }
} }