mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 739882 - decomtaminate getting row and column count on accessible tables, r=tbsaunde
This commit is contained in:
parent
e25627eae3
commit
c52fd425a3
@ -84,43 +84,33 @@ ARIAGridAccessible::Shutdown()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleTable
|
||||
|
||||
NS_IMETHODIMP
|
||||
ARIAGridAccessible::GetColumnCount(PRInt32* aColumnCount)
|
||||
PRUint32
|
||||
ARIAGridAccessible::ColCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aColumnCount);
|
||||
*aColumnCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
nsAccessible* row = rowIter.Next();
|
||||
if (!row)
|
||||
return NS_OK;
|
||||
return 0;
|
||||
|
||||
AccIterator cellIter(row, filters::GetCell);
|
||||
nsAccessible *cell = nsnull;
|
||||
nsAccessible* cell = nsnull;
|
||||
|
||||
PRUint32 colCount = 0;
|
||||
while ((cell = cellIter.Next()))
|
||||
(*aColumnCount)++;
|
||||
colCount++;
|
||||
|
||||
return NS_OK;
|
||||
return colCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ARIAGridAccessible::GetRowCount(PRInt32* aRowCount)
|
||||
PRUint32
|
||||
ARIAGridAccessible::RowCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowCount);
|
||||
*aRowCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 rowCount = 0;
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
while (rowIter.Next())
|
||||
(*aRowCount)++;
|
||||
rowCount++;
|
||||
|
||||
return NS_OK;
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -71,6 +71,10 @@ public:
|
||||
// nsAccessNode
|
||||
virtual void Shutdown();
|
||||
|
||||
// TableAccessible
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Return true if the given row index is valid.
|
||||
|
@ -563,36 +563,24 @@ nsHTMLTableAccessible::Summary(nsString& aSummary)
|
||||
table->GetSummary(aSummary);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetColumnCount(PRInt32 *acolumnCount)
|
||||
PRUint32
|
||||
nsHTMLTableAccessible::ColCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(acolumnCount);
|
||||
*acolumnCount = nsnull;
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
|
||||
PRInt32 rows;
|
||||
return tableLayout->GetTableSize(rows, *acolumnCount);
|
||||
PRInt32 rowCount = 0, colCount = 0;
|
||||
tableLayout->GetTableSize(rowCount, colCount);
|
||||
return colCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetRowCount(PRInt32 *arowCount)
|
||||
PRUint32
|
||||
nsHTMLTableAccessible::RowCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(arowCount);
|
||||
*arowCount = 0;
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
|
||||
PRInt32 columns;
|
||||
return tableLayout->GetTableSize(*arowCount, columns);
|
||||
PRInt32 rowCount = 0, colCount = 0;
|
||||
tableLayout->GetTableSize(rowCount, colCount);
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -129,6 +129,8 @@ public:
|
||||
|
||||
// TableAccessible
|
||||
virtual nsAccessible* Caption();
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
virtual void Summary(nsString& aSummary);
|
||||
virtual bool IsProbablyLayoutTable();
|
||||
|
||||
|
@ -21,6 +21,32 @@ xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xpcAccessibleTable::GetColumnCount(PRInt32* aColumnCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aColumnCount);
|
||||
*aColumnCount = 0;
|
||||
|
||||
if (!mTable)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aColumnCount = mTable->ColCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xpcAccessibleTable::GetRowCount(PRInt32* aRowCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowCount);
|
||||
*aRowCount = 0;
|
||||
|
||||
if (!mTable)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aRowCount = mTable->RowCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xpcAccessibleTable::GetSummary(nsAString& aSummary)
|
||||
{
|
||||
|
@ -23,6 +23,8 @@ public:
|
||||
xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
|
||||
|
||||
nsresult GetCaption(nsIAccessible** aCaption);
|
||||
nsresult GetColumnCount(PRInt32* aColumnCount);
|
||||
nsresult GetRowCount(PRInt32* aRowCount);
|
||||
nsresult GetSummary(nsAString& aSummary);
|
||||
nsresult IsProbablyForLayout(bool* aIsForLayout);
|
||||
|
||||
@ -35,8 +37,10 @@ protected:
|
||||
{ return xpcAccessibleTable::GetCaption(aCaption); } \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetSummary(nsAString & aSummary) \
|
||||
{ return xpcAccessibleTable::GetSummary(aSummary); } \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRInt32 *aColumnCount); \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32 *aRowCount); \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRInt32* aColumnCount) \
|
||||
{ return xpcAccessibleTable::GetColumnCount(aColumnCount); } \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32* aRowCount) \
|
||||
{ return xpcAccessibleTable::GetRowCount(aRowCount); } \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetCellAt(PRInt32 rowIndex, PRInt32 columnIndex, nsIAccessible * *_retval NS_OUTPARAM); \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetCellIndexAt(PRInt32 rowIndex, PRInt32 columnIndex, PRInt32 *_retval NS_OUTPARAM); \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
|
||||
|
@ -241,15 +241,9 @@ nsXULListboxAccessible::NativeRole()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULListboxAccessible. nsIAccessibleTable
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
|
||||
PRUint32
|
||||
nsXULListboxAccessible::ColCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aColumnsCout);
|
||||
*aColumnsCout = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIContent* headContent = nsnull;
|
||||
for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
|
||||
childContent = childContent->GetNextSibling()) {
|
||||
@ -259,7 +253,7 @@ nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
|
||||
}
|
||||
}
|
||||
if (!headContent)
|
||||
return NS_OK;
|
||||
return 0;
|
||||
|
||||
PRUint32 columnCount = 0;
|
||||
for (nsIContent* childContent = headContent->GetFirstChild(); childContent;
|
||||
@ -270,28 +264,19 @@ nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
|
||||
}
|
||||
}
|
||||
|
||||
*aColumnsCout = columnCount;
|
||||
return NS_OK;
|
||||
return columnCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListboxAccessible::GetRowCount(PRInt32 *aRowCount)
|
||||
PRUint32
|
||||
nsXULListboxAccessible::RowCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowCount);
|
||||
*aRowCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> element(do_QueryInterface(mContent));
|
||||
NS_ENSURE_STATE(element);
|
||||
|
||||
PRUint32 itemCount = 0;
|
||||
nsresult rv = element->GetItemCount(&itemCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if(element)
|
||||
element->GetItemCount(&itemCount);
|
||||
|
||||
*aRowCount = itemCount;
|
||||
return NS_OK;
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -104,6 +104,10 @@ public:
|
||||
// nsIAccessibleTable
|
||||
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
|
||||
|
||||
// TableAccessible
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
|
||||
// nsAccessNode
|
||||
virtual void Shutdown();
|
||||
|
||||
|
@ -72,32 +72,21 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeGridAccessible,
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTreeGridAccessible: nsIAccessibleTable implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridAccessible::GetColumnCount(PRInt32 *aColumnCount)
|
||||
PRUint32
|
||||
nsXULTreeGridAccessible::ColCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aColumnCount);
|
||||
*aColumnCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aColumnCount = nsCoreUtils::GetSensibleColumnCount(mTree);
|
||||
return NS_OK;
|
||||
return nsCoreUtils::GetSensibleColumnCount(mTree);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridAccessible::GetRowCount(PRInt32* aRowCount)
|
||||
PRUint32
|
||||
nsXULTreeGridAccessible::RowCount()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowCount);
|
||||
*aRowCount = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mTreeView)
|
||||
return NS_OK;
|
||||
return 0;
|
||||
|
||||
return mTreeView->GetRowCount(aRowCount);
|
||||
PRInt32 rowCount = 0;
|
||||
mTreeView->GetRowCount(&rowCount);
|
||||
return rowCount >= 0 ? rowCount : 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -60,6 +60,10 @@ public:
|
||||
// nsIAccessibleTable
|
||||
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
|
||||
|
||||
// TableAccessible
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
|
||||
// nsAccessNode
|
||||
virtual void Shutdown();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user