mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1466673 part 3. Stop using nsITreeColumns in accessibility code. r=surkov
This commit is contained in:
parent
362122ad32
commit
10fde35340
@ -172,8 +172,7 @@ XULMAP(
|
||||
return nullptr;
|
||||
|
||||
RefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
|
||||
int32_t count = 0;
|
||||
treeCols->GetCount(&count);
|
||||
uint32_t count = treeCols->Count();
|
||||
|
||||
// Outline of list accessible.
|
||||
if (count == 1) {
|
||||
|
@ -527,8 +527,7 @@ nsCoreUtils::GetFirstSensibleColumn(nsITreeBoxObject *aTree)
|
||||
if (!cols)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> column;
|
||||
cols->GetFirstColumn(getter_AddRefs(column));
|
||||
RefPtr<nsTreeColumn> column = cols->GetFirstColumn();
|
||||
if (column && IsColumnHidden(column))
|
||||
return GetNextSensibleColumn(column);
|
||||
|
||||
@ -545,16 +544,13 @@ nsCoreUtils::GetSensibleColumnCount(nsITreeBoxObject *aTree)
|
||||
if (!cols)
|
||||
return count;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> column;
|
||||
cols->GetFirstColumn(getter_AddRefs(column));
|
||||
nsTreeColumn* column = cols->GetFirstColumn();
|
||||
|
||||
while (column) {
|
||||
if (!IsColumnHidden(column))
|
||||
count++;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> nextColumn;
|
||||
column->GetNext(getter_AddRefs(nextColumn));
|
||||
column.swap(nextColumn);
|
||||
column = column->GetNext();
|
||||
}
|
||||
|
||||
return count;
|
||||
|
@ -124,12 +124,12 @@ XULTreeAccessible::Value(nsString& aValue) const
|
||||
int32_t currentIndex;
|
||||
selection->GetCurrentIndex(¤tIndex);
|
||||
if (currentIndex >= 0) {
|
||||
nsCOMPtr<nsITreeColumn> keyCol;
|
||||
RefPtr<nsTreeColumn> keyCol;
|
||||
|
||||
RefPtr<nsTreeColumns> cols;
|
||||
mTree->GetColumns(getter_AddRefs(cols));
|
||||
if (cols)
|
||||
cols->GetKeyColumn(getter_AddRefs(keyCol));
|
||||
keyCol = cols->GetKeyColumn();
|
||||
|
||||
mTreeView->GetCellText(currentIndex, keyCol, aValue);
|
||||
}
|
||||
@ -166,8 +166,7 @@ XULTreeAccessible::NativeRole() const
|
||||
return roles::LIST;
|
||||
|
||||
RefPtr<nsTreeColumns> cols = treeFrame->Columns();
|
||||
nsCOMPtr<nsITreeColumn> primaryCol;
|
||||
cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
|
||||
nsTreeColumn* primaryCol = cols->GetPrimaryColumn();
|
||||
|
||||
return primaryCol ? roles::OUTLINE : roles::LIST;
|
||||
}
|
||||
@ -626,12 +625,9 @@ XULTreeAccessible::TreeViewInvalidated(int32_t aStartRow, int32_t aEndRow,
|
||||
int32_t endCol = aEndCol;
|
||||
|
||||
if (endCol == -1) {
|
||||
int32_t colCount = 0;
|
||||
rv = treeColumns->GetCount(&colCount);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
endCol = colCount - 1;
|
||||
// We need to make sure to cast to int32_t before we do the subtraction, in
|
||||
// case the column count is 0.
|
||||
endCol = static_cast<int32_t>(treeColumns->Count()) - 1;
|
||||
}
|
||||
|
||||
for (int32_t rowIdx = aStartRow; rowIdx <= endRow; ++rowIdx) {
|
||||
@ -989,15 +985,15 @@ XULTreeItemAccessibleBase::DispatchClickEvent(nsIContent* aContent,
|
||||
return;
|
||||
|
||||
// Get column and pseudo element.
|
||||
nsCOMPtr<nsITreeColumn> column;
|
||||
RefPtr<nsTreeColumn> column;
|
||||
nsAutoString pseudoElm;
|
||||
|
||||
if (aActionIndex == eAction_Click) {
|
||||
// Key column is visible and clickable.
|
||||
columns->GetKeyColumn(getter_AddRefs(column));
|
||||
column = columns->GetKeyColumn();
|
||||
} else {
|
||||
// Primary column contains a twisty we should click on.
|
||||
columns->GetPrimaryColumn(getter_AddRefs(column));
|
||||
column = columns->GetPrimaryColumn();
|
||||
pseudoElm = NS_LITERAL_STRING("twisty");
|
||||
}
|
||||
|
||||
@ -1030,9 +1026,8 @@ XULTreeItemAccessibleBase::IsExpandable() const
|
||||
if (!isEmpty) {
|
||||
RefPtr<nsTreeColumns> columns;
|
||||
mTree->GetColumns(getter_AddRefs(columns));
|
||||
nsCOMPtr<nsITreeColumn> primaryColumn;
|
||||
if (columns) {
|
||||
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
|
||||
nsTreeColumn* primaryColumn = columns->GetPrimaryColumn();
|
||||
if (primaryColumn &&
|
||||
!nsCoreUtils::IsColumnHidden(primaryColumn))
|
||||
return true;
|
||||
@ -1123,8 +1118,7 @@ XULTreeItemAccessible::NativeRole() const
|
||||
return roles::NOTHING;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITreeColumn> primaryColumn;
|
||||
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
|
||||
nsTreeColumn* primaryColumn = columns->GetPrimaryColumn();
|
||||
|
||||
return primaryColumn ? roles::OUTLINEITEM : roles::LISTITEM;
|
||||
}
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
#include "nsITreeBoxObject.h"
|
||||
#include "nsITreeView.h"
|
||||
#include "nsITreeColumns.h"
|
||||
#include "XULListboxAccessible.h"
|
||||
|
||||
class nsTreeBodyFrame;
|
||||
class nsITreeColumn;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsTreeColumns.h"
|
||||
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsIMutableArray.h"
|
||||
@ -218,8 +219,7 @@ XULTreeGridAccessible::NativeRole() const
|
||||
return roles::NOTHING;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITreeColumn> primaryColumn;
|
||||
treeColumns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
|
||||
nsTreeColumn* primaryColumn = treeColumns->GetPrimaryColumn();
|
||||
|
||||
return primaryColumn ? roles::TREE_TABLE : roles::TABLE;
|
||||
}
|
||||
@ -398,8 +398,7 @@ XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
|
||||
|
||||
bool nameChanged = false;
|
||||
for (int32_t colIdx = aStartColIdx; colIdx <= aEndColIdx; ++colIdx) {
|
||||
nsCOMPtr<nsITreeColumn> column;
|
||||
treeColumns->GetColumnAt(colIdx, getter_AddRefs(column));
|
||||
nsTreeColumn* column = treeColumns->GetColumnAt(colIdx);
|
||||
if (column && !nsCoreUtils::IsColumnHidden(column)) {
|
||||
XULTreeGridCellAccessible* cell = GetCellAccessible(column);
|
||||
if (cell)
|
||||
|
Loading…
x
Reference in New Issue
Block a user