bug 648265 - non-xpcom accessible table interface and casting r=surkov sr=neil

This commit is contained in:
Trevor Saunders 2012-03-27 18:23:29 -04:00
Родитель 1f6c262397
Коммит ae970aed56
18 изменённых файлов: 400 добавлений и 114 удалений

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

@ -99,7 +99,9 @@ endif
LOCAL_INCLUDES += \ LOCAL_INCLUDES += \
-I$(srcdir) \ -I$(srcdir) \
-I$(srcdir)/../base \ -I$(srcdir)/../base \
-I$(srcdir)/../generic \
-I$(srcdir)/../html \ -I$(srcdir)/../html \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../xul \ -I$(srcdir)/../xul \
-I$(topsrcdir)/other-licenses/atk-1.0 \ -I$(topsrcdir)/other-licenses/atk-1.0 \
$(NULL) $(NULL)

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

@ -42,12 +42,14 @@
#include "nsAccessibleWrap.h" #include "nsAccessibleWrap.h"
#include "nsAccUtils.h" #include "nsAccUtils.h"
#include "nsIAccessibleTable.h" #include "nsIAccessibleTable.h"
#include "TableAccessible.h"
#include "nsMai.h" #include "nsMai.h"
#include "nsArrayUtils.h" #include "nsArrayUtils.h"
extern "C" { using namespace mozilla::a11y;
extern "C" {
static AtkObject* static AtkObject*
refAtCB(AtkTable *aTable, gint aRow, gint aColumn) refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
{ {
@ -208,23 +210,17 @@ getRowExtentAtCB(AtkTable *aTable,
} }
static AtkObject* static AtkObject*
getCaptionCB(AtkTable *aTable) getCaptionCB(AtkTable* aTable)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap) if (!accWrap)
return nsnull; return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable; TableAccessible* table = accWrap->AsTable();
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), NS_ENSURE_TRUE(table, nsnull);
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessible> caption; nsAccessible* caption = table->Caption();
nsresult rv = accTable->GetCaption(getter_AddRefs(caption)); return caption ? nsAccessibleWrap::GetAtkObject(caption) : nsnull;
if (NS_FAILED(rv) || !caption)
return nsnull;
return nsAccessibleWrap::GetAtkObject(caption);
} }
static const gchar* static const gchar*

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

@ -104,8 +104,9 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \ LOCAL_INCLUDES += \
-I$(srcdir) \ -I$(srcdir) \
-I$(srcdir)/../xpcom \ -I$(srcdir)/../generic \
-I$(srcdir)/../html \ -I$(srcdir)/../html \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../xul \ -I$(srcdir)/../xul \
-I$(srcdir)/../../../layout/generic \ -I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/style \ -I$(srcdir)/../../../layout/style \

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

@ -58,7 +58,7 @@ using namespace mozilla::a11y;
nsARIAGridAccessible:: nsARIAGridAccessible::
nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
nsAccessibleWrap(aContent, aDoc) nsAccessibleWrap(aContent, aDoc), xpcAccessibleTable(this)
{ {
} }
@ -70,21 +70,18 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsARIAGridAccessible,
nsIAccessibleTable) nsIAccessibleTable)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleTable //nsAccessNode
NS_IMETHODIMP void
nsARIAGridAccessible::GetCaption(nsIAccessible **aCaption) nsARIAGridAccessible::Shutdown()
{ {
NS_ENSURE_ARG_POINTER(aCaption); mTable = nsnull;
*aCaption = nsnull; nsAccessibleWrap::Shutdown();
if (IsDefunct())
return NS_ERROR_FAILURE;
// XXX: should be pointed by aria-labelledby on grid?
return NS_ERROR_NOT_IMPLEMENTED;
} }
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleTable
NS_IMETHODIMP NS_IMETHODIMP
nsARIAGridAccessible::GetSummary(nsAString &aSummary) nsARIAGridAccessible::GetSummary(nsAString &aSummary)
{ {
@ -710,15 +707,6 @@ nsARIAGridAccessible::UnselectColumn(PRInt32 aColumn)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsARIAGridAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
{
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
*aIsProbablyForLayout = false;
return NS_OK;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Protected // Protected

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

@ -42,12 +42,16 @@
#include "nsIAccessibleTable.h" #include "nsIAccessibleTable.h"
#include "nsHyperTextAccessibleWrap.h" #include "nsHyperTextAccessibleWrap.h"
#include "TableAccessible.h"
#include "xpcAccessibleTable.h"
/** /**
* Accessible for ARIA grid and treegrid. * Accessible for ARIA grid and treegrid.
*/ */
class nsARIAGridAccessible : public nsAccessibleWrap, class nsARIAGridAccessible : public nsAccessibleWrap,
public nsIAccessibleTable public xpcAccessibleTable,
public nsIAccessibleTable,
public mozilla::a11y::TableAccessible
{ {
public: public:
nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc); nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
@ -56,7 +60,13 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTable // nsIAccessibleTable
NS_DECL_NSIACCESSIBLETABLE NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
// nsAccessible
virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
// nsAccessNode
virtual void Shutdown();
protected: protected:
/** /**

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

@ -66,6 +66,11 @@ class nsHTMLImageMapAccessible;
class nsHTMLLIAccessible; class nsHTMLLIAccessible;
struct nsRoleMapEntry; struct nsRoleMapEntry;
class Relation; class Relation;
namespace mozilla {
namespace a11y {
class TableAccessible;
}
}
class nsTextAccessible; class nsTextAccessible;
struct nsRect; struct nsRect;
@ -471,6 +476,8 @@ public:
inline bool IsRoot() const { return mFlags & eRootAccessible; } inline bool IsRoot() const { return mFlags & eRootAccessible; }
nsRootAccessible* AsRoot(); nsRootAccessible* AsRoot();
virtual mozilla::a11y::TableAccessible* AsTable() { return nsnull; }
inline bool IsTextLeaf() const { return mFlags & eTextLeafAccessible; } inline bool IsTextLeaf() const { return mFlags & eTextLeafAccessible; }
nsTextAccessible* AsTextLeaf(); nsTextAccessible* AsTextLeaf();

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

@ -0,0 +1,170 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef TABLE_ACCESSIBLE_H
#define TABLE_ACCESSIBLE_H
#include "nsString.h"
#include "nsTArray.h"
#include "prtypes.h"
class nsAccessible;
namespace mozilla {
namespace a11y {
/**
* Accessible table interface.
*/
class TableAccessible
{
public:
/**
* Return the caption accessible if any for this table.
*/
virtual nsAccessible* Caption() { return nsnull; }
/**
* Get the summary for this table.
*/
virtual void Summary(nsString& aSummary) { aSummary.Truncate(); }
/**
* Return the number of columns in the table.
*/
virtual PRUint32 ColCount() { return 0; }
/**
* Return the number of rows in the table.
*/
virtual PRUint32 RowCount() { return 0; }
/**
* Return the accessible for the cell at the given row and column indices.
*/
virtual nsAccessible* CellAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return nsnull; }
/**
* Return the index of the cell at the given row and column.
*/
virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return -1; }
/**
* Return the column index of the cell with the given index.
*/
virtual PRInt32 ColIndexAt(PRUint32 aCellIdx) { return -1; }
/**
* Return the row index of the cell with the given index.
*/
virtual PRInt32 RowIndexAt(PRUint32 aCellIdx) { return -1; }
/**
* Get the row and column indices for the cell at the given index.
*/
virtual void RowAndColIndicesAt(PRUint32 aCellIdx, PRInt32* aRowIdx,
PRInt32* aColIdx) {}
/**
* Return the number of columns occupied by the cell at the given row and
* column indices.
*/
virtual PRUint32 ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return 1; }
/**
* Return the number of rows occupied by the cell at the given row and column
* indices.
*/
virtual PRUint32 RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return 1; }
/**
* Get the description of the given column.
*/
virtual void ColDescription(PRUint32 aColIdx, nsString& aDescription)
{ aDescription.Truncate(); }
/**
* Get the description for the given row.
*/
virtual void RowDescription(PRUint32 aRowIdx, nsString& aDescription)
{ aDescription.Truncate(); }
/**
* Return true if the given column is selected.
*/
virtual bool IsColSelected(PRUint32 aColIdx) { return false; }
/**
* Return true if the given row is selected.
*/
virtual bool IsRowSelected(PRUint32 aRowIdx) { return false; }
/**
* Return true if the given cell is selected.
*/
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx) { return false; }
/**
* Return the number of selected cells.
*/
virtual PRUint32 SelectedCellCount() { return 0; }
/**
* Return the number of selected columns.
*/
virtual PRUint32 SelectedColCount() { return 0; }
/**
* Return the number of selected rows.
*/
virtual PRUint32 SelectedRowCount() { return 0; }
/**
* Get the set of selected cells.
*/
virtual void SelectedCells(nsTArray<nsAccessible*>* aCells) {}
/**
* Get the set of selected column indices.
*/
virtual void SelectedColIndices(nsTArray<PRUint32>* aCols) {}
/**
* Get the set of selected row indices.
*/
virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows) {}
/**
* Select the given column unselecting any other selected columns.
*/
virtual void SelectCol(PRUint32 aColIdx) {}
/**
* Select the given row unselecting all other previously selected rows.
*/
virtual void SelectRow(PRUint32 aRowIdx) {}
/**
* Unselect the given column leaving other selected columns selected.
*/
virtual void UnselectCol(PRUint32 aColIdx) {}
/**
* Unselect the given row leaving other selected rows selected.
*/
virtual void UnselectRow(PRUint32 aRowIdx) {}
/**
* Return true if the table is probably for layout.
*/
virtual bool IsProbablyLayoutTable() { return false; }
};
} // namespace a11y
} // namespace mozilla
#endif

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

@ -73,6 +73,8 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \ LOCAL_INCLUDES = \
-I$(srcdir)/../base \ -I$(srcdir)/../base \
-I$(srcdir)/../generic \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../../../layout/generic \ -I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \ -I$(srcdir)/../../../layout/xul/base/src \
$(NULL) $(NULL)

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

@ -436,7 +436,7 @@ nsHTMLTableHeaderCellAccessible::NativeRole()
nsHTMLTableAccessible:: nsHTMLTableAccessible::
nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
nsAccessibleWrap(aContent, aDoc) nsAccessibleWrap(aContent, aDoc), xpcAccessibleTable(this)
{ {
} }
@ -446,6 +446,16 @@ nsHTMLTableAccessible::
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableAccessible, nsAccessible, NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableAccessible, nsAccessible,
nsHTMLTableAccessible, nsIAccessibleTable) nsHTMLTableAccessible, nsIAccessibleTable)
////////////////////////////////////////////////////////////////////////////////
//nsAccessNode
void
nsHTMLTableAccessible::Shutdown()
{
mTable = nsnull;
nsAccessibleWrap::Shutdown();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableAccessible: nsAccessible implementation // nsHTMLTableAccessible: nsAccessible implementation
@ -511,9 +521,7 @@ nsHTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes); nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
bool isProbablyForLayout; if (IsProbablyLayoutTable()) {
IsProbablyForLayout(&isProbablyForLayout);
if (isProbablyForLayout) {
nsAutoString oldValueUnused; nsAutoString oldValueUnused;
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"), aAttributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"),
NS_LITERAL_STRING("true"), oldValueUnused); NS_LITERAL_STRING("true"), oldValueUnused);
@ -538,13 +546,11 @@ nsHTMLTableAccessible::RelationByType(PRUint32 aType)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableAccessible: nsIAccessibleTable implementation // nsHTMLTableAccessible: nsIAccessibleTable implementation
NS_IMETHODIMP nsAccessible*
nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption) nsHTMLTableAccessible::Caption()
{ {
NS_ENSURE_ARG_POINTER(aCaption); nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
return child && child->Role() == roles::CAPTION ? child : nsnull;
NS_IF_ADDREF(*aCaption = Caption());
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -1307,8 +1313,7 @@ nsHTMLTableAccessible::Description(nsString& aDescription)
#ifdef SHOW_LAYOUT_HEURISTIC #ifdef SHOW_LAYOUT_HEURISTIC
if (aDescription.IsEmpty()) { if (aDescription.IsEmpty()) {
bool isProbablyForLayout; bool isProbablyForLayout = IsProbablyLayoutTable();
IsProbablyForLayout(&isProbablyForLayout);
aDescription = mLayoutHeuristic; aDescription = mLayoutHeuristic;
} }
#ifdef DEBUG_A11Y #ifdef DEBUG_A11Y
@ -1357,8 +1362,8 @@ nsHTMLTableAccessible::HasDescendant(const nsAString& aTagName,
return !!foundItem; return !!foundItem;
} }
NS_IMETHODIMP bool
nsHTMLTableAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout) nsHTMLTableAccessible::IsProbablyLayoutTable()
{ {
// Implement a heuristic to determine if table is most likely used for layout // Implement a heuristic to determine if table is most likely used for layout
// XXX do we want to look for rowspan or colspan, especialy that span all but a couple cells // XXX do we want to look for rowspan or colspan, especialy that span all but a couple cells
@ -1370,18 +1375,16 @@ nsHTMLTableAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
// Change to |#define SHOW_LAYOUT_HEURISTIC DEBUG| before final release // Change to |#define SHOW_LAYOUT_HEURISTIC DEBUG| before final release
#ifdef SHOW_LAYOUT_HEURISTIC #ifdef SHOW_LAYOUT_HEURISTIC
#define RETURN_LAYOUT_ANSWER(isLayout, heuristic) \ #define RETURN_LAYOUT_ANSWER(isLayout, heuristic) \
{ *aIsProbablyForLayout = isLayout; \ { \
mLayoutHeuristic = isLayout ? NS_LITERAL_STRING("layout table: ") : NS_LITERAL_STRING("data table: "); \ mLayoutHeuristic = isLayout ? \
mLayoutHeuristic += NS_LITERAL_STRING(heuristic); return NS_OK; } NS_LITERAL_STRING("layout table: " heuristic) : \
NS_LITERAL_STRING("data table: " heuristic); \
return isLayout; \
}
#else #else
#define RETURN_LAYOUT_ANSWER(isLayout, heuristic) { *aIsProbablyForLayout = isLayout; return NS_OK; } #define RETURN_LAYOUT_ANSWER(isLayout, heuristic) { return isLayout; }
#endif #endif
*aIsProbablyForLayout = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsDocAccessible* docAccessible = Document(); nsDocAccessible* docAccessible = Document();
if (docAccessible) { if (docAccessible) {
PRUint64 docState = docAccessible->State(); PRUint64 docState = docAccessible->State();

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

@ -41,6 +41,8 @@
#include "nsHyperTextAccessibleWrap.h" #include "nsHyperTextAccessibleWrap.h"
#include "nsIAccessibleTable.h" #include "nsIAccessibleTable.h"
#include "TableAccessible.h"
#include "xpcAccessibleTable.h"
class nsITableLayout; class nsITableLayout;
class nsITableCellLayout; class nsITableCellLayout;
@ -121,16 +123,28 @@ public:
} }
class nsHTMLTableAccessible : public nsAccessibleWrap, class nsHTMLTableAccessible : public nsAccessibleWrap,
public nsIAccessibleTable public xpcAccessibleTable,
public nsIAccessibleTable,
public mozilla::a11y::TableAccessible
{ {
public: public:
nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc); nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TABLEACCESSIBLE_IMPL_CID) NS_DECLARE_STATIC_IID_ACCESSOR(NS_TABLEACCESSIBLE_IMPL_CID)
// nsIAccessible Table
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
// TableAccessible
virtual nsAccessible* Caption();
virtual bool IsProbablyLayoutTable();
// nsAccessNode
virtual void Shutdown();
// nsAccessible // nsAccessible
virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
virtual void Description(nsString& aDescription); virtual void Description(nsString& aDescription);
virtual nsresult GetNameInternal(nsAString& aName); virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole(); virtual mozilla::a11y::role NativeRole();
@ -138,13 +152,6 @@ public:
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes); virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual Relation RelationByType(PRUint32 aRelationType); virtual Relation RelationByType(PRUint32 aRelationType);
// TableAccessible
inline nsAccessible* Caption() const
{
nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
return child && child->Role() == mozilla::a11y::roles::CAPTION ? child : nsnull;
}
// nsHTMLTableAccessible // nsHTMLTableAccessible
/** /**

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

@ -50,6 +50,7 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \ CPPSRCS = \
nsAccEvent.cpp \ nsAccEvent.cpp \
nsAccessibleRelation.cpp \ nsAccessibleRelation.cpp \
xpcAccessibleTable.cpp \
$(NULL) $(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib. # we don't want the shared lib, but we want to force the creation of a static lib.
@ -59,4 +60,5 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \ LOCAL_INCLUDES = \
-I$(srcdir)/../base \ -I$(srcdir)/../base \
-I$(srcdir)/../generic \
$(NULL) $(NULL)

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

@ -0,0 +1,34 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "xpcAccessibleTable.h"
#include "nsAccessible.h"
#include "TableAccessible.h"
nsresult
xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
{
NS_ENSURE_ARG_POINTER(aCaption);
*aCaption = nsnull;
if (!mTable)
return NS_ERROR_FAILURE;
NS_IF_ADDREF(*aCaption = mTable->Caption());
return NS_OK;
}
nsresult
xpcAccessibleTable::IsProbablyForLayout(bool* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = false;
if (!mTable)
return NS_ERROR_FAILURE;
*aResult = mTable->IsProbablyLayoutTable();
return NS_OK;
}

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

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
#define MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
#include "nscore.h"
class nsIAccessible;
namespace mozilla {
namespace a11y {
class TableAccessible;
}
}
class xpcAccessibleTable
{
public:
xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
nsresult GetCaption(nsIAccessible** aCaption);
nsresult IsProbablyForLayout(bool* aIsForLayout);
protected:
mozilla::a11y::TableAccessible* mTable;
};
#define NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE \
NS_IMETHOD GetCaption(nsIAccessible** aCaption) \
{ return xpcAccessibleTable::GetCaption(aCaption); } \
NS_SCRIPTABLE NS_IMETHOD GetSummary(nsAString & aSummary); \
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRInt32 *aColumnCount); \
NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32 *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); \
NS_SCRIPTABLE NS_IMETHOD GetRowIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetRowAndColumnIndicesAt(PRInt32 cellIndex, PRInt32 *rowIndex NS_OUTPARAM, PRInt32 *columnIndex NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetColumnExtentAt(PRInt32 row, PRInt32 column, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetRowExtentAt(PRInt32 row, PRInt32 column, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetColumnDescription(PRInt32 columnIndex, nsAString & _retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetRowDescription(PRInt32 rowIndex, nsAString & _retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD IsColumnSelected(PRInt32 columnIndex, bool *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD IsRowSelected(PRInt32 rowIndex, bool *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD IsCellSelected(PRInt32 rowIndex, PRInt32 columnIndex, bool *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellCount(PRUint32 *aSelectedCellCount); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnCount(PRUint32 *aSelectedColumnCount); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedRowCount(PRUint32 *aSelectedRowCount); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedCells(nsIArray * *aSelectedCells); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32 *cellsArraySize NS_OUTPARAM, PRInt32 **cellsArray NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedRowIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD SelectRow(PRInt32 rowIndex); \
NS_SCRIPTABLE NS_IMETHOD SelectColumn(PRInt32 columnIndex); \
NS_SCRIPTABLE NS_IMETHOD UnselectColumn(PRInt32 columnIndex); \
NS_IMETHOD UnselectRow(PRInt32 aRowIdx); \
NS_IMETHOD IsProbablyForLayout(bool* aResult) \
{ return xpcAccessibleTable::IsProbablyForLayout(aResult); } \
#endif // MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_

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

@ -72,7 +72,9 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \ LOCAL_INCLUDES = \
-I$(srcdir) \ -I$(srcdir) \
-I$(srcdir)/../base \ -I$(srcdir)/../base \
-I$(srcdir)/../generic \
-I$(srcdir)/../html \ -I$(srcdir)/../html \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../../../layout/generic \ -I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \ -I$(srcdir)/../../../layout/xul/base/src \
$(NULL) $(NULL)

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

@ -134,7 +134,7 @@ nsXULColumnItemAccessible::DoAction(PRUint8 aIndex)
nsXULListboxAccessible:: nsXULListboxAccessible::
nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
XULSelectControlAccessible(aContent, aDoc) XULSelectControlAccessible(aContent, aDoc), xpcAccessibleTable(this)
{ {
nsIContent* parentContent = mContent->GetParent(); nsIContent* parentContent = mContent->GetParent();
if (parentContent) { if (parentContent) {
@ -164,6 +164,16 @@ nsXULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_ERROR_NO_INTERFACE; return NS_ERROR_NO_INTERFACE;
} }
////////////////////////////////////////////////////////////////////////////////
//nsAccessNode
void
nsXULListboxAccessible::Shutdown()
{
mTable = nsnull;
XULSelectControlAccessible::Shutdown();
}
bool bool
nsXULListboxAccessible::IsMulticolumn() nsXULListboxAccessible::IsMulticolumn()
{ {
@ -229,15 +239,6 @@ nsXULListboxAccessible::NativeRole()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsXULListboxAccessible. nsIAccessibleTable // nsXULListboxAccessible. nsIAccessibleTable
NS_IMETHODIMP
nsXULListboxAccessible::GetCaption(nsIAccessible **aCaption)
{
NS_ENSURE_ARG_POINTER(aCaption);
*aCaption = nsnull;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsXULListboxAccessible::GetSummary(nsAString &aSummary) nsXULListboxAccessible::GetSummary(nsAString &aSummary)
{ {
@ -820,15 +821,6 @@ nsXULListboxAccessible::UnselectColumn(PRInt32 aColumn)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsXULListboxAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
{
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
*aIsProbablyForLayout = false;
return NS_OK;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsXULListboxAccessible: Widgets // nsXULListboxAccessible: Widgets

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

@ -40,11 +40,12 @@
#ifndef __nsXULListboxAccessible_h__ #ifndef __nsXULListboxAccessible_h__
#define __nsXULListboxAccessible_h__ #define __nsXULListboxAccessible_h__
#include "nsIAccessibleTable.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsXULMenuAccessible.h" #include "nsXULMenuAccessible.h"
#include "nsBaseWidgetAccessible.h" #include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleTable.h"
#include "TableAccessible.h"
#include "xpcAccessibleTable.h"
#include "XULSelectControlAccessible.h" #include "XULSelectControlAccessible.h"
class nsIWeakReference; class nsIWeakReference;
@ -90,19 +91,27 @@ public:
* A class the represents the XUL Listbox widget. * A class the represents the XUL Listbox widget.
*/ */
class nsXULListboxAccessible : public XULSelectControlAccessible, class nsXULListboxAccessible : public XULSelectControlAccessible,
public nsIAccessibleTable public xpcAccessibleTable,
public nsIAccessibleTable,
public mozilla::a11y::TableAccessible
{ {
public: public:
nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
virtual ~nsXULListboxAccessible() {} virtual ~nsXULListboxAccessible() {}
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
// nsIAccessibleTable
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
// nsIAccessible // nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue); NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessNode
virtual void Shutdown();
// nsAccessible // nsAccessible
virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
virtual mozilla::a11y::role NativeRole(); virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState(); virtual PRUint64 NativeState();

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

@ -58,7 +58,7 @@ using namespace mozilla::a11y;
nsXULTreeGridAccessible:: nsXULTreeGridAccessible::
nsXULTreeGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : nsXULTreeGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
nsXULTreeAccessible(aContent, aDoc) nsXULTreeAccessible(aContent, aDoc), xpcAccessibleTable(this)
{ {
} }
@ -72,15 +72,6 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeGridAccessible,
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessible: nsIAccessibleTable implementation // nsXULTreeGridAccessible: nsIAccessibleTable implementation
NS_IMETHODIMP
nsXULTreeGridAccessible::GetCaption(nsIAccessible **aCaption)
{
NS_ENSURE_ARG_POINTER(aCaption);
*aCaption = nsnull;
return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsXULTreeGridAccessible::GetSummary(nsAString &aSummary) nsXULTreeGridAccessible::GetSummary(nsAString &aSummary)
{ {
@ -570,13 +561,14 @@ nsXULTreeGridAccessible::UnselectColumn(PRInt32 aColumnIndex)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP ////////////////////////////////////////////////////////////////////////////////
nsXULTreeGridAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout) // nsXULTreeGridAccessible: nsAccessNode implementation
{
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
*aIsProbablyForLayout = false;
return NS_OK; void
nsXULTreeGridAccessible::Shutdown()
{
mTable = nsnull;
nsXULTreeAccessible::Shutdown();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

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

@ -39,15 +39,17 @@
#ifndef __nsXULTreeGridAccessible_h__ #ifndef __nsXULTreeGridAccessible_h__
#define __nsXULTreeGridAccessible_h__ #define __nsXULTreeGridAccessible_h__
#include "nsIAccessibleTable.h"
#include "nsXULTreeAccessible.h" #include "nsXULTreeAccessible.h"
#include "TableAccessible.h"
#include "xpcAccessibleTable.h"
/** /**
* Represents accessible for XUL tree in the case when it has multiple columns. * Represents accessible for XUL tree in the case when it has multiple columns.
*/ */
class nsXULTreeGridAccessible : public nsXULTreeAccessible, class nsXULTreeGridAccessible : public nsXULTreeAccessible,
public nsIAccessibleTable public xpcAccessibleTable,
public nsIAccessibleTable,
public mozilla::a11y::TableAccessible
{ {
public: public:
nsXULTreeGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc); nsXULTreeGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
@ -56,9 +58,13 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTable // nsIAccessibleTable
NS_DECL_NSIACCESSIBLETABLE NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
// nsAccessNode
virtual void Shutdown();
// nsAccessible // nsAccessible
virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
virtual mozilla::a11y::role NativeRole(); virtual mozilla::a11y::role NativeRole();
protected: protected: