Bug 393033 - xul:tree reports bad posinset/setsize attributes

This commit is contained in:
surkov.alexander%gmail.com 2007-08-23 03:26:53 +00:00
Родитель 8b3321eb00
Коммит 0e05c10b98
1 изменённых файлов: 28 добавлений и 12 удалений

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

@ -721,20 +721,36 @@ nsXULTreeitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribu
rv = view->GetLevel(mRow, &level);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 lvl = -1;
PRInt32 startIndex = mRow;
for (;startIndex - 1 > 0 &&
NS_SUCCEEDED(view->GetLevel(startIndex - 1, &lvl)) && lvl != level;
startIndex--);
PRInt32 topCount = 1;
for (PRInt32 index = mRow - 1; index >= 0; index--) {
PRInt32 lvl = -1;
if (NS_SUCCEEDED(view->GetLevel(index, &lvl))) {
if (lvl < level)
break;
lvl = -1;
PRInt32 endIndex = mRow;
for (;endIndex - 1 > 0 &&
NS_SUCCEEDED(view->GetLevel(endIndex - 1, &lvl)) && lvl != level;
endIndex--);
if (lvl == level)
topCount++;
}
}
PRInt32 setSize = endIndex - startIndex + 1;
PRInt32 posInSet = mRow - startIndex + 1;
PRInt32 rowCount = 0;
rv = view->GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 bottomCount = 0;
for (PRInt32 index = mRow + 1; index < rowCount; index++) {
PRInt32 lvl = -1;
if (NS_SUCCEEDED(view->GetLevel(index, &lvl))) {
if (lvl < level)
break;
if (lvl == level)
bottomCount++;
}
}
PRInt32 setSize = topCount + bottomCount;
PRInt32 posInSet = topCount;
// set the group attributes
nsAccUtils::SetAccGroupAttrs(aAttributes, level + 1, posInSet, setSize);