Bug 396336 - header of xul:list is not accessible, r=Evan.Yan, r=enndeakin, sr=neil, a=dsicore

This commit is contained in:
surkov.alexander@gmail.com 2007-09-18 20:31:14 -07:00
parent 39fbef4949
commit 4549602822
8 changed files with 157 additions and 172 deletions

View File

@ -72,6 +72,8 @@ interface nsIAccessibleProvider : nsISupports
const long XULLink = 0x0000100A;
const long XULListbox = 0x0000100B;
const long XULListitem = 0x0000100C;
const long XULListHead = 0x00001024;
const long XULListHeader = 0x00001025;
const long XULMenubar = 0x0000100D;
const long XULMenuitem = 0x0000100E;
const long XULMenupopup = 0x0000100F;
@ -97,7 +99,7 @@ interface nsIAccessibleProvider : nsISupports
const long XULThumb = 0x0000101B;
const long XULTree = 0x0000101C;
const long XULTreeColumns = 0x0000101D;
const long XULTreeColumnitem = 0x0000101E;
const long XULTreeColumnItem = 0x0000101E;
const long XULToolbar = 0x0000101F;
const long XULToolbarSeparator = 0x00001020;
const long XULTooltip = 0x00001021;

View File

@ -287,7 +287,7 @@ getColumnHeaderCB(AtkTable *aTable, gint aColumn)
//
// 1. "getColumnHeaderCB" defined in AtkTableIface should return object
// whose role is "ATK_ROLE_TABLE_COLUMN_HEADER", which is implemented
// by nsXULTreeColumnitemAccessible.
// by nsXULTreeColumnItemAccessible.
//
// 2. "GetColumnHeader" defined in nsIAccessibleTable returns
// nsXULTreeColumnsAccessibleWrap, which exports nsIAccessibleTable and is

View File

@ -1603,6 +1603,12 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
case nsIAccessibleProvider::XULListbox:
*aAccessible = new nsXULListboxAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULListHead:
*aAccessible = new nsXULColumnsAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULListHeader:
*aAccessible = new nsXULColumnItemAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULListitem:
*aAccessible = new nsXULListitemAccessible(aNode, weakShell);
break;
@ -1673,8 +1679,8 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
case nsIAccessibleProvider::XULTreeColumns:
*aAccessible = new nsXULTreeColumnsAccessibleWrap(aNode, weakShell);
break;
case nsIAccessibleProvider::XULTreeColumnitem:
*aAccessible = new nsXULTreeColumnitemAccessible(aNode, weakShell);
case nsIAccessibleProvider::XULTreeColumnItem:
*aAccessible = new nsXULColumnItemAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULToolbar:
*aAccessible = new nsXULToolbarAccessible(aNode, weakShell);

View File

@ -48,24 +48,102 @@
#include "nsIServiceManager.h"
#include "nsCaseTreatment.h"
/**
* Selects, Listboxes and Comboboxes, are made up of a number of different
* widgets, some of which are shared between the two. This file contains
* all of the widgets for both of the Selects, for XUL only.
* (except nsXULRadioGroupAccessible which inherits
* nsXULSelectableAccessible so that it supports nsIAccessibleSelectable)
*
* Listbox:
* - nsXULListboxAccessible <richlistbox/>
* - nsXULListitemAccessible <richlistitem/>
*
* Comboboxes:
* - nsXULComboboxAccessible <menulist/>
* - nsXULMenuAccessible <menupopup/>
* - nsXULMenuitemAccessible <menuitem/>
*/
////////////////////////////////////////////////////////////////////////////////
// nsXULColumnsAccessible
/** ----- nsXULListboxAccessible ----- */
nsXULColumnsAccessible::
nsXULColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
nsAccessibleWrap(aDOMNode, aShell)
{
}
NS_IMETHODIMP
nsXULColumnsAccessible::GetRole(PRUint32 *aRole)
{
NS_ENSURE_ARG_POINTER(aRole);
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
}
NS_IMETHODIMP
nsXULColumnsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
if (aExtraState)
*aExtraState = 0;
*aState = nsIAccessibleStates::STATE_READONLY;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULColumnItemAccessible
nsXULColumnItemAccessible::
nsXULColumnItemAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
nsLeafAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP
nsXULColumnItemAccessible::GetRole(PRUint32 *aRole)
{
NS_ENSURE_ARG_POINTER(aRole);
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
}
NS_IMETHODIMP
nsXULColumnItemAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
if (aExtraState)
*aExtraState = 0;
*aState = nsIAccessibleStates::STATE_READONLY;
return NS_OK;
}
NS_IMETHODIMP
nsXULColumnItemAccessible::GetName(nsAString& aName)
{
return GetXULName(aName);
}
NS_IMETHODIMP
nsXULColumnItemAccessible::GetNumActions(PRUint8 *aNumActions)
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = 1;
return NS_OK;
}
NS_IMETHODIMP
nsXULColumnItemAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (aIndex != eAction_Click)
return NS_ERROR_INVALID_ARG;
aName.AssignLiteral("click");
return NS_OK;
}
NS_IMETHODIMP
nsXULColumnItemAccessible::DoAction(PRUint8 aIndex)
{
if (aIndex != eAction_Click)
return NS_ERROR_INVALID_ARG;
return DoCommand();
}
////////////////////////////////////////////////////////////////////////////////
// nsXULListboxAccessible
/** Constructor */
nsXULListboxAccessible::nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):

View File

@ -40,13 +40,49 @@
#include "nsCOMPtr.h"
#include "nsXULMenuAccessible.h"
#include "nsBaseWidgetAccessible.h"
class nsIWeakReference;
/**
* Selects, Listboxes and Comboboxes, are made up of a number of different
* widgets, some of which are shared between the two. This file contains
* all of the widgets for both of the Selects, for XUL only.
* nsXULColumnsAccessible are accessible for list and tree columns elements
* (xul:treecols and xul:listcols).
*/
class nsXULColumnsAccessible : public nsAccessibleWrap
{
public:
nsXULColumnsAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
// nsIAccessible
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
};
/**
* nsXULColumnAccessible are accessibles for list and tree column elements
* (xul:listcol and xul:treecol).
*/
class nsXULColumnItemAccessible : public nsLeafAccessible
{
public:
nsXULColumnItemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
// nsIAccessible
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
enum { eAction_Click = 0 };
};
/**
* Listboxes (xul:listbox) and Comboboxes (xul:menulist) are made up of a
* number of different widgets, some of which are shared between the two.
* This file contains all of the widgets for both of them, for XUL only.
*
* Listbox:
* - nsXULListboxAccessible

View File

@ -1049,50 +1049,18 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetAccessibleRelated(PRUint32 aRelationTy
#endif
}
// ---------- nsXULTreeColumnsAccessible ----------
nsXULTreeColumnsAccessible::nsXULTreeColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsAccessibleWrap(aDOMNode, aShell)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeColumnsAccessible
nsXULTreeColumnsAccessible::
nsXULTreeColumnsAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsXULColumnsAccessible(aDOMNode, aShell)
{
}
NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeColumnsAccessible, nsAccessible)
NS_IMETHODIMP
nsXULTreeColumnsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
nsXULTreeColumnsAccessible::GetNextSibling(nsIAccessible **aNextSibling)
{
if (aExtraState)
*aExtraState = 0;
*aState = nsIAccessibleStates::STATE_READONLY;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessible::GetRole(PRUint32 *_retval)
{
*_retval = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessible::GetNumActions(PRUint8 *_retval)
{
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (aIndex == eAction_Click) {
aName.AssignLiteral("click");
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsXULTreeColumnsAccessible::GetNextSibling(nsIAccessible **aNextSibling)
{
nsresult ret = nsAccessible::GetNextSibling(aNextSibling);
nsresult ret = nsXULColumnsAccessible::GetNextSibling(aNextSibling);
if (*aNextSibling == nsnull) { // if there is not other sibling, use the first row as its sibling
nsCOMPtr<nsITreeBoxObject> tree;
@ -1114,73 +1082,6 @@ NS_IMETHODIMP nsXULTreeColumnsAccessible::GetNextSibling(nsIAccessible **aNextSi
}
}
return ret;
return ret;
}
NS_IMETHODIMP nsXULTreeColumnsAccessible::GetPreviousSibling(nsIAccessible **aPreviousSibling)
{
return nsAccessible::GetPreviousSibling(aPreviousSibling);
}
NS_IMETHODIMP nsXULTreeColumnsAccessible::DoAction(PRUint8 index)
{
if (index == eAction_Click)
return NS_OK;
return NS_ERROR_INVALID_ARG;
}
// ---------- nsXULTreeColumnitemAccessible ----------
nsXULTreeColumnitemAccessible::nsXULTreeColumnitemAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsLeafAccessible(aDOMNode, aShell)
{
}
NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeColumnitemAccessible, nsLeafAccessible)
NS_IMETHODIMP
nsXULTreeColumnitemAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
if (aExtraState)
*aExtraState = 0;
*aState = nsIAccessibleStates::STATE_READONLY;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnitemAccessible::GetName(nsAString& _retval)
{
return GetXULName(_retval);
}
NS_IMETHODIMP nsXULTreeColumnitemAccessible::GetRole(PRUint32 *_retval)
{
*_retval = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnitemAccessible::GetNumActions(PRUint8 *_retval)
{
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnitemAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (aIndex == eAction_Click) {
aName.AssignLiteral("click");
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsXULTreeColumnitemAccessible::DoAction(PRUint8 index)
{
if (index == eAction_Click) {
return DoCommand();
}
return NS_ERROR_INVALID_ARG;
}

View File

@ -38,7 +38,6 @@
#ifndef __nsXULTreeAccessible_h__
#define __nsXULTreeAccessible_h__
#include "nsBaseWidgetAccessible.h"
#include "nsITreeBoxObject.h"
#include "nsITreeView.h"
#include "nsITreeColumns.h"
@ -135,46 +134,13 @@ protected:
nsCOMPtr<nsITreeColumn> mColumn;
};
class nsXULTreeColumnsAccessible : public nsAccessibleWrap
class nsXULTreeColumnsAccessible : public nsXULColumnsAccessible
{
public:
enum { eAction_Click = 0 };
NS_DECL_ISUPPORTS_INHERITED
nsXULTreeColumnsAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeColumnsAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD DoAction(PRUint8 index);
};
class nsXULTreeColumnitemAccessible : public nsLeafAccessible
{
public:
enum { eAction_Click = 0 };
NS_DECL_ISUPPORTS_INHERITED
nsXULTreeColumnitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeColumnitemAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetName(nsAString& _retval);
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
// nsIAccessible
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
};
#endif

View File

@ -426,10 +426,6 @@ listbox {
-moz-binding: url("chrome://global/content/bindings/listbox.xml#listbox");
}
listcols, listcol {
-moz-binding: url("chrome://global/content/bindings/listbox.xml#listbox-base");
}
listhead {
-moz-binding: url("chrome://global/content/bindings/listbox.xml#listhead");
}