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

This commit is contained in:
Trevor Saunders 2012-03-27 20:53:58 -04:00
parent 3e19a89dd0
commit 8357812e8a
19 changed files with 402 additions and 114 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -41,6 +41,8 @@
#include "nsHyperTextAccessibleWrap.h"
#include "nsIAccessibleTable.h"
#include "TableAccessible.h"
#include "xpcAccessibleTable.h"
class nsITableLayout;
class nsITableCellLayout;
@ -121,16 +123,28 @@ public:
}
class nsHTMLTableAccessible : public nsAccessibleWrap,
public nsIAccessibleTable
public xpcAccessibleTable,
public nsIAccessibleTable,
public mozilla::a11y::TableAccessible
{
public:
nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
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
virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
virtual void Description(nsString& aDescription);
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
@ -138,13 +152,6 @@ public:
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
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
/**

View File

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

View File

@ -50,6 +50,7 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
nsAccEvent.cpp \
nsAccessibleRelation.cpp \
xpcAccessibleTable.cpp \
$(NULL)
# 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 = \
-I$(srcdir)/../base \
-I$(srcdir)/../generic \
$(NULL)

View File

@ -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;
}

View File

@ -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_

View File

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

View File

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

View File

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

View File

@ -58,7 +58,7 @@ using namespace mozilla::a11y;
nsXULTreeGridAccessible::
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
NS_IMETHODIMP
nsXULTreeGridAccessible::GetCaption(nsIAccessible **aCaption)
{
NS_ENSURE_ARG_POINTER(aCaption);
*aCaption = nsnull;
return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSummary(nsAString &aSummary)
{
@ -570,13 +561,14 @@ nsXULTreeGridAccessible::UnselectColumn(PRInt32 aColumnIndex)
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
{
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
*aIsProbablyForLayout = false;
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessible: nsAccessNode implementation
return NS_OK;
void
nsXULTreeGridAccessible::Shutdown()
{
mTable = nsnull;
nsXULTreeAccessible::Shutdown();
}
////////////////////////////////////////////////////////////////////////////////

View File

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