about:startup - merge with trunk

This commit is contained in:
Daniel Brooks 2010-09-21 15:06:04 -04:00
commit d0a43f8734
3453 changed files with 154295 additions and 71632 deletions

View File

@ -56,7 +56,7 @@ interface nsIDOMWindow;
* nsIAccessNode::GetAccessibleDocument() or
* nsIAccessibleEvent::GetAccessibleDocument()
*/
[scriptable, uuid(03c6ce8a-aa40-4484-9282-e6579c56e054)]
[scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)]
interface nsIAccessibleDocument : nsISupports
{
/**
@ -99,4 +99,19 @@ interface nsIAccessibleDocument : nsISupports
* For example, in Windows you can static cast it to an HWND.
*/
[noscript] readonly attribute voidPtr windowHandle;
/**
* Return the parent document accessible.
*/
readonly attribute nsIAccessibleDocument parentDocument;
/**
* Return the count of child document accessibles.
*/
readonly attribute unsigned long childDocumentCount;
/**
* Return the child document accessible at the given index.
*/
nsIAccessibleDocument getChildDocumentAt(in unsigned long index);
};

View File

@ -752,11 +752,8 @@ getRoleCB(AtkObject *aAtkObj)
#endif
if (aAtkObj->role == ATK_ROLE_INVALID) {
PRUint32 accRole, atkRole;
nsresult rv = accWrap->GetRole(&accRole);
NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);
atkRole = atkRoleMap[accRole]; // map to the actual value
// map to the actual value
PRUint32 atkRole = atkRoleMap[accWrap->Role()];
NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
aAtkObj->role = static_cast<AtkRole>(atkRole);

View File

@ -124,11 +124,9 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
nsresult rv = accWrap->GetKeyboardShortcut(accessKey);
if (NS_SUCCEEDED(rv) && !accessKey.IsEmpty()) {
nsCOMPtr<nsIAccessible> parentAccessible;
accWrap->GetParent(getter_AddRefs(parentAccessible));
if (parentAccessible) {
PRUint32 geckoRole = nsAccUtils::RoleInternal(parentAccessible);
PRUint32 atkRole = atkRoleMap[geckoRole];
nsAccessible* parent = accWrap->GetParent();
if (parent) {
PRUint32 atkRole = atkRoleMap[parent->NativeRole()];
if (atkRole == ATK_ROLE_MENU_BAR) {
//it is topmenu, change from "Alt+f" to "f;<Alt>f"
@ -140,11 +138,11 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
else if ((atkRole == ATK_ROLE_MENU) || (atkRole == ATK_ROLE_MENU_ITEM)) {
//it is submenu, change from "s" to "s;<Alt>f:s"
nsAutoString allKey = accessKey;
nsCOMPtr<nsIAccessible> grandParentAcc = parentAccessible;
nsAccessible* grandParent = parent;
while ((grandParentAcc) && (atkRole != ATK_ROLE_MENU_BAR)) {
do {
nsAutoString grandParentKey;
grandParentAcc->GetKeyboardShortcut(grandParentKey);
grandParent->GetKeyboardShortcut(grandParentKey);
if (!grandParentKey.IsEmpty()) {
nsAutoString rightChar;
@ -152,11 +150,9 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
allKey = rightChar + NS_LITERAL_STRING(":") + allKey;
}
nsCOMPtr<nsIAccessible> tempAcc = grandParentAcc;
tempAcc->GetParent(getter_AddRefs(grandParentAcc));
geckoRole = nsAccUtils::RoleInternal(grandParentAcc);
atkRole = atkRoleMap[geckoRole];
}
} while ((grandParent = grandParent->GetParent()) &&
atkRoleMap[grandParent->NativeRole()] != ATK_ROLE_MENU_BAR);
allKeyBinding = accessKey + NS_LITERAL_STRING(";<Alt>") +
allKey;
}

View File

@ -80,9 +80,7 @@ textInterfaceInitCB(AtkTextIface *aIface)
void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
{
// convert each char to "*" when it's "password text"
PRUint32 accRole = 0;
accWrap->GetRoleInternal(&accRole);
PRUint32 atkRole = atkRoleMap[accRole];
PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
if (atkRole == ATK_ROLE_PASSWORD_TEXT) {
for (PRUint32 i = 0; i < aString.Length(); i++)
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
@ -189,9 +187,7 @@ getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
accText->GetCharacterAtOffset(aOffset, &uniChar);
// convert char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRoleInternal(&accRole);
PRUint32 atkRole = atkRoleMap[accRole];
PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
if (atkRole == ATK_ROLE_PASSWORD_TEXT)
uniChar = '*';

View File

@ -52,7 +52,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
mPosInSet = 1;
for (PRInt32 idx = indexInParent - 1; idx >=0 ; idx--) {
nsAccessible* sibling = parent->GetChildAt(idx);
PRUint32 siblingRole = nsAccUtils::Role(sibling);
PRUint32 siblingRole = sibling->Role();
// If the sibling is separator then the group is ended.
if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
@ -96,7 +96,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
for (PRInt32 idx = indexInParent + 1; idx < siblingCount; idx++) {
nsAccessible* sibling = parent->GetChildAt(idx);
PRUint32 siblingRole = nsAccUtils::Role(sibling);
PRUint32 siblingRole = sibling->Role();
// If the sibling is separator then the group is ended.
if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
@ -131,7 +131,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
return;
// Compute parent.
PRUint32 parentRole = nsAccUtils::Role(parent);
PRUint32 parentRole = parent->Role();
// In the case of ARIA row in treegrid, return treegrid since ARIA
// groups aren't used to organize levels in ARIA treegrids.
@ -153,14 +153,18 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
}
nsAccessible* parentPrevSibling = parent->GetSiblingAtOffset(-1);
PRUint32 parentPrevSiblingRole = nsAccUtils::Role(parentPrevSibling);
if (!parentPrevSibling)
return;
PRUint32 parentPrevSiblingRole = parentPrevSibling->Role();
if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_TEXT_LEAF) {
// XXX Sometimes an empty text accessible is in the hierarchy here,
// although the text does not appear to be rendered, GetRenderedText()
// says that it is so we need to skip past it to find the true
// previous sibling.
parentPrevSibling = parentPrevSibling->GetSiblingAtOffset(-1);
parentPrevSiblingRole = nsAccUtils::Role(parentPrevSibling);
if (parentPrevSibling)
parentPrevSiblingRole = parentPrevSibling->Role();
}
// Previous sibling of parent group is a tree item, this is the

View File

@ -59,7 +59,7 @@ public:
*/
static AccGroupInfo* CreateGroupInfo(nsAccessible* aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
if (role != nsIAccessibleRole::ROLE_ROW &&
role != nsIAccessibleRole::ROLE_GRID_CELL &&
role != nsIAccessibleRole::ROLE_OUTLINEITEM &&

View File

@ -55,13 +55,13 @@ filters::GetSelectable(nsAccessible* aAccessible)
bool
filters::GetRow(nsAccessible* aAccessible)
{
return nsAccUtils::Role(aAccessible) == nsIAccessibleRole::ROLE_ROW;
return aAccessible->Role() == nsIAccessibleRole::ROLE_ROW;
}
bool
filters::GetCell(nsAccessible* aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
return role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER;

View File

@ -808,7 +808,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
if (aIsSelected)
return NS_OK;
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
// If the given accessible is row that was unselected then remove
// aria-selected from cell accessible.
@ -831,7 +831,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
nsAccessible *row = aAccessible->GetParent();
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW &&
if (row && row->Role() == nsIAccessibleRole::ROLE_ROW &&
nsAccUtils::IsARIASelected(row)) {
rv = SetARIASelected(row, PR_FALSE, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
@ -948,15 +948,17 @@ nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
NS_ENSURE_ARG_POINTER(aTable);
*aTable = nsnull;
nsCOMPtr<nsIAccessible> thisRow;
GetParent(getter_AddRefs(thisRow));
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* thisRow = GetParent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsCOMPtr<nsIAccessible> table;
thisRow->GetParent(getter_AddRefs(table));
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE &&
nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* table = thisRow->GetParent();
if (!table)
return NS_OK;
PRUint32 tableRole = table->Role();
if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
return NS_OK;
CallQueryInterface(table, aTable);
@ -972,20 +974,20 @@ nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
*aColumnIndex = 0;
nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
GetPreviousSibling(getter_AddRefs(prevCell));
while (prevCell) {
PRUint32 role = nsAccUtils::Role(prevCell);
PRInt32 indexInRow = GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInRow; idx++) {
nsAccessible* cell = row->GetChildAt(idx);
PRUint32 role = cell->Role();
if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
(*aColumnIndex)++;
prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
tmpAcc.swap(prevCell);
}
return NS_OK;
@ -1000,15 +1002,21 @@ nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row, prevRow;
GetParent(getter_AddRefs(row));
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
while (row) {
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
nsAccessible* table = row->GetParent();
if (!table)
return NS_OK;
*aRowIndex = 0;
PRInt32 indexInTable = row->GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInTable; idx++) {
row = table->GetChildAt(idx);
if (row->Role() == nsIAccessibleRole::ROLE_ROW)
(*aRowIndex)++;
row->GetPreviousSibling(getter_AddRefs(prevRow));
row.swap(prevRow);
}
return NS_OK;
@ -1088,7 +1096,7 @@ nsARIAGridCellAccessible::IsSelected(PRBool *aIsSelected)
return NS_ERROR_FAILURE;
nsAccessible *row = GetParent();
if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
if (!nsAccUtils::IsARIASelected(row) && !nsAccUtils::IsARIASelected(this))
@ -1112,8 +1120,8 @@ nsARIAGridCellAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
// Check aria-selected="true" on the row.
nsAccessible *row = GetParent();
if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* row = GetParent();
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsIContent *rowContent = row->GetContent();
@ -1141,8 +1149,8 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
// Expose "table-cell-index" attribute.
nsAccessible *thisRow = GetParent();
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* thisRow = GetParent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
PRInt32 colIdx = 0, colCount = 0;
@ -1152,16 +1160,20 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
if (child == this)
colIdx = colCount;
PRUint32 role = nsAccUtils::Role(child);
PRUint32 role = child->Role();
if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
colCount++;
}
nsAccessible *table = thisRow->GetParent();
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE &&
nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* table = thisRow->GetParent();
if (!table)
return NS_OK;
PRUint32 tableRole = table->Role();
if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
return NS_OK;
PRInt32 rowIdx = 0;
@ -1171,7 +1183,7 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
if (child == thisRow)
break;
if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_ROW)
if (child->Role() == nsIAccessibleRole::ROLE_ROW)
rowIdx++;
}

View File

@ -103,14 +103,14 @@ nsAccUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32
nsAccUtils::GetDefaultLevel(nsAccessible *aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM)
return 1;
if (role == nsIAccessibleRole::ROLE_ROW) {
nsAccessible *parent = aAccessible->GetParent();
if (Role(parent) == nsIAccessibleRole::ROLE_TREE_TABLE) {
if (parent && parent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE) {
// It is a row inside flatten treegrid. Group level is always 1 until it
// is overriden by aria-level attribute.
return 1;
@ -357,7 +357,7 @@ nsAccUtils::GetAncestorWithRole(nsAccessible *aDescendant, PRUint32 aRole)
nsAccessible *document = aDescendant->GetDocAccessible();
nsAccessible *parent = aDescendant;
while ((parent = parent->GetParent())) {
PRUint32 testRole = nsAccUtils::Role(parent);
PRUint32 testRole = parent->Role();
if (testRole == aRole)
return parent;
@ -578,23 +578,6 @@ nsAccUtils::GetRoleMapEntry(nsINode *aNode)
return &nsARIAMap::gLandmarkRoleMap;
}
PRUint32
nsAccUtils::RoleInternal(nsIAccessible *aAcc)
{
PRUint32 role = nsIAccessibleRole::ROLE_NOTHING;
if (aAcc) {
nsAccessible* accessible = nsnull;
CallQueryInterface(aAcc, &accessible);
if (accessible) {
accessible->GetRoleInternal(&role);
NS_RELEASE(accessible);
}
}
return role;
}
PRUint8
nsAccUtils::GetAttributeCharacteristics(nsIAtom* aAtom)
{

View File

@ -297,11 +297,6 @@ public:
return role;
}
/**
* Return the role from native markup of the given accessible.
*/
static PRUint32 RoleInternal(nsIAccessible *aAcc);
/**
* Return the state for the given accessible.
*/

View File

@ -943,7 +943,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
if (tableAccessible) {
if (!roleMapEntry) {
PRUint32 role = nsAccUtils::Role(tableAccessible);
PRUint32 role = tableAccessible->Role();
if (role != nsIAccessibleRole::ROLE_TABLE &&
role != nsIAccessibleRole::ROLE_TREE_TABLE) {
// No ARIA role and not in table: override role. For example,

View File

@ -1263,52 +1263,8 @@ nsAccessible::GetRole(PRUint32 *aRole)
if (IsDefunct())
return NS_ERROR_FAILURE;
if (mRoleMapEntry) {
*aRole = mRoleMapEntry->role;
// These unfortunate exceptions don't fit into the ARIA table
// This is where the nsIAccessible role depends on both the role and ARIA state
if (*aRole == nsIAccessibleRole::ROLE_PUSHBUTTON) {
if (nsAccUtils::HasDefinedARIAToken(mContent,
nsAccessibilityAtoms::aria_pressed)) {
// For simplicity, any existing pressed attribute except "", or "undefined"
// indicates a toggle.
*aRole = nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
} else if (mContent->AttrValueIs(kNameSpaceID_None,
nsAccessibilityAtoms::aria_haspopup,
nsAccessibilityAtoms::_true,
eCaseMatters)) {
// For button with aria-haspopup="true".
*aRole = nsIAccessibleRole::ROLE_BUTTONMENU;
}
}
else if (*aRole == nsIAccessibleRole::ROLE_LISTBOX) {
// A listbox inside of a combo box needs a special role because of ATK mapping to menu
nsCOMPtr<nsIAccessible> possibleCombo;
GetParent(getter_AddRefs(possibleCombo));
if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
else { // Check to see if combo owns the listbox instead
possibleCombo = nsRelUtils::
GetRelatedAccessible(this, nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
}
else if (*aRole == nsIAccessibleRole::ROLE_OPTION) {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
}
// We are done if the mapped role trumps native semantics
if (mRoleMapEntry->roleRule == kUseMapRole)
return NS_OK;
}
return GetRoleInternal(aRole);
*aRole = Role();
return NS_OK;
}
NS_IMETHODIMP
@ -1627,10 +1583,6 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
}
}
PRUint32 role;
rv = GetRole(&role);
NS_ENSURE_SUCCESS(rv, rv);
// For some reasons DOM node may have not a frame. We tract such accessibles
// as invisible.
nsIFrame *frame = GetFrame();
@ -1852,19 +1804,57 @@ nsAccessible::GetKeyBindings(PRUint8 aActionIndex,
return NS_OK;
}
/* unsigned long getRole (); */
nsresult
nsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsAccessible::Role()
{
*aRole = nsIAccessibleRole::ROLE_NOTHING;
// No ARIA role or it doesn't suppress role from native markup.
if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
return NativeRole();
if (IsDefunct())
return NS_ERROR_FAILURE;
// XXX: these unfortunate exceptions don't fit into the ARIA table. This is
// where the accessible role depends on both the role and ARIA state.
if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
if (nsAccUtils::HasDefinedARIAToken(mContent,
nsAccessibilityAtoms::aria_pressed)) {
// For simplicity, any existing pressed attribute except "" or "undefined"
// indicates a toggle.
return nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
}
if (nsCoreUtils::IsXLink(mContent))
*aRole = nsIAccessibleRole::ROLE_LINK;
if (mContent->AttrValueIs(kNameSpaceID_None,
nsAccessibilityAtoms::aria_haspopup,
nsAccessibilityAtoms::_true,
eCaseMatters)) {
// For button with aria-haspopup="true".
return nsIAccessibleRole::ROLE_BUTTONMENU;
}
return NS_OK;
} else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_LISTBOX) {
// A listbox inside of a combobox needs a special role because of ATK
// mapping to menu.
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX) {
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
nsCOMPtr<nsIAccessible> possibleCombo =
nsRelUtils::GetRelatedAccessible(this,
nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
} else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_OPTION) {
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
}
return mRoleMapEntry->role;
}
PRUint32
nsAccessible::NativeRole()
{
return nsCoreUtils::IsXLink(mContent) ?
nsIAccessibleRole::ROLE_LINK : nsIAccessibleRole::ROLE_NOTHING;
}
// readonly attribute PRUint8 numActions
@ -2785,9 +2775,7 @@ nsAccessible::GetParent()
// XXX: mParent can be null randomly because supposedly we get layout
// notification and invalidate parent-child relations, this accessible stays
// unattached. This should gone after bug 572951. Other reason is bug 574588
// since CacheChildren() implementation calls nsAccessible::GetRole() what
// can need to get a parent and we are here as result.
// unattached. This should gone after bug 572951.
NS_WARNING("Bad accessible tree!");
#ifdef DEBUG
@ -3364,7 +3352,7 @@ nsAccessible::GetLevelInternal()
{
PRInt32 level = nsAccUtils::GetDefaultLevel(this);
PRUint32 role = nsAccUtils::Role(this);
PRUint32 role = Role();
nsAccessible* parent = GetParent();
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
@ -3374,7 +3362,7 @@ nsAccessible::GetLevelInternal()
level = 1;
while (parent) {
PRUint32 parentRole = nsAccUtils::Role(parent);
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_OUTLINE)
break;
@ -3394,7 +3382,7 @@ nsAccessible::GetLevelInternal()
level = 0;
while (parent) {
PRUint32 parentRole = nsAccUtils::Role(parent);
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_LISTITEM)
++ level;

View File

@ -143,13 +143,16 @@ public:
*/
virtual nsresult GetNameInternal(nsAString& aName);
/**
* Return enumerated accessible role (see constants in nsIAccessibleRole).
*/
virtual PRUint32 Role();
/**
* Returns enumerated accessible role from native markup (see constants in
* nsIAccessibleRole). Doesn't take into account ARIA roles.
*
* @param aRole [out] accessible role.
*/
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
/**
* Return the state of accessible that doesn't take into account ARIA states.

View File

@ -139,13 +139,6 @@ nsApplicationAccessible::GetKeyboardShortcut(nsAString &aKeyboardShortcut)
return NS_OK;
}
NS_IMETHODIMP
nsApplicationAccessible::GetRole(PRUint32 *aRole)
{
NS_ENSURE_ARG_POINTER(aRole);
return GetRoleInternal(aRole);
}
NS_IMETHODIMP
nsApplicationAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
@ -379,11 +372,16 @@ nsApplicationAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
}
nsresult
nsApplicationAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsApplicationAccessible::Role()
{
*aRole = nsIAccessibleRole::ROLE_APP_ROOT;
return NS_OK;
return NativeRole();
}
PRUint32
nsApplicationAccessible::NativeRole()
{
return nsIAccessibleRole::ROLE_APP_ROOT;
}
nsresult

View File

@ -81,7 +81,6 @@ public:
NS_IMETHOD GetValue(nsAString &aValue);
NS_IMETHOD GetDescription(nsAString &aDescription);
NS_IMETHOD GetKeyboardShortcut(nsAString &aKeyboardShortcut);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState , PRUint32 *aExtraState );
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
@ -113,7 +112,8 @@ public:
// nsAccessible
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 Role();
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual void InvalidateChildren();

View File

@ -257,17 +257,17 @@ nsLinkableAccessible::CacheActionContent()
}
while ((walkUpContent = walkUpContent->GetParent())) {
isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
nsAccessible *walkUpAcc =
nsAccessible* walkUpAcc =
GetAccService()->GetAccessibleInWeakShell(walkUpContent, mWeakShell);
if (nsAccUtils::Role(walkUpAcc) == nsIAccessibleRole::ROLE_LINK &&
if (walkUpAcc && walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
nsAccUtils::State(walkUpAcc) & nsIAccessibleStates::STATE_LINKED) {
mIsLink = PR_TRUE;
mActionContent = walkUpContent;
return;
}
isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
if (isOnclick) {
mActionContent = walkUpContent;
mIsOnclick = PR_TRUE;
@ -302,9 +302,8 @@ nsEnumRoleAccessible::
NS_IMPL_ISUPPORTS_INHERITED0(nsEnumRoleAccessible, nsAccessible)
nsresult
nsEnumRoleAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsEnumRoleAccessible::NativeRole()
{
*aRole = mRole;
return NS_OK;
return mRole;
}

View File

@ -135,7 +135,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
PRUint32 mRole;

View File

@ -93,7 +93,7 @@ nsIAtom *nsDocAccessible::gLastFocusedFrameType = nsnull;
nsDocAccessible::
nsDocAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
nsIWeakReference *aShell) :
nsHyperTextAccessibleWrap(aRootContent, aShell), mWnd(nsnull),
nsHyperTextAccessibleWrap(aRootContent, aShell),
mDocument(aDocument), mScrollPositionChangedTicks(0), mIsLoaded(PR_FALSE)
{
// XXX aaronl should we use an algorithm for the initial cache size?
@ -103,17 +103,6 @@ nsDocAccessible::
if (!mDocument)
return;
// Initialize mWnd
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
if (widget) {
mWnd = widget->GetNativeData(NS_NATIVE_WINDOW);
}
}
// nsAccDocManager creates document accessible when scrollable frame is
// available already, it should be safe time to add scroll listener.
AddScrollListener();
@ -133,11 +122,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEventQueue");
cb.NoteXPCOMChild(tmp->mEventQueue.get());
PRUint32 i, length = tmp->mChildDocuments.Length();
for (i = 0; i < length; ++i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildDocuments[i]");
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mChildDocuments[i].get()));
}
CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mEventQueue)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mChildDocuments)
ClearCache(tmp->mAccessibleCache);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -203,11 +199,9 @@ nsDocAccessible::GetName(nsAString& aName)
}
// nsAccessible public method
nsresult
nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsDocAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsCoreUtils::GetDocShellTreeItemFor(mDocument);
if (docShellTreeItem) {
@ -217,28 +211,24 @@ nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
docShellTreeItem->GetItemType(&itemType);
if (sameTypeRoot == docShellTreeItem) {
// Root of content or chrome tree
if (itemType == nsIDocShellTreeItem::typeChrome) {
*aRole = nsIAccessibleRole::ROLE_CHROME_WINDOW;
}
else if (itemType == nsIDocShellTreeItem::typeContent) {
if (itemType == nsIDocShellTreeItem::typeChrome)
return nsIAccessibleRole::ROLE_CHROME_WINDOW;
if (itemType == nsIDocShellTreeItem::typeContent) {
#ifdef MOZ_XUL
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
if (xulDoc) {
*aRole = nsIAccessibleRole::ROLE_APPLICATION;
} else {
*aRole = nsIAccessibleRole::ROLE_DOCUMENT;
}
#else
*aRole = nsIAccessibleRole::ROLE_DOCUMENT;
if (xulDoc)
return nsIAccessibleRole::ROLE_APPLICATION;
#endif
return nsIAccessibleRole::ROLE_DOCUMENT;
}
}
else if (itemType == nsIDocShellTreeItem::typeContent) {
*aRole = nsIAccessibleRole::ROLE_DOCUMENT;
return nsIAccessibleRole::ROLE_DOCUMENT;
}
}
return NS_OK;
return nsIAccessibleRole::ROLE_PANE; // Fall back;
}
// nsAccessible public method
@ -472,7 +462,8 @@ NS_IMETHODIMP nsDocAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAStr
NS_IMETHODIMP nsDocAccessible::GetWindowHandle(void **aWindow)
{
*aWindow = mWnd;
NS_ENSURE_ARG_POINTER(aWindow);
*aWindow = GetNativeWindow();
return NS_OK;
}
@ -504,6 +495,44 @@ nsDocAccessible::GetDOMDocument(nsIDOMDocument **aDOMDocument)
return NS_OK;
}
NS_IMETHODIMP
nsDocAccessible::GetParentDocument(nsIAccessibleDocument** aDocument)
{
NS_ENSURE_ARG_POINTER(aDocument);
*aDocument = nsnull;
if (!IsDefunct())
NS_IF_ADDREF(*aDocument = ParentDocument());
return NS_OK;
}
NS_IMETHODIMP
nsDocAccessible::GetChildDocumentCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
if (!IsDefunct())
*aCount = ChildDocumentCount();
return NS_OK;
}
NS_IMETHODIMP
nsDocAccessible::GetChildDocumentAt(PRUint32 aIndex,
nsIAccessibleDocument** aDocument)
{
NS_ENSURE_ARG_POINTER(aDocument);
*aDocument = nsnull;
if (IsDefunct())
return NS_OK;
NS_IF_ADDREF(*aDocument = GetChildDocumentAt(aIndex));
return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
}
// nsIAccessibleHyperText method
NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
{
@ -537,6 +566,7 @@ NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
return NS_OK;
}
// nsDocAccessible public method
nsAccessible *
nsDocAccessible::GetCachedAccessible(void *aUniqueID)
{
@ -609,6 +639,10 @@ nsDocAccessible::Init()
AddEventListeners();
nsDocAccessible* parentDocument = mParent->GetDocAccessible();
if (parentDocument)
parentDocument->AppendChildDocument(this);
// Fire reorder event to notify new accessible document has been created and
// attached to the tree.
nsRefPtr<AccEvent> reorderEvent =
@ -635,8 +669,15 @@ nsDocAccessible::Shutdown()
RemoveEventListeners();
if (mParent)
if (mParent) {
nsDocAccessible* parentDocument = mParent->GetDocAccessible();
if (parentDocument)
parentDocument->RemoveChildDocument(this);
mParent->RemoveChild(this);
}
mChildDocuments.Clear();
mWeakShell = nsnull; // Avoid reentrancy
@ -1284,6 +1325,37 @@ nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent)
////////////////////////////////////////////////////////////////////////////////
// Public members
void*
nsDocAccessible::GetNativeWindow() const
{
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
if (widget)
return widget->GetNativeData(NS_NATIVE_WINDOW);
}
return nsnull;
}
nsAccessible*
nsDocAccessible::GetCachedAccessibleInSubtree(void* aUniqueID)
{
nsAccessible* child = GetCachedAccessible(aUniqueID);
if (child)
return child;
PRUint32 childDocCount = mChildDocuments.Length();
for (PRUint32 childDocIdx= 0; childDocIdx < childDocCount; childDocIdx++) {
nsDocAccessible* childDocument = mChildDocuments.ElementAt(childDocIdx);
child = childDocument->GetCachedAccessibleInSubtree(aUniqueID);
if (child)
return child;
}
return nsnull;
}
////////////////////////////////////////////////////////////////////////////////
// Protected members
@ -1291,7 +1363,7 @@ nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent)
void
nsDocAccessible::FireValueChangeForTextFields(nsAccessible *aAccessible)
{
if (nsAccUtils::Role(aAccessible) != nsIAccessibleRole::ROLE_ENTRY)
if (aAccessible->Role() != nsIAccessibleRole::ROLE_ENTRY)
return;
// Dependent value change event for text changes in textfields
@ -1378,7 +1450,7 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
PRInt32 offset = 0;
if (aChangeChild) {
// Don't fire event for the first html:br in an editor.
if (nsAccUtils::Role(aChangeChild) == nsIAccessibleRole::ROLE_WHITESPACE) {
if (aChangeChild->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {
nsCOMPtr<nsIEditor> editor;
textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
if (editor) {
@ -1630,8 +1702,7 @@ nsDocAccessible::RefreshNodes(nsINode *aStartNode)
nsAccessible *accessible = GetCachedAccessible(aStartNode);
if (accessible) {
// Fire menupopup end if a menu goes away
PRUint32 role = nsAccUtils::Role(accessible);
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
if (accessible->Role() == nsIAccessibleRole::ROLE_MENUPOPUP) {
nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(aStartNode));
if (!popup) {
// Popup elements already fire these via DOMMenuInactive

View File

@ -110,7 +110,7 @@ public:
virtual nsINode* GetNode() const { return mDocument; }
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
@ -141,6 +141,29 @@ public:
*/
void MarkAsLoaded() { mIsLoaded = PR_TRUE; }
/**
* Return a native window handler or pointer depending on platform.
*/
virtual void* GetNativeWindow() const;
/**
* Return the parent document.
*/
nsDocAccessible* ParentDocument() const
{ return mParent ? mParent->GetDocAccessible() : nsnull; }
/**
* Return the child document count.
*/
PRUint32 ChildDocumentCount() const
{ return mChildDocuments.Length(); }
/**
* Return the child document at the given index.
*/
nsDocAccessible* GetChildDocumentAt(PRUint32 aIndex) const
{ return mChildDocuments.SafeElementAt(aIndex, nsnull); }
/**
* Non-virtual method to fire a delayed event after a 0 length timeout.
*
@ -188,6 +211,12 @@ public:
*/
nsAccessible* GetCachedAccessible(void *aUniqueID);
/**
* Return the cached accessible by the given unique ID looking through
* this and nested documents.
*/
nsAccessible* GetCachedAccessibleInSubtree(void* aUniqueID);
/**
* Cache the accessible.
*
@ -217,6 +246,24 @@ protected:
void AddScrollListener();
void RemoveScrollListener();
/**
* Append the given document accessible to this document's child document
* accessibles.
*/
bool AppendChildDocument(nsDocAccessible* aChildDocument)
{
return mChildDocuments.AppendElement(aChildDocument);
}
/**
* Remove the given document accessible from this document's child document
* accessibles.
*/
void RemoveChildDocument(nsDocAccessible* aChildDocument)
{
mChildDocuments.RemoveElement(aChildDocument);
}
/**
* Invalidate parent-child relations for any cached accessible in the DOM
* subtree. Accessible objects aren't destroyed.
@ -321,7 +368,6 @@ protected:
*/
nsAccessibleHashtable mAccessibleCache;
void *mWnd;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsITimer> mScrollWatchTimer;
PRUint16 mScrollPositionChangedTicks; // Used for tracking scroll events
@ -337,6 +383,8 @@ protected:
static PRUint32 gLastFocusedAccessiblesState;
static nsIAtom *gLastFocusedFrameType;
nsTArray<nsRefPtr<nsDocAccessible> > mChildDocuments;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsDocAccessible,

View File

@ -532,8 +532,7 @@ nsAccEventQueue::CreateTextChangeEventFor(AccHideEvent* aEvent)
return;
// Don't fire event for the first html:br in an editor.
if (nsAccUtils::Role(aEvent->mAccessible) ==
nsIAccessibleRole::ROLE_WHITESPACE) {
if (aEvent->mAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {
nsCOMPtr<nsIEditor> editor;
textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
if (editor) {

View File

@ -82,10 +82,9 @@ nsRadioButtonAccessible::DoAction(PRUint8 aIndex)
return NS_OK;
}
nsresult
nsRadioButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsRadioButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_RADIOBUTTON;
}

View File

@ -58,7 +58,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
enum { eAction_Click = 0 };
};

View File

@ -60,11 +60,10 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible,
////////////////////////////////////////////////////////////////////////////////
// nsAccessible public (DON'T add methods here)
nsresult
nsOuterDocAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsOuterDocAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME;
return NS_OK;
return nsIAccessibleRole::ROLE_INTERNAL_FRAME;
}
nsresult

View File

@ -67,7 +67,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,

View File

@ -142,14 +142,9 @@ nsRootAccessible::GetName(nsAString& aName)
return document->GetTitle(aName);
}
/* readonly attribute unsigned long accRole; */
nsresult
nsRootAccessible::GetRoleInternal(PRUint32 *aRole)
{
if (!mDocument) {
return NS_ERROR_FAILURE;
}
PRUint32
nsRootAccessible::NativeRole()
{
// If it's a <dialog> or <wizard>, use nsIAccessibleRole::ROLE_DIALOG instead
dom::Element *root = mDocument->GetRootElement();
if (root) {
@ -158,13 +153,12 @@ nsRootAccessible::GetRoleInternal(PRUint32 *aRole)
nsAutoString name;
rootElement->GetLocalName(name);
if (name.EqualsLiteral("dialog") || name.EqualsLiteral("wizard")) {
*aRole = nsIAccessibleRole::ROLE_DIALOG; // Always at the root
return NS_OK;
return nsIAccessibleRole::ROLE_DIALOG; // Always at the root
}
}
}
return nsDocAccessibleWrap::GetRoleInternal(aRole);
return nsDocAccessibleWrap::NativeRole();
}
// nsRootAccessible protected member
@ -391,12 +385,11 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
}
gLastFocusedAccessiblesState = nsAccUtils::State(finalFocusAccessible);
PRUint32 role = nsAccUtils::Role(finalFocusAccessible);
PRUint32 role = finalFocusAccessible->Role();
if (role == nsIAccessibleRole::ROLE_MENUITEM) {
if (!mCurrentARIAMenubar) { // Entering menus
// The natural role is the role that this type of element normally has
PRUint32 naturalRole = nsAccUtils::RoleInternal(finalFocusAccessible);
if (role != naturalRole) { // Must be a DHTML menuitem
if (role != finalFocusAccessible->NativeRole()) { // Must be a DHTML menuitem
nsAccessible *menuBarAccessible =
nsAccUtils::GetAncestorWithRole(finalFocusAccessible,
nsIAccessibleRole::ROLE_MENUBAR);
@ -680,7 +673,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
HandlePopupShownEvent(accessible);
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (nsAccUtils::Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
if (accessible->Role() == nsIAccessibleRole::ROLE_MENUPOPUP) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
}
@ -714,7 +707,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
if (nsAccUtils::State(containerAccessible) & nsIAccessibleStates::STATE_COLLAPSED) {
nsAccessible *containerParent = containerAccessible->GetParent();
NS_ENSURE_TRUE(containerParent, NS_ERROR_FAILURE);
if (nsAccUtils::Role(containerParent) != nsIAccessibleRole::ROLE_COMBOBOX) {
if (containerParent->Role() != nsIAccessibleRole::ROLE_COMBOBOX) {
return NS_OK;
}
}
@ -863,7 +856,7 @@ nsRootAccessible::GetRelationByType(PRUint32 aRelationType,
nsresult
nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 role = aAccessible->Role();
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
// Don't fire menupopup events for combobox and autocomplete lists.
@ -883,12 +876,14 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
// Fire expanded state change event for comboboxes and autocompeletes.
nsAccessible *comboboxAcc = aAccessible->GetParent();
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
nsAccessible* combobox = aAccessible->GetParent();
NS_ENSURE_STATE(combobox);
PRUint32 comboboxRole = combobox->Role();
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(comboboxAcc,
new AccStateChangeEvent(combobox,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_TRUE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
@ -921,16 +916,17 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode *aNode,
if (!aAccessible)
return NS_OK;
PRUint32 role = nsAccUtils::Role(aAccessible);
if (role != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
if (aAccessible->Role() != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return NS_OK;
nsAccessible *comboboxAcc = aAccessible->GetParent();
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
nsAccessible* combobox = aAccessible->GetParent();
NS_ENSURE_STATE(combobox);
PRUint32 comboboxRole = combobox->Role();
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(comboboxAcc,
new AccStateChangeEvent(combobox,
nsIAccessibleStates::STATE_EXPANDED,
PR_FALSE, PR_FALSE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);

View File

@ -84,7 +84,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// nsRootAccessible

View File

@ -50,11 +50,10 @@ nsTextAccessible::
{
}
nsresult
nsTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsTextAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_TEXT_LEAF;
return NS_OK;
return nsIAccessibleRole::ROLE_TEXT_LEAF;
}
nsresult

View File

@ -50,7 +50,7 @@ public:
nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
PRUint32 aLength);

View File

@ -64,9 +64,7 @@ nsTextEquivUtils::GetNameFromSubtree(nsAccessible *aAccessible,
gInitiatorAcc = aAccessible;
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule == eFromSubtree) {
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsContent()) {
@ -269,9 +267,7 @@ nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
// into subtree if accessible allows "text equivalent from subtree rule" or
// it's not root and not control.
if (isEmptyTextEquiv) {
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule & eFromSubtreeIfRec) {
rv = AppendFromAccessibleChildren(aAccessible, aString);
NS_ENSURE_SUCCESS(rv, rv);
@ -294,9 +290,7 @@ nsresult
nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
nsAString *aString)
{
PRUint32 role = nsAccUtils::Role(aAccessible);
PRUint32 nameRule = gRoleToNameRulesMap[role];
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
if (nameRule != eFromValue)
return NS_OK_NO_NAME_CLAUSE_HANDLED;

View File

@ -69,11 +69,10 @@ nsHTMLCheckboxAccessible::
{
}
nsresult
nsHTMLCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLCheckboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetNumActions(PRUint8 *_retval)
@ -282,11 +281,10 @@ nsHTMLButtonAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsHTMLButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -359,11 +357,10 @@ nsHTML4ButtonAccessible::DoAction(PRUint8 aIndex)
return NS_OK;
}
nsresult
nsHTML4ButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTML4ButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -396,16 +393,14 @@ nsHTMLTextFieldAccessible::
NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
nsresult
nsHTMLTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLTextFieldAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ENTRY;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::password, eIgnoreCase)) {
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
}
return NS_OK;
return nsIAccessibleRole::ROLE_ENTRY;
}
nsresult
@ -465,7 +460,8 @@ nsHTMLTextFieldAccessible::GetStateInternal(PRUint32 *aState,
*aState |= nsIAccessibleStates::STATE_PROTECTED;
}
else {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
nsAccessible* parent = GetParent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
}
@ -588,11 +584,10 @@ nsHTMLGroupboxAccessible::
{
}
nsresult
nsHTMLGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLGroupboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
nsIContent* nsHTMLGroupboxAccessible::GetLegend()
@ -668,7 +663,7 @@ nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
// Look for groupbox parent
nsAccessible* groupbox = GetParent();
if (nsAccUtils::Role(groupbox) == nsIAccessibleRole::ROLE_GROUPING) {
if (groupbox && groupbox->Role() == nsIAccessibleRole::ROLE_GROUPING) {
// XXX: if group box exposes more than one relation of the given type
// then we fail.
nsCOMPtr<nsIAccessible> testLabelAccessible =
@ -687,9 +682,8 @@ nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
return NS_OK;
}
nsresult
nsHTMLLegendAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLegendAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}

View File

@ -59,7 +59,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -99,7 +99,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -121,7 +121,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -150,7 +150,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -169,7 +169,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
nsIContent* GetLegend();
@ -189,7 +189,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

View File

@ -120,11 +120,10 @@ nsHTMLImageAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsHTMLImageAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLImageAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GRAPHIC;
return NS_OK;
return nsIAccessibleRole::ROLE_GRAPHIC;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -66,7 +66,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);

View File

@ -68,11 +68,10 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, nsHTMLImageAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsHTMLImageMapAccessible: nsAccessible public
nsresult
nsHTMLImageMapAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLImageMapAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_IMAGE_MAP;
return NS_OK;
return nsIAccessibleRole::ROLE_IMAGE_MAP;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -58,7 +58,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
// HyperLinkAccessible
virtual PRUint32 AnchorCount();

View File

@ -60,11 +60,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible
nsresult
nsHTMLLinkAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLinkAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LINK;
return NS_OK;
return nsIAccessibleRole::ROLE_LINK;
}
nsresult

View File

@ -57,7 +57,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// HyperLinkAccessible

View File

@ -101,15 +101,13 @@ nsHTMLSelectListAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsHTMLSelectListAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLSelectListAccessible::NativeRole()
{
if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
else
*aRole = nsIAccessibleRole::ROLE_LISTBOX;
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LISTBOX;
}
////////////////////////////////////////////////////////////////////////////////
@ -198,15 +196,13 @@ nsHTMLSelectOptionAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsHTMLSelectOptionAccessible: nsAccessible public
nsresult
nsHTMLSelectOptionAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLSelectOptionAccessible::NativeRole()
{
if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
else
*aRole = nsIAccessibleRole::ROLE_OPTION;
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return NS_OK;
return nsIAccessibleRole::ROLE_OPTION;
}
nsresult
@ -352,10 +348,8 @@ nsHTMLSelectOptionAccessible::GetLevelInternal()
PRInt32 level =
parentContent->NodeInfo()->Equals(nsAccessibilityAtoms::optgroup) ? 2 : 1;
if (level == 1 &&
nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_HEADING) {
if (level == 1 && Role() != nsIAccessibleRole::ROLE_HEADING)
level = 0; // In a single level list, the level is irrelevant
}
return level;
}
@ -621,11 +615,10 @@ nsHTMLSelectOptGroupAccessible::
{
}
nsresult
nsHTMLSelectOptGroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLSelectOptGroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_HEADING;
return NS_OK;
return nsIAccessibleRole::ROLE_HEADING;
}
nsresult
@ -681,11 +674,10 @@ nsHTMLComboboxAccessible::
{
}
nsresult
nsHTMLComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLComboboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
return NS_OK;
return nsIAccessibleRole::ROLE_COMBOBOX;
}
void

View File

@ -73,7 +73,7 @@ public:
virtual ~nsHTMLSelectListAccessible() {}
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// SelectAccessible
@ -113,7 +113,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRInt32 GetLevelInternal();
@ -158,7 +158,7 @@ public:
NS_IMETHOD GetNumActions(PRUint8 *_retval);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
@ -194,7 +194,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

View File

@ -86,11 +86,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible,
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableCellAccessible: nsAccessible implementation
nsresult
nsHTMLTableCellAccessible::GetRoleInternal(PRUint32 *aResult)
PRUint32
nsHTMLTableCellAccessible::NativeRole()
{
*aResult = nsIAccessibleRole::ROLE_CELL;
return NS_OK;
return nsIAccessibleRole::ROLE_CELL;
}
nsresult
@ -268,20 +267,15 @@ nsHTMLTableCellAccessible::IsSelected(PRBool *aIsSelected)
already_AddRefed<nsIAccessibleTable>
nsHTMLTableCellAccessible::GetTableAccessible()
{
nsCOMPtr<nsIAccessible> childAcc(this), parentAcc;
childAcc->GetParent(getter_AddRefs(parentAcc));
while (parentAcc) {
PRUint32 role = nsAccUtils::Role(parentAcc);
nsAccessible* parent = this;
while ((parent = parent->GetParent())) {
PRUint32 role = parent->Role();
if (role == nsIAccessibleRole::ROLE_TABLE ||
role == nsIAccessibleRole::ROLE_TREE_TABLE) {
nsIAccessibleTable* tableAcc = nsnull;
CallQueryInterface(parentAcc, &tableAcc);
CallQueryInterface(parent, &tableAcc);
return tableAcc;
}
parentAcc.swap(childAcc);
childAcc->GetParent(getter_AddRefs(parentAcc));
}
return nsnull;
@ -335,9 +329,9 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
if (headerCell &&
(aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells &&
nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_ROWHEADER ||
headerCell->Role() == nsIAccessibleRole::ROLE_ROWHEADER ||
aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells &&
nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_COLUMNHEADER))
headerCell->Role() == nsIAccessibleRole::ROLE_COLUMNHEADER))
headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell),
PR_FALSE);
}
@ -372,8 +366,8 @@ nsHTMLTableHeaderCellAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableHeaderAccessible: nsAccessible implementation
nsresult
nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLTableHeaderCellAccessible::NativeRole()
{
// Check value of @scope attribute.
static nsIContent::AttrValuesArray scopeValues[] =
@ -384,17 +378,18 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
switch (valueIdx) {
case 0:
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
case 1:
*aRole = nsIAccessibleRole::ROLE_ROWHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_ROWHEADER;
}
// Assume it's columnheader if there are headers in siblings, oterwise
// rowheader.
nsIContent *parent = mContent->GetParent();
NS_ENSURE_STATE(parent);
if (!parent) {
NS_ERROR("Deattached content on alive accessible?");
return nsIAccessibleRole::ROLE_NOTHING;
}
PRInt32 indexInParent = parent->IndexOf(mContent);
@ -402,11 +397,8 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
nsIContent* sibling = parent->GetChildAt(idx);
if (sibling && sibling->IsElement()) {
if (nsCoreUtils::IsHTMLTableHeader(sibling))
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
else
*aRole = nsIAccessibleRole::ROLE_ROWHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
return nsIAccessibleRole::ROLE_ROWHEADER;
}
}
@ -415,19 +407,14 @@ nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
nsIContent* sibling = parent->GetChildAt(idx);
if (sibling && sibling->IsElement()) {
if (nsCoreUtils::IsHTMLTableHeader(sibling))
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
else
*aRole = nsIAccessibleRole::ROLE_ROWHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
return nsIAccessibleRole::ROLE_ROWHEADER;
}
}
// No elements in siblings what means the table has one column only. Therefore
// it should be column header.
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
}
////////////////////////////////////////////////////////////////////////////////
@ -461,7 +448,7 @@ nsHTMLTableAccessible::CacheChildren()
nsRefPtr<nsAccessible> child;
while ((child = walker.GetNextChild())) {
if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_CAPTION) {
if (child->Role() == nsIAccessibleRole::ROLE_CAPTION) {
InsertChildAt(0, child);
while ((child = walker.GetNextChild()) && AppendChild(child));
break;
@ -470,11 +457,10 @@ nsHTMLTableAccessible::CacheChildren()
}
}
nsresult
nsHTMLTableAccessible::GetRoleInternal(PRUint32 *aResult)
PRUint32
nsHTMLTableAccessible::NativeRole()
{
*aResult = nsIAccessibleRole::ROLE_TABLE;
return NS_OK;
return nsIAccessibleRole::ROLE_TABLE;
}
nsresult
@ -541,9 +527,8 @@ nsHTMLTableAccessible::GetRelationByType(PRUint32 aRelationType,
NS_IMETHODIMP
nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
{
nsCOMPtr<nsIAccessible> firstChild;
GetFirstChild(getter_AddRefs(firstChild));
if (nsAccUtils::Role(firstChild) == nsIAccessibleRole::ROLE_CAPTION)
nsAccessible* firstChild = GetChildAt(0);
if (firstChild && firstChild->Role() == nsIAccessibleRole::ROLE_CAPTION)
NS_ADDREF(*aCaption = firstChild);
return NS_OK;
@ -1398,8 +1383,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
// Check to see if an ARIA role overrides the role from native markup,
// but for which we still expose table semantics (treegrid, for example).
PRBool hasNonTableRole =
(nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_TABLE);
PRBool hasNonTableRole = (Role() != nsIAccessibleRole::ROLE_TABLE);
if (hasNonTableRole) {
RETURN_LAYOUT_ANSWER(PR_FALSE, "Has role attribute");
}
@ -1560,9 +1544,8 @@ nsHTMLCaptionAccessible::GetRelationByType(PRUint32 aRelationType,
return NS_OK;
}
nsresult
nsHTMLCaptionAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLCaptionAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CAPTION;
return NS_OK;
return nsIAccessibleRole::ROLE_CAPTION;
}

View File

@ -61,7 +61,7 @@ public:
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
@ -99,7 +99,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -137,7 +137,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
@ -215,7 +215,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

View File

@ -68,18 +68,17 @@ nsHTMLTextAccessible::GetName(nsAString& aName)
return AppendTextTo(aName, 0, PR_UINT32_MAX);
}
nsresult
nsHTMLTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLTextAccessible::NativeRole()
{
nsIFrame *frame = GetFrame();
// Don't return on null frame -- we still return a role
// after accessible is shutdown/DEFUNCT
if (frame && frame->IsGeneratedContentFrame()) {
*aRole = nsIAccessibleRole::ROLE_STATICTEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_STATICTEXT;
}
return nsTextAccessible::GetRoleInternal(aRole);
return nsTextAccessible::NativeRole();
}
nsresult
@ -103,9 +102,7 @@ nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
nsresult
nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
PRUint32 role;
GetRoleInternal(&role);
if (role == nsIAccessibleRole::ROLE_STATICTEXT) {
if (NativeRole() == nsIAccessibleRole::ROLE_STATICTEXT) {
nsAutoString oldValueUnused;
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"),
NS_LITERAL_STRING("true"), oldValueUnused);
@ -125,11 +122,10 @@ nsHTMLHRAccessible::
{
}
nsresult
nsHTMLHRAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLHRAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SEPARATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_SEPARATOR;
}
@ -143,11 +139,10 @@ nsHTMLBRAccessible::
{
}
nsresult
nsHTMLBRAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLBRAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_WHITESPACE;
return NS_OK;
return nsIAccessibleRole::ROLE_WHITESPACE;
}
nsresult
@ -194,11 +189,10 @@ nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
return nsTextEquivUtils::GetNameFromSubtree(this, aName);
}
nsresult
nsHTMLLabelAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLabelAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}
////////////////////////////////////////////////////////////////////////////////
@ -232,11 +226,10 @@ nsHTMLLIAccessible::Shutdown()
mBulletAccessible = nsnull;
}
nsresult
nsHTMLLIAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLLIAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LISTITEM;
return NS_OK;
return nsIAccessibleRole::ROLE_LISTITEM;
}
nsresult
@ -315,11 +308,10 @@ nsHTMLListBulletAccessible::GetName(nsAString &aName)
return NS_OK;
}
nsresult
nsHTMLListBulletAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLListBulletAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_STATICTEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_STATICTEXT;
}
nsresult
@ -357,11 +349,10 @@ nsHTMLListAccessible::
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLListAccessible, nsHyperTextAccessible)
nsresult
nsHTMLListAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLListAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LIST;
}
nsresult

View File

@ -60,7 +60,7 @@ public:
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -73,7 +73,7 @@ public:
nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -86,7 +86,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -102,7 +102,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -124,7 +124,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
PRUint32 aLength);
@ -151,7 +151,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -174,7 +174,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

View File

@ -126,42 +126,35 @@ nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePt
return nsAccessible::QueryInterface(aIID, aInstancePtr);
}
nsresult
nsHyperTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHyperTextAccessible::NativeRole()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsIAtom *tag = mContent->Tag();
if (tag == nsAccessibilityAtoms::form) {
*aRole = nsIAccessibleRole::ROLE_FORM;
if (tag == nsAccessibilityAtoms::form)
return nsIAccessibleRole::ROLE_FORM;
if (tag == nsAccessibilityAtoms::div ||
tag == nsAccessibilityAtoms::blockquote)
return nsIAccessibleRole::ROLE_SECTION;
if (tag == nsAccessibilityAtoms::h1 ||
tag == nsAccessibilityAtoms::h2 ||
tag == nsAccessibilityAtoms::h3 ||
tag == nsAccessibilityAtoms::h4 ||
tag == nsAccessibilityAtoms::h5 ||
tag == nsAccessibilityAtoms::h6)
return nsIAccessibleRole::ROLE_HEADING;
nsIFrame *frame = GetFrame();
if (frame && frame->GetType() == nsAccessibilityAtoms::blockFrame &&
frame->GetContent()->Tag() != nsAccessibilityAtoms::input) {
// An html:input @type="file" is the only input that is exposed as a
// blockframe. It must be exposed as ROLE_TEXT_CONTAINER for JAWS.
return nsIAccessibleRole::ROLE_PARAGRAPH;
}
else if (tag == nsAccessibilityAtoms::div ||
tag == nsAccessibilityAtoms::blockquote) {
*aRole = nsIAccessibleRole::ROLE_SECTION;
}
else if (tag == nsAccessibilityAtoms::h1 ||
tag == nsAccessibilityAtoms::h2 ||
tag == nsAccessibilityAtoms::h3 ||
tag == nsAccessibilityAtoms::h4 ||
tag == nsAccessibilityAtoms::h5 ||
tag == nsAccessibilityAtoms::h6) {
*aRole = nsIAccessibleRole::ROLE_HEADING;
}
else {
nsIFrame *frame = GetFrame();
if (frame && frame->GetType() == nsAccessibilityAtoms::blockFrame &&
frame->GetContent()->Tag() != nsAccessibilityAtoms::input) {
// An html:input @type="file" is the only input that is exposed as a
// blockframe. It must be exposed as ROLE_TEXT_CONTAINER for JAWS.
*aRole = nsIAccessibleRole::ROLE_PARAGRAPH;
}
else {
*aRole = nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
}
}
return NS_OK;
return nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
}
nsresult
@ -286,8 +279,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
PRInt32 startOffset = aStartOffset;
PRInt32 endOffset = aEndOffset;
// XXX this prevents text interface usage on <input type="password">
PRBool isPassword =
(nsAccUtils::Role(this) == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
PRBool isPassword = (Role() == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
// Clear out parameters and set up loop
if (aText) {
@ -811,7 +803,7 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
nsAccessible *firstChild = mChildren.SafeElementAt(0, nsnull);
// For line selection with needsStart, set start of line exactly to line break
if (pos.mContentOffset == 0 && firstChild &&
nsAccUtils::Role(firstChild) == nsIAccessibleRole::ROLE_STATICTEXT &&
firstChild->Role() == nsIAccessibleRole::ROLE_STATICTEXT &&
static_cast<PRInt32>(nsAccUtils::TextLength(firstChild)) == hyperTextOffset) {
// XXX Bullet hack -- we should remove this once list bullets use anonymous content
hyperTextOffset = 0;
@ -823,7 +815,7 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
else if (aAmount == eSelectEndLine && finalAccessible) {
// If not at very end of hypertext, we may need change the end of line offset by 1,
// to make sure we are in the right place relative to the line ending
if (nsAccUtils::Role(finalAccessible) == nsIAccessibleRole::ROLE_WHITESPACE) { // Landed on <br> hard line break
if (finalAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) { // Landed on <br> hard line break
// if aNeedsStart, set end of line exactly 1 character past line break
// XXX It would be cleaner if we did not have to have the hard line break check,
// and just got the correct results from PeekOffset() for the <br> case -- the returned offset should
@ -990,7 +982,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
nsRefPtr<nsAccessible> endAcc;
nsIFrame *endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
nsnull, getter_AddRefs(endAcc));
if (nsAccUtils::Role(endAcc) == nsIAccessibleRole::ROLE_STATICTEXT) {
if (endAcc && endAcc->Role() == nsIAccessibleRole::ROLE_STATICTEXT) {
// Static text like list bullets will ruin our forward calculation,
// since the caret cannot be in the static text. Start just after the static text.
startOffset = endOffset = finalStartOffset +

View File

@ -86,7 +86,7 @@ public:
// nsAccessible
virtual PRInt32 GetLevelInternal();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual void InvalidateChildren();

View File

@ -135,7 +135,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
if ((self = [super init])) {
mGeckoAccessible = geckoAccessible;
mIsExpired = NO;
geckoAccessible->GetRole(&mRole);
mRole = geckoAccessible->Role();
// Check for OS X "role skew"; the role constants in nsIAccessible.idl need to match the ones
// in nsRoleMap.h.
@ -594,9 +594,13 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
nsAccessibleWrap *accWrap = static_cast<nsAccessibleWrap*>(mGeckoAccessible);
// Get a pointer to the native window (NSWindow) we reside in.
NSWindow *nativeWindow = nil;
accWrap->GetNativeWindow ((void**)&nativeWindow);
nsDocAccessible* docAcc = accWrap->GetDocAccessible();
if (docAcc)
nativeWindow = static_cast<NSWindow*>(docAcc->GetNativeWindow());
NSAssert1(nativeWindow, @"Could not get native window for %@", self);
return nativeWindow;

View File

@ -71,10 +71,7 @@ class nsAccessibleWrap : public nsAccessible
// should be instantied with. used on runtime to determine the
// right type for this accessible's associated native object.
virtual objc_class* GetNativeType ();
// returns a pointer to the native window for this accessible tree.
void GetNativeWindow (void **aOutNativeWindow);
virtual void Shutdown ();
virtual void InvalidateChildren();

View File

@ -86,17 +86,6 @@ nsAccessibleWrap::GetNativeInterface (void **aOutInterface)
return NS_ERROR_FAILURE;
}
// get the native NSWindow we reside in.
void
nsAccessibleWrap::GetNativeWindow (void **aOutNativeWindow)
{
*aOutNativeWindow = nsnull;
nsDocAccessible *docAcc = GetDocAccessible();
if (docAcc)
docAcc->GetWindowHandle (aOutNativeWindow);
}
// overridden in subclasses to create the right kind of object. by default we create a generic
// 'mozAccessible' node.
objc_class*
@ -104,7 +93,7 @@ nsAccessibleWrap::GetNativeType ()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
PRUint32 role = nsAccUtils::Role(this);
PRUint32 role = Role();
switch (role) {
case nsIAccessibleRole::ROLE_PUSHBUTTON:
case nsIAccessibleRole::ROLE_SPLITBUTTON:

View File

@ -46,6 +46,7 @@
#include "nsApplicationAccessibleWrap.h"
#include "nsCoreUtils.h"
#include "nsRootAccessible.h"
#include "nsWinUtils.h"
#include "nsAttrName.h"
#include "nsIDocument.h"
@ -63,6 +64,7 @@
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
HINSTANCE nsAccessNodeWrap::gmUserLib = nsnull;
LPFNACCESSIBLEOBJECTFROMWINDOW nsAccessNodeWrap::gmAccessibleObjectFromWindow = nsnull;
LPFNLRESULTFROMOBJECT nsAccessNodeWrap::gmLresultFromObject = NULL;
LPFNNOTIFYWINEVENT nsAccessNodeWrap::gmNotifyWinEvent = nsnull;
LPFNGETGUITHREADINFO nsAccessNodeWrap::gmGetGUIThreadInfo = nsnull;
@ -569,7 +571,14 @@ void nsAccessNodeWrap::InitAccessibility()
}
DoATSpecificProcessing();
// Register window class that'll be used for document accessibles associated
// with tabs.
if (nsWinUtils::IsWindowEmulationEnabled()) {
nsWinUtils::RegisterNativeWindow(kClassNameTabContent);
sHWNDCache.Init(4);
}
nsAccessNode::InitXPAccessibility();
}
@ -578,6 +587,11 @@ void nsAccessNodeWrap::ShutdownAccessibility()
NS_IF_RELEASE(gTextEvent);
::DestroyCaret();
// Unregister window call that's used for document accessibles associated
// with tabs.
if (nsWinUtils::IsWindowEmulationEnabled())
::UnregisterClassW(kClassNameTabContent, GetModuleHandle(NULL));
nsAccessNode::ShutdownXPAccessibility();
}
@ -624,7 +638,7 @@ GetHRESULT(nsresult aResult)
PRBool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
{
HMODULE jhookhandle = ::GetModuleHandleW(L"jhook");
HMODULE jhookhandle = ::GetModuleHandleW(kJAWSModuleHandle);
if (!jhookhandle)
return PR_FALSE; // No JAWS, or some other screen reader, use IA2
@ -655,10 +669,10 @@ PRBool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
void nsAccessNodeWrap::TurnOffNewTabSwitchingForJawsAndWE()
{
HMODULE srHandle = ::GetModuleHandleW(L"jhook");
HMODULE srHandle = ::GetModuleHandleW(kJAWSModuleHandle);
if (!srHandle) {
// No JAWS, try Window-Eyes
srHandle = ::GetModuleHandleW(L"gwm32inc");
srHandle = ::GetModuleHandleW(kWEModuleHandle);
if (!srHandle) {
// no screen reader we're interested in. Bail out.
return;
@ -694,3 +708,49 @@ void nsAccessNodeWrap::DoATSpecificProcessing()
TurnOffNewTabSwitchingForJawsAndWE();
}
nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible> nsAccessNodeWrap::sHWNDCache;
LRESULT CALLBACK
nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_GETOBJECT:
{
if (lParam == OBJID_CLIENT) {
nsDocAccessible* document = sHWNDCache.GetWeak(static_cast<void*>(hWnd));
if (document) {
IAccessible* msaaAccessible = NULL;
document->GetNativeInterface((void**)&msaaAccessible); // does an addref
if (msaaAccessible) {
LRESULT result = LresultFromObject(IID_IAccessible, wParam,
msaaAccessible); // does an addref
msaaAccessible->Release(); // release extra addref
return result;
}
}
}
return 0;
}
}
return ::DefWindowProcW(hWnd, msg, wParam, lParam);
}
STDMETHODIMP_(LRESULT)
nsAccessNodeWrap::LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc)
{
// open the dll dynamically
if (!gmAccLib)
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
if (gmAccLib) {
if (!gmLresultFromObject)
gmLresultFromObject = (LPFNLRESULTFROMOBJECT)GetProcAddress(gmAccLib,"LresultFromObject");
if (gmLresultFromObject)
return gmLresultFromObject(riid, wParam, pAcc);
}
return 0;
}

View File

@ -68,6 +68,8 @@
#include "nsICrashReporter.h"
#endif
#include "nsRefPtrHashtable.h"
typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
@ -154,6 +156,7 @@ public: // construction, destruction
static HINSTANCE gmAccLib;
static HINSTANCE gmUserLib;
static LPFNACCESSIBLEOBJECTFROMWINDOW gmAccessibleObjectFromWindow;
static LPFNLRESULTFROMOBJECT gmLresultFromObject;
static LPFNNOTIFYWINEVENT gmNotifyWinEvent;
static LPFNGETGUITHREADINFO gmGetGUIThreadInfo;
@ -165,6 +168,13 @@ public: // construction, destruction
static void DoATSpecificProcessing();
static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg,
WPARAM WParam, LPARAM lParam);
static nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible> sHWNDCache;
protected:
/**

View File

@ -42,6 +42,7 @@
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsRelUtils.h"
#include "nsWinUtils.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleEvent.h"
@ -193,58 +194,23 @@ STDMETHODIMP nsAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *pp
{
__try {
*ppdispParent = NULL;
if (!mWeakShell)
return E_FAIL; // We've been shut down
nsIFrame *frame = GetFrame();
HWND hwnd = 0;
if (frame) {
nsIView *view = frame->GetViewExternal();
if (view) {
// This code is essentially our implementation of WindowFromAccessibleObject,
// because MSAA iterates get_accParent() until it sees an object of ROLE_WINDOW
// to know where the window for a given accessible is. We must expose the native
// window accessible that MSAA creates for us. This must be done for the document
// object as well as any layout that creates its own window (e.g. via overflow: scroll)
nsIWidget *widget = view->GetWidget();
if (widget) {
hwnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW);
NS_ASSERTION(hwnd, "No window handle for window");
if (IsDefunct())
return E_FAIL;
nsIViewManager* viewManager = view->GetViewManager();
if (!viewManager)
return E_UNEXPECTED;
nsIView *rootView;
viewManager->GetRootView(rootView);
if (rootView == view) {
// If the client accessible (OBJID_CLIENT) has a window but its window
// was created by an outer window then we want the native accessible
// for that outer window. If the accessible was created for outer
// window (if the outer window has inner windows then they share the
// same client accessible with it) then return native accessible for
// the outer window.
HWND parenthwnd = ::GetParent(hwnd);
if (parenthwnd)
hwnd = parenthwnd;
NS_ASSERTION(hwnd, "No window handle for window");
}
nsRefPtr<nsDocAccessible> doc(do_QueryObject(this));
if (doc) {
// Return window system accessible object for root document and tab document
// accessibles.
if (!doc->ParentDocument() ||
nsWinUtils::IsWindowEmulationEnabled() &&
nsWinUtils::IsTabDocument(doc->GetDocumentNode())) {
HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
if (hwnd && SUCCEEDED(AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
IID_IAccessible,
(void**)ppdispParent))) {
return S_OK;
}
else {
// If a frame is a scrollable frame, then it has one window for the client area,
// not an extra parent window for just the scrollbars
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
if (scrollFrame) {
hwnd = (HWND)scrollFrame->GetScrolledFrame()->GetNearestWidget()->GetNativeData(NS_NATIVE_WINDOW);
NS_ASSERTION(hwnd, "No window handle for window");
}
}
}
if (hwnd && SUCCEEDED(AccessibleObjectFromWindow(hwnd, OBJID_WINDOW, IID_IAccessible,
(void**)ppdispParent))) {
return S_OK;
}
}
@ -282,24 +248,21 @@ STDMETHODIMP nsAccessibleWrap::get_accChild(
{
__try {
*ppdispChild = NULL;
if (!mWeakShell || varChild.vt != VT_I4)
if (IsDefunct())
return E_FAIL;
if (varChild.lVal == CHILDID_SELF) {
*ppdispChild = static_cast<IDispatch*>(this);
AddRef();
return S_OK;
}
// IAccessible::accChild is used to return this accessible or child accessible
// at the given index or to get an accessible by child ID in the case of
// document accessible (it's handled by overriden GetXPAccessibleFor method
// on the document accessible). The getting an accessible by child ID is used
// by AccessibleObjectFromEvent() called by AT when AT handles our MSAA event.
nsAccessible* child = GetXPAccessibleFor(varChild);
if (child)
*ppdispChild = NativeAccessible(child);
if (!nsAccUtils::MustPrune(this)) {
nsAccessible* child = GetChildAt(varChild.lVal - 1);
if (child) {
*ppdispChild = NativeAccessible(child);
}
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return (*ppdispChild)? S_OK: E_FAIL;
return (*ppdispChild)? S_OK: E_INVALIDARG;
}
STDMETHODIMP nsAccessibleWrap::get_accName(
@ -390,6 +353,9 @@ STDMETHODIMP nsAccessibleWrap::get_accRole(
__try {
VariantInit(pvarRole);
if (IsDefunct())
return E_FAIL;
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
if (!xpAccessible)
return E_FAIL;
@ -399,11 +365,8 @@ __try {
"Does not support nsIAccessibleText when it should");
#endif
PRUint32 xpRole = 0, msaaRole = 0;
if (NS_FAILED(xpAccessible->GetRole(&xpRole)))
return E_FAIL;
msaaRole = gWindowsRoleMap[xpRole].msaaRole;
PRUint32 xpRole = xpAccessible->Role();
PRUint32 msaaRole = gWindowsRoleMap[xpRole].msaaRole;
NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].msaaRole == ROLE_WINDOWS_LAST_ENTRY,
"MSAA role map skewed");
@ -411,7 +374,8 @@ __try {
// a ROLE_OUTLINEITEM for consistency and compatibility.
// We need this because ARIA has a role of "row" for both grid and treegrid
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* xpParent = GetParent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
}
@ -1192,20 +1156,20 @@ nsAccessibleWrap::role(long *aRole)
__try {
*aRole = 0;
PRUint32 xpRole = 0;
nsresult rv = GetRole(&xpRole);
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (IsDefunct())
return E_FAIL;
NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
"MSAA role map skewed");
PRUint32 xpRole = Role();
*aRole = gWindowsRoleMap[xpRole].ia2Role;
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_TREE_TABLE)
nsAccessible* xpParent = GetParent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
@ -1670,45 +1634,11 @@ PRInt32 nsAccessibleWrap::GetChildIDFor(nsIAccessible* aAccessible)
HWND
nsAccessibleWrap::GetHWNDFor(nsAccessible *aAccessible)
{
HWND hWnd = 0;
if (!aAccessible)
return hWnd;
return 0;
nsIFrame *frame = aAccessible->GetFrame();
if (frame) {
nsIWidget *window = frame->GetNearestWidget();
PRBool isVisible;
window->IsVisible(isVisible);
if (isVisible) {
// Short explanation:
// If HWND for frame is inside a hidden window, fire the event on the
// containing document's visible window.
//
// Long explanation:
// This is really just to fix combo boxes with JAWS. Window-Eyes already
// worked with combo boxes because they use the value change event in
// the closed combo box case. JAWS will only pay attention to the focus
// events on the list items. The JAWS developers haven't fixed that, so
// we'll use the focus events to make JAWS work. However, JAWS is
// ignoring events on a hidden window. So, in order to fix the bug where
// JAWS doesn't echo the current option as it changes in a closed
// combo box, we need to use an ensure that we never fire an event with
// an HWND for a hidden window.
hWnd = (HWND)frame->GetNearestWidget()->GetNativeData(NS_NATIVE_WINDOW);
}
}
if (!hWnd) {
void* handle = nsnull;
nsDocAccessible *accessibleDoc = aAccessible->GetDocAccessible();
if (!accessibleDoc)
return 0;
accessibleDoc->GetWindowHandle(&handle);
hWnd = (HWND)handle;
}
return hWnd;
nsDocAccessible* document = aAccessible->GetDocAccessible();
return document ? static_cast<HWND>(document->GetNativeWindow()) : 0;
}
HRESULT
@ -1809,7 +1739,7 @@ nsAccessibleWrap::UnattachIEnumVariant()
nsAccessible*
nsAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
{
if (IsDefunct())
if (aVarChild.vt != VT_I4)
return nsnull;
// if its us real easy - this seems to always be the case

View File

@ -39,6 +39,9 @@
#include "nsDocAccessibleWrap.h"
#include "ISimpleDOMDocument_i.c"
#include "nsIAccessibilityService.h"
#include "nsRootAccessible.h"
#include "nsWinUtils.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
#include "nsIFrame.h"
@ -60,7 +63,7 @@
nsDocAccessibleWrap::
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
nsIWeakReference *aShell) :
nsDocAccessible(aDocument, aRootContent, aShell)
nsDocAccessible(aDocument, aRootContent, aShell), mHWND(NULL)
{
}
@ -103,39 +106,13 @@ nsDocAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
// accessible through whole accessible subtree including subdocuments.
// Otherwise we treat lVal as index in parent.
if (aVarChild.lVal < 0)
return IsDefunct() ? nsnull : GetXPAccessibleForChildID(aVarChild);
return nsAccessibleWrap::GetXPAccessibleFor(aVarChild);
}
STDMETHODIMP
nsDocAccessibleWrap::get_accChild(VARIANT varChild,
IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
{
__try {
*ppdispChild = NULL;
if (varChild.vt == VT_I4 && varChild.lVal < 0) {
// IAccessible::accChild can be used to get an accessible by child ID.
// It is used by AccessibleObjectFromEvent() called by AT when AT handles
// our MSAA event.
nsAccessible *xpAccessible = GetXPAccessibleForChildID(varChild);
if (!xpAccessible)
return E_FAIL;
IAccessible *msaaAccessible = NULL;
xpAccessible->GetNativeInterface((void**)&msaaAccessible);
*ppdispChild = static_cast<IDispatch*>(msaaAccessible);
return S_OK;
if (aVarChild.vt == VT_I4 && aVarChild.lVal < 0) {
// Convert child ID to unique ID.
void* uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
return GetCachedAccessibleInSubtree(uniqueID);
}
// Otherwise, the normal get_accChild() will do
return nsAccessibleWrap::get_accChild(varChild, ppdispChild);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
return nsAccessibleWrap::GetXPAccessibleFor(aVarChild);
}
STDMETHODIMP nsDocAccessibleWrap::get_URL(/* [out] */ BSTR __RPC_FAR *aURL)
@ -262,7 +239,7 @@ STDMETHODIMP nsDocAccessibleWrap::get_accValue(
if (FAILED(hr) || *pszValue || varChild.lVal != CHILDID_SELF)
return hr;
// If document is being used to create a widget, don't use the URL hack
PRUint32 role = nsAccUtils::Role(this);
PRUint32 role = Role();
if (role != nsIAccessibleRole::ROLE_DOCUMENT &&
role != nsIAccessibleRole::ROLE_APPLICATION &&
role != nsIAccessibleRole::ROLE_DIALOG &&
@ -272,13 +249,52 @@ STDMETHODIMP nsDocAccessibleWrap::get_accValue(
return get_URL(pszValue);
}
nsAccessible*
nsDocAccessibleWrap::GetXPAccessibleForChildID(const VARIANT& aVarChild)
{
NS_PRECONDITION(aVarChild.vt == VT_I4 && aVarChild.lVal < 0,
"Variant doesn't point to child ID!");
////////////////////////////////////////////////////////////////////////////////
// nsAccessNode
// Convert child ID to unique ID.
void *uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
return GetAccService()->FindAccessibleInCache(uniqueID);
PRBool
nsDocAccessibleWrap::Init()
{
if (nsWinUtils::IsWindowEmulationEnabled()) {
// Create window for tab document.
if (nsWinUtils::IsTabDocument(mDocument)) {
nsRefPtr<nsRootAccessible> root = GetRootAccessible();
mHWND = nsWinUtils::CreateNativeWindow(kClassNameTabContent,
static_cast<HWND>(root->GetNativeWindow()));
nsAccessibleWrap::sHWNDCache.Put(mHWND, this);
} else {
nsDocAccessible* parentDocument = ParentDocument();
if (parentDocument)
mHWND = parentDocument->GetNativeWindow();
}
}
return nsDocAccessible::Init();
}
void
nsDocAccessibleWrap::Shutdown()
{
if (nsWinUtils::IsWindowEmulationEnabled()) {
// Destroy window created for root document.
if (nsWinUtils::IsTabDocument(mDocument)) {
nsAccessibleWrap::sHWNDCache.Remove(mHWND);
::DestroyWindow(static_cast<HWND>(mHWND));
}
mHWND = nsnull;
}
nsDocAccessible::Shutdown();
}
////////////////////////////////////////////////////////////////////////////////
// nsDocAccessible
void*
nsDocAccessibleWrap::GetNativeWindow() const
{
return mHWND ? mHWND : nsDocAccessible::GetNativeWindow();
}

View File

@ -83,27 +83,24 @@ public:
/* [in] */ BSTR __RPC_FAR *commaSeparatedMediaTypes);
// IAccessible
// Override get_accChild so that it can get any child via the unique ID
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild(
/* [in] */ VARIANT varChild,
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild);
// Override get_accValue to provide URL when no other value is available
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszValue);
// nsAccessNode
virtual PRBool Init();
virtual void Shutdown();
// nsAccessibleWrap
virtual nsAccessible *GetXPAccessibleFor(const VARIANT& varChild);
// nsDocAccessibleWrap
// nsDocAccessible
virtual void* GetNativeWindow() const;
/**
* Find an accessible by the given child ID in cached documents.
*
* @param aVarChild [in] variant pointing to the child ID
*/
static nsAccessible *GetXPAccessibleForChildID(const VARIANT& aVarChild);
protected:
void* mHWND;
};
#endif

View File

@ -64,13 +64,10 @@ nsHTMLWin32ObjectOwnerAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsHTMLWin32ObjectOwnerAccessible: nsAccessible implementation
nsresult
nsHTMLWin32ObjectOwnerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsHTMLWin32ObjectOwnerAccessible::NativeRole()
{
NS_ENSURE_ARG_POINTER(aRole);
*aRole = nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
return NS_OK;
return nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
}
nsresult

View File

@ -61,7 +61,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

View File

@ -43,6 +43,7 @@
#include "nsAccessibleWrap.h"
#include "nsIWinAccessNode.h"
#include "nsArrayUtils.h"
#include "nsIDocShellTreeItem.h"
HRESULT
nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array,
@ -96,3 +97,57 @@ nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array,
*aIA2ArrayLen = length;
return S_OK;
}
void
nsWinUtils::RegisterNativeWindow(LPCWSTR aWindowClass)
{
WNDCLASSW wc;
wc.style = CS_GLOBALCLASS;
wc.lpfnWndProc = nsAccessNodeWrap::WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = aWindowClass;
::RegisterClassW(&wc);
}
HWND
nsWinUtils::CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd)
{
return ::CreateWindowW(aWindowClass,
L"NetscapeDispatchWnd",
WS_CHILD | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT,
0, 0,
aParentWnd,
NULL,
GetModuleHandle(NULL),
NULL);
}
bool
nsWinUtils::IsWindowEmulationEnabled()
{
return ::GetModuleHandleW(kJAWSModuleHandle) ||
::GetModuleHandleW(kWEModuleHandle) ||
::GetModuleHandleW(kDolphnModuleHandle);
}
bool
nsWinUtils::IsTabDocument(nsIDocument* aDocumentNode)
{
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
treeItem->GetParent(getter_AddRefs(parentTreeItem));
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
return parentTreeItem == rootTreeItem;
}

View File

@ -44,6 +44,14 @@
#include "Accessible2.h"
#include "nsIArray.h"
#include "nsIDocument.h"
const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass";
const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass";
const LPCWSTR kJAWSModuleHandle = L"jhook";
const LPCWSTR kWEModuleHandle = L"gwm32inc";
const LPCWSTR kDolphnModuleHandle = L"dolwinhk";
class nsWinUtils
{
@ -54,6 +62,26 @@ public:
*/
static HRESULT ConvertToIA2Array(nsIArray *aCollection,
IUnknown ***aAccessibles, long *aCount);
/**
* Helper to register window class.
*/
static void RegisterNativeWindow(LPCWSTR aWindowClass);
/**
* Helper to create a window.
*/
static HWND CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd);
/**
* Return true if window emulation is enabled.
*/
static bool IsWindowEmulationEnabled();
/**
* Return true if the given document node is for tab document accessible.
*/
static bool IsTabDocument(nsIDocument* aDocumentNode);
};
#endif

View File

@ -244,11 +244,10 @@ nsXFormsContainerAccessible::
{
}
nsresult
nsXFormsContainerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsContainerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
PRBool

View File

@ -128,7 +128,7 @@ public:
nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
// Allows accessible nodes in anonymous content of xforms element by
// always returning PR_TRUE value.

View File

@ -50,11 +50,10 @@ nsXFormsLabelAccessible::
{
}
nsresult
nsXFormsLabelAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsLabelAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}
nsresult
@ -86,11 +85,10 @@ nsXFormsOutputAccessible::
{
}
nsresult
nsXFormsOutputAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsOutputAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_STATICTEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_STATICTEXT;
}
@ -104,11 +102,10 @@ nsXFormsTriggerAccessible::
{
}
nsresult
nsXFormsTriggerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsTriggerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
NS_IMETHODIMP
@ -160,11 +157,10 @@ nsXFormsInputAccessible::
NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
nsresult
nsXFormsInputAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsInputAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ENTRY;
return NS_OK;
return nsIAccessibleRole::ROLE_ENTRY;
}
NS_IMETHODIMP
@ -207,11 +203,10 @@ nsXFormsInputBooleanAccessible::
{
}
nsresult
nsXFormsInputBooleanAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsInputBooleanAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
nsresult
@ -281,11 +276,10 @@ nsXFormsInputDateAccessible::
{
}
nsresult
nsXFormsInputDateAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsInputDateAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_DROPLIST;
return NS_OK;
return nsIAccessibleRole::ROLE_DROPLIST;
}
@ -299,11 +293,10 @@ nsXFormsSecretAccessible::
{
}
nsresult
nsXFormsSecretAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsSecretAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
}
nsresult
@ -334,11 +327,10 @@ nsXFormsRangeAccessible::
{
}
nsresult
nsXFormsRangeAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsRangeAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SLIDER;
return NS_OK;
return nsIAccessibleRole::ROLE_SLIDER;
}
nsresult
@ -460,11 +452,10 @@ nsXFormsChoicesAccessible::
{
}
nsresult
nsXFormsChoicesAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsChoicesAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
NS_IMETHODIMP
@ -491,11 +482,10 @@ nsXFormsSelectFullAccessible::
{
}
nsresult
nsXFormsSelectFullAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsSelectFullAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
void
@ -515,11 +505,10 @@ nsXFormsItemCheckgroupAccessible::
{
}
nsresult
nsXFormsItemCheckgroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsItemCheckgroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
nsresult
@ -561,11 +550,10 @@ nsXFormsItemRadiogroupAccessible::
{
}
nsresult
nsXFormsItemRadiogroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsItemRadiogroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_RADIOBUTTON;
}
nsresult
@ -603,11 +591,10 @@ nsXFormsSelectComboboxAccessible::
{
}
nsresult
nsXFormsSelectComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsSelectComboboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
return NS_OK;
return nsIAccessibleRole::ROLE_COMBOBOX;
}
nsresult
@ -650,11 +637,10 @@ nsXFormsItemComboboxAccessible::
{
}
nsresult
nsXFormsItemComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsItemComboboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LISTITEM;
return NS_OK;
return nsIAccessibleRole::ROLE_LISTITEM;
}
nsresult

View File

@ -55,7 +55,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -68,7 +68,7 @@ public:
nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -88,7 +88,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -108,7 +108,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -126,7 +126,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -140,7 +140,7 @@ public:
nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -156,7 +156,7 @@ public:
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -177,7 +177,7 @@ public:
NS_IMETHOD GetCurrentValue(double *aCurrentValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -210,7 +210,7 @@ public:
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
// nsAccessible
@ -229,7 +229,7 @@ public:
nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
// nsAccessible
@ -253,7 +253,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -274,7 +274,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -291,7 +291,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
};
@ -313,7 +313,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};

View File

@ -49,11 +49,10 @@ nsXFormsDropmarkerWidgetAccessible::
{
}
nsresult
nsXFormsDropmarkerWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsDropmarkerWidgetAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -134,11 +133,10 @@ nsXFormsCalendarWidgetAccessible(nsIContent *aContent, nsIWeakReference *aShell)
{
}
nsresult
nsXFormsCalendarWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsCalendarWidgetAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CALENDAR;
return NS_OK;
return nsIAccessibleRole::ROLE_CALENDAR;
}
@ -153,11 +151,10 @@ nsXFormsComboboxPopupWidgetAccessible::
{
}
nsresult
nsXFormsComboboxPopupWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXFormsComboboxPopupWidgetAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LIST;
}
nsresult

View File

@ -60,7 +60,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -75,7 +75,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -95,7 +95,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

View File

@ -50,11 +50,10 @@ nsXULAlertAccessible::
NS_IMPL_ISUPPORTS_INHERITED0(nsXULAlertAccessible, nsAccessible)
nsresult
nsXULAlertAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULAlertAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ALERT;
return NS_OK;
return nsIAccessibleRole::ROLE_ALERT;
}
nsresult

View File

@ -55,7 +55,7 @@ public:
NS_IMETHOD GetName(nsAString& aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};

View File

@ -73,11 +73,10 @@ nsXULColorPickerTileAccessible::GetValue(nsAString& aValue)
////////////////////////////////////////////////////////////////////////////////
// nsXULColorPickerTileAccessible: nsAccessible
nsresult
nsXULColorPickerTileAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColorPickerTileAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -149,11 +148,10 @@ nsXULColorPickerAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsXULColorPickerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColorPickerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
return NS_OK;
return nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
}
////////////////////////////////////////////////////////////////////////////////
@ -166,9 +164,7 @@ nsXULColorPickerAccessible::CacheChildren()
nsRefPtr<nsAccessible> child;
while ((child = walker.GetNextChild())) {
// XXX: do not call nsAccessible::GetRole() while accessible not in tree
// (bug 574588).
PRUint32 role = nsAccUtils::Role(child);
PRUint32 role = child->Role();
// Get an accessbile for menupopup or panel elements.
if (role == nsIAccessibleRole::ROLE_ALERT) {

View File

@ -55,7 +55,7 @@ public:
NS_IMETHOD GetValue(nsAString& _retval);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -72,7 +72,7 @@ public:
virtual PRBool Init();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:

View File

@ -66,20 +66,13 @@ nsXULComboboxAccessible::Init()
return PR_TRUE;
}
nsresult
nsXULComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULComboboxAccessible::NativeRole()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::autocomplete, eIgnoreCase)) {
*aRole = nsIAccessibleRole::ROLE_AUTOCOMPLETE;
} else {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
}
return NS_OK;
nsAccessibilityAtoms::autocomplete, eIgnoreCase))
return nsIAccessibleRole::ROLE_AUTOCOMPLETE;
return nsIAccessibleRole::ROLE_COMBOBOX;
}
nsresult

View File

@ -64,7 +64,7 @@ public:
virtual PRBool Init();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
};

View File

@ -125,11 +125,10 @@ nsXULButtonAccessible::Init()
////////////////////////////////////////////////////////////////////////////////
// nsXULButtonAccessible: nsAccessible
nsresult
nsXULButtonAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULButtonAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -212,9 +211,7 @@ nsXULButtonAccessible::CacheChildren()
nsRefPtr<nsAccessible> child;
while ((child = walker.GetNextChild())) {
// XXX: do not call nsAccessible::GetRole() while accessible not in tree
// (bug 574588).
PRUint32 role = nsAccUtils::Role(child);
PRUint32 role = child->Role();
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
// Get an accessbile for menupopup or panel elements.
@ -319,14 +316,10 @@ NS_IMETHODIMP nsXULDropmarkerAccessible::DoAction(PRUint8 index)
return NS_ERROR_INVALID_ARG;
}
/**
* We are a pushbutton
*/
nsresult
nsXULDropmarkerAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULDropmarkerAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_PUSHBUTTON;
}
nsresult
@ -362,11 +355,10 @@ nsXULCheckboxAccessible::
{
}
nsresult
nsXULCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULCheckboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
}
NS_IMETHODIMP nsXULCheckboxAccessible::GetNumActions(PRUint8 *_retval)
@ -450,11 +442,10 @@ nsXULGroupboxAccessible::
{
}
nsresult
nsXULGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULGroupboxAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
nsresult
@ -485,7 +476,7 @@ nsXULGroupboxAccessible::GetRelationByType(PRUint32 aRelationType,
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = GetChildAt(childIdx);
if (nsAccUtils::Role(childAcc) == nsIAccessibleRole::ROLE_LABEL) {
if (childAcc->Role() == nsIAccessibleRole::ROLE_LABEL) {
// Ensure that it's our label
// XXX: we'll fail if group accessible expose more than one relation
// targets.
@ -521,11 +512,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULProgressMeterAccessible,
// nsAccessible
nsresult
nsXULProgressMeterAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULProgressMeterAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PROGRESSBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_PROGRESSBAR;
}
// nsIAccessibleValue
@ -701,11 +691,10 @@ nsXULRadioGroupAccessible::
{
}
nsresult
nsXULRadioGroupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULRadioGroupAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
return nsIAccessibleRole::ROLE_GROUPING;
}
nsresult
@ -735,11 +724,10 @@ nsXULStatusBarAccessible::
{
}
nsresult
nsXULStatusBarAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULStatusBarAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_STATUSBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_STATUSBAR;
}
@ -810,11 +798,10 @@ nsXULToolbarAccessible::
{
}
nsresult
nsXULToolbarAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULToolbarAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_TOOLBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_TOOLBAR;
}
nsresult
@ -842,11 +829,10 @@ nsXULToolbarSeparatorAccessible::
{
}
nsresult
nsXULToolbarSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULToolbarSeparatorAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SEPARATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_SEPARATOR;
}
nsresult
@ -976,16 +962,13 @@ nsXULTextFieldAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsXULTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTextFieldAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ENTRY;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::password, eIgnoreCase))
*aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return NS_OK;
return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
return nsIAccessibleRole::ROLE_ENTRY;
}

View File

@ -70,7 +70,7 @@ public:
virtual PRBool Init();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
@ -98,7 +98,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -117,7 +117,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
private:
@ -137,7 +137,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetNameInternal(nsAString& aName);
};
@ -154,7 +154,7 @@ public:
NS_IMETHOD GetValue(nsAString &aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -181,7 +181,7 @@ public:
nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -194,7 +194,7 @@ public:
nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
/**
@ -222,7 +222,7 @@ public:
nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetNameInternal(nsAString& aName);
};
@ -236,7 +236,7 @@ public:
nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -263,7 +263,7 @@ public:
// nsAccessible
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();

View File

@ -57,11 +57,10 @@ nsXULColumnsAccessible::
{
}
nsresult
nsXULColumnsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColumnsAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_LIST;
}
nsresult
@ -97,11 +96,10 @@ nsXULColumnItemAccessible::
{
}
nsresult
nsXULColumnItemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULColumnItemAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
return NS_OK;
return nsIAccessibleRole::ROLE_COLUMNHEADER;
}
nsresult
@ -236,24 +234,19 @@ NS_IMETHODIMP nsXULListboxAccessible::GetValue(nsAString& _retval)
return NS_ERROR_FAILURE;
}
nsresult
nsXULListboxAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULListboxAccessible::NativeRole()
{
// A richlistbox is used with the new autocomplete URL bar, and has a parent
// popup <panel>.
nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
do_QueryInterface(mContent->GetParent());
if (xulPopup) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
}
if (xulPopup)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
if (IsMulticolumn())
*aRole = nsIAccessibleRole::ROLE_TABLE;
else
*aRole = nsIAccessibleRole::ROLE_LISTBOX;
return NS_OK;
return nsIAccessibleRole::ROLE_TABLE;
return nsIAccessibleRole::ROLE_LISTBOX;
}
////////////////////////////////////////////////////////////////////////////////
@ -649,7 +642,7 @@ nsXULListboxAccessible::GetSelectedCells(nsIArray **aCells)
PRInt32 cellCount = item->GetChildCount();
for (PRInt32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
nsAccessible *cell = mChildren[cellIdx];
if (nsAccUtils::Role(cell) == nsIAccessibleRole::ROLE_CELL)
if (cell->Role() == nsIAccessibleRole::ROLE_CELL)
selCells->AppendElement(static_cast<nsIAccessible*>(cell), PR_FALSE);
}
}
@ -923,24 +916,25 @@ nsXULListitemAccessible::GetNameInternal(nsAString& aName)
return GetXULName(aName);
}
nsresult
nsXULListitemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULListitemAccessible::NativeRole()
{
nsAccessible *list = GetListAccessible();
NS_ENSURE_STATE(list);
if (nsAccUtils::Role(list) == nsIAccessibleRole::ROLE_TABLE) {
*aRole = nsIAccessibleRole::ROLE_ROW;
return NS_OK;
if (!list) {
NS_ERROR("No list accessible for listitem accessible!");
return nsIAccessibleRole::ROLE_NOTHING;
}
if (list->Role() == nsIAccessibleRole::ROLE_TABLE)
return nsIAccessibleRole::ROLE_ROW;
if (mIsCheckbox)
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
else if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
else
*aRole = nsIAccessibleRole::ROLE_RICH_OPTION;
return NS_OK;
return nsIAccessibleRole::ROLE_CHECKBUTTON;
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return nsIAccessibleRole::ROLE_RICH_OPTION;
}
nsresult
@ -1046,14 +1040,12 @@ nsXULListCellAccessible::GetTable(nsIAccessibleTable **aTable)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> thisRow;
GetParent(getter_AddRefs(thisRow));
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
nsAccessible* thisRow = GetParent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsCOMPtr<nsIAccessible> table;
thisRow->GetParent(getter_AddRefs(table));
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE)
nsAccessible* table = thisRow->GetParent();
if (!table || table->Role() != nsIAccessibleRole::ROLE_TABLE)
return NS_OK;
CallQueryInterface(table, aTable);
@ -1069,21 +1061,21 @@ nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
*aColumnIndex = 0;
nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
GetPreviousSibling(getter_AddRefs(prevCell));
while (prevCell) {
PRUint32 role = nsAccUtils::Role(prevCell);
PRInt32 indexInRow = GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInRow; idx++) {
nsAccessible* cell = row->GetChildAt(idx);
PRUint32 role = cell->Role();
if (role == nsIAccessibleRole::ROLE_CELL ||
role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
(*aColumnIndex)++;
prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
tmpAcc.swap(prevCell);
}
return NS_OK;
@ -1098,15 +1090,21 @@ nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row, prevRow;
GetParent(getter_AddRefs(row));
nsAccessible* row = GetParent();
if (!row)
return NS_OK;
while (row) {
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
nsAccessible* table = row->GetParent();
if (!table)
return NS_OK;
*aRowIndex = 0;
PRInt32 indexInTable = row->GetIndexInParent();
for (PRInt32 idx = 0; idx < indexInTable; idx++) {
row = table->GetChildAt(idx);
if (row->Role() == nsIAccessibleRole::ROLE_ROW)
(*aRowIndex)++;
row->GetPreviousSibling(getter_AddRefs(prevRow));
row.swap(prevRow);
}
return NS_OK;
@ -1158,7 +1156,7 @@ nsXULListCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
PRInt32 tableChildCount = tableAcc->GetChildCount();
for (PRInt32 childIdx = 0; childIdx < tableChildCount; childIdx++) {
nsAccessible *child = tableAcc->GetChildAt(childIdx);
if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_LIST) {
if (child->Role() == nsIAccessibleRole::ROLE_LIST) {
list = child;
break;
}
@ -1228,11 +1226,10 @@ nsXULListCellAccessible::IsSelected(PRBool *aIsSelected)
////////////////////////////////////////////////////////////////////////////////
// nsXULListCellAccessible. nsAccessible implementation
nsresult
nsXULListCellAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULListCellAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_CELL;
return NS_OK;
return nsIAccessibleRole::ROLE_CELL;
}
nsresult

View File

@ -58,7 +58,7 @@ public:
nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -77,7 +77,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
enum { eAction_Click = 0 };
@ -100,7 +100,7 @@ public:
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
@ -127,7 +127,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 *aSetSize);
@ -160,7 +160,7 @@ public:
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

View File

@ -329,8 +329,7 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
}
// Combo box listitem
PRBool isComboboxOption =
(nsAccUtils::Role(this) == nsIAccessibleRole::ROLE_COMBOBOX_OPTION);
PRBool isComboboxOption = (Role() == nsIAccessibleRole::ROLE_COMBOBOX_OPTION);
if (isComboboxOption) {
// Is selected?
PRBool isSelected = PR_FALSE;
@ -353,7 +352,7 @@ nsXULMenuitemAccessible::GetStateInternal(PRUint32 *aState,
// Set selected option offscreen/invisible according to combobox state
nsAccessible* grandParentAcc = parentAcc->GetParent();
NS_ENSURE_TRUE(grandParentAcc, NS_ERROR_FAILURE);
NS_ASSERTION(nsAccUtils::Role(grandParentAcc) == nsIAccessibleRole::ROLE_COMBOBOX,
NS_ASSERTION(grandParentAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
"grandparent of combobox listitem is not combobox");
PRUint32 grandParentState, grandParentExtState;
grandParentAcc->GetState(&grandParentState, &grandParentExtState);
@ -428,7 +427,7 @@ nsXULMenuitemAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
nsAccessible* parentAcc = GetParent();
if (parentAcc) {
if (nsAccUtils::RoleInternal(parentAcc) == nsIAccessibleRole::ROLE_MENUBAR) {
if (parentAcc->NativeRole() == nsIAccessibleRole::ROLE_MENUBAR) {
// If top level menu item, add Alt+ or whatever modifier text to string
// No need to cache pref service, this happens rarely
if (gMenuAccesskeyModifier == -1) {
@ -479,34 +478,28 @@ nsXULMenuitemAccessible::GetDefaultKeyBinding(nsAString& aKeyBinding)
return NS_OK;
}
nsresult
nsXULMenuitemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenuitemAccessible::NativeRole()
{
nsCOMPtr<nsIDOMXULContainerElement> xulContainer(do_QueryInterface(mContent));
if (xulContainer) {
*aRole = nsIAccessibleRole::ROLE_PARENT_MENUITEM;
return NS_OK;
}
if (xulContainer)
return nsIAccessibleRole::ROLE_PARENT_MENUITEM;
if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return NS_OK;
}
if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::radio, eCaseMatters)) {
*aRole = nsIAccessibleRole::ROLE_RADIO_MENU_ITEM;
} else if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::checkbox,
eCaseMatters)) {
*aRole = nsIAccessibleRole::ROLE_CHECK_MENU_ITEM;
} else {
*aRole = nsIAccessibleRole::ROLE_MENUITEM;
return nsIAccessibleRole::ROLE_RADIO_MENU_ITEM;
}
return NS_OK;
if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
nsAccessibilityAtoms::checkbox,
eCaseMatters)) {
return nsIAccessibleRole::ROLE_CHECK_MENU_ITEM;
}
return nsIAccessibleRole::ROLE_MENUITEM;
}
PRInt32
@ -587,11 +580,10 @@ nsXULMenuSeparatorAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULMenuSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenuSeparatorAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SEPARATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_SEPARATOR;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::DoAction(PRUint8 index)
@ -667,29 +659,28 @@ nsXULMenupopupAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULMenupopupAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenupopupAccessible::NativeRole()
{
nsAccessible *parent = GetParent();
if (parent) {
PRUint32 role = nsAccUtils::Role(parent);
// If accessible is not bound to the tree (this happens while children are
// cached) return general role.
if (mParent) {
PRUint32 role = mParent->Role();
if (role == nsIAccessibleRole::ROLE_COMBOBOX ||
role == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
} else if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
// Some widgets like the search bar have several popups, owned by buttons.
nsAccessible *grandParent = parent->GetParent();
if (nsAccUtils::Role(grandParent) == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
}
nsAccessible* grandParent = mParent->GetParent();
if (grandParent &&
grandParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
}
}
*aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
return NS_OK;
return nsIAccessibleRole::ROLE_MENUPOPUP;
}
@ -723,10 +714,9 @@ nsXULMenubarAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULMenubarAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULMenubarAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_MENUBAR;
return NS_OK;
return nsIAccessibleRole::ROLE_MENUBAR;
}

View File

@ -94,7 +94,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRInt32 GetLevelInternal();
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
@ -118,7 +118,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -133,7 +133,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -147,7 +147,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};

View File

@ -62,11 +62,10 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULSliderAccessible,
// nsAccessible
nsresult
nsXULSliderAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULSliderAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_SLIDER;
return NS_OK;
return nsIAccessibleRole::ROLE_SLIDER;
}
nsresult
@ -300,12 +299,12 @@ nsXULThumbAccessible::
{
}
// nsIAccessible
////////////////////////////////////////////////////////////////////////////////
// nsXULThumbAccessible: nsAccessible
nsresult
nsXULThumbAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULThumbAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_INDICATOR;
return NS_OK;
return nsIAccessibleRole::ROLE_INDICATOR;
}

View File

@ -64,7 +64,7 @@ public:
NS_DECL_NSIACCESSIBLEVALUE
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
@ -91,7 +91,7 @@ public:
nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

View File

@ -96,11 +96,10 @@ NS_IMETHODIMP nsXULTabAccessible::DoAction(PRUint8 index)
////////////////////////////////////////////////////////////////////////////////
// nsXULTabAccessible: nsAccessible
nsresult
nsXULTabAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PAGETAB;
return NS_OK;
return nsIAccessibleRole::ROLE_PAGETAB;
}
nsresult
@ -184,11 +183,10 @@ nsXULTabsAccessible::
{
}
nsresult
nsXULTabsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabsAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PAGETABLIST;
return NS_OK;
return nsIAccessibleRole::ROLE_PAGETABLIST;
}
NS_IMETHODIMP
@ -224,11 +222,10 @@ nsXULTabpanelsAccessible::
{
}
nsresult
nsXULTabpanelsAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabpanelsAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PANE;
return NS_OK;
return nsIAccessibleRole::ROLE_PANE;
}
@ -242,11 +239,10 @@ nsXULTabpanelAccessible::
{
}
nsresult
nsXULTabpanelAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTabpanelAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_PROPERTYPAGE;
return NS_OK;
return nsIAccessibleRole::ROLE_PROPERTYPAGE;
}
NS_IMETHODIMP

View File

@ -63,7 +63,7 @@ public:
// nsAccessible
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 *aSetSize);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -82,7 +82,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -95,7 +95,7 @@ public:
nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
@ -119,7 +119,7 @@ public:
nsIAccessibleRelation **aRelation);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
};
#endif

View File

@ -71,11 +71,10 @@ nsXULTextAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
nsresult
nsXULTextAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTextAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
return nsIAccessibleRole::ROLE_LABEL;
}
nsresult
@ -103,11 +102,9 @@ nsXULTextAccessible::GetRelationByType(PRUint32 aRelationType,
// Caption is the label for groupbox
nsIContent *parent = mContent->GetParent();
if (parent && parent->Tag() == nsAccessibilityAtoms::caption) {
nsCOMPtr<nsIAccessible> parentAccessible;
GetParent(getter_AddRefs(parentAccessible));
if (nsAccUtils::Role(parentAccessible) == nsIAccessibleRole::ROLE_GROUPING)
return nsRelUtils::
AddTarget(aRelationType, aRelation, parentAccessible);
nsAccessible* parent = GetParent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_GROUPING)
return nsRelUtils::AddTarget(aRelationType, aRelation, parent);
}
}
@ -137,11 +134,10 @@ nsXULTooltipAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
nsresult
nsXULTooltipAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTooltipAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_TOOLTIP;
return NS_OK;
return nsIAccessibleRole::ROLE_TOOLTIP;
}
@ -184,11 +180,10 @@ nsXULLinkAccessible::GetNameInternal(nsAString& aName)
return nsTextEquivUtils::GetNameFromSubtree(this, aName);
}
nsresult
nsXULLinkAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULLinkAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_LINK;
return NS_OK;
return nsIAccessibleRole::ROLE_LINK;
}

View File

@ -58,7 +58,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -72,7 +72,7 @@ public:
nsXULTooltipAccessible(nsIContent *aContent, nsIWeakReference *aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
@ -93,7 +93,7 @@ public:
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// HyperLinkAccessible

View File

@ -181,12 +181,9 @@ nsXULTreeAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeAccessible: nsAccessible implementation (put methods here)
nsresult
nsXULTreeAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeAccessible::NativeRole()
{
if (IsDefunct())
return NS_ERROR_FAILURE;
// No primary column means we're in a list. In fact, history and mail turn off
// the primary flag when switching to a flat view.
@ -196,11 +193,9 @@ nsXULTreeAccessible::GetRoleInternal(PRUint32 *aRole)
if (cols)
cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
*aRole = primaryCol ?
return primaryCol ?
static_cast<PRUint32>(nsIAccessibleRole::ROLE_OUTLINE) :
static_cast<PRUint32>(nsIAccessibleRole::ROLE_LIST);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
@ -1159,21 +1154,22 @@ nsXULTreeItemAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessible: nsAccessible implementation
nsresult
nsXULTreeItemAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeItemAccessible::NativeRole()
{
nsCOMPtr<nsITreeColumns> columns;
mTree->GetColumns(getter_AddRefs(columns));
NS_ENSURE_STATE(columns);
if (!columns) {
NS_ERROR("No tree columns object in the tree!");
return nsIAccessibleRole::ROLE_NOTHING;
}
nsCOMPtr<nsITreeColumn> primaryColumn;
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
*aRole = primaryColumn ?
return primaryColumn ?
static_cast<PRUint32>(nsIAccessibleRole::ROLE_OUTLINEITEM) :
static_cast<PRUint32>(nsIAccessibleRole::ROLE_LISTITEM);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -84,7 +84,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
@ -275,7 +275,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
// nsXULTreeItemAccessibleBase
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);

View File

@ -575,21 +575,22 @@ nsXULTreeGridAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessible: nsAccessible implementation
nsresult
nsXULTreeGridAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeGridAccessible::NativeRole()
{
nsCOMPtr<nsITreeColumns> treeColumns;
mTree->GetColumns(getter_AddRefs(treeColumns));
NS_ENSURE_STATE(treeColumns);
if (!treeColumns) {
NS_ERROR("No treecolumns object for tree!");
return nsIAccessibleRole::ROLE_NOTHING;
}
nsCOMPtr<nsITreeColumn> primaryColumn;
treeColumns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
*aRole = primaryColumn ?
return primaryColumn ?
static_cast<PRUint32>(nsIAccessibleRole::ROLE_TREE_TABLE) :
static_cast<PRUint32>(nsIAccessibleRole::ROLE_TABLE);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
@ -656,11 +657,10 @@ nsXULTreeGridRowAccessible::Shutdown()
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridRowAccessible: nsAccessible implementation
nsresult
nsXULTreeGridRowAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeGridRowAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_ROW;
return NS_OK;
return nsIAccessibleRole::ROLE_ROW;
}
nsresult
@ -1164,11 +1164,10 @@ nsXULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
return NS_OK;
}
nsresult
nsXULTreeGridCellAccessible::GetRoleInternal(PRUint32 *aRole)
PRUint32
nsXULTreeGridCellAccessible::NativeRole()
{
*aRole = nsIAccessibleRole::ROLE_GRID_CELL;
return NS_OK;
return nsIAccessibleRole::ROLE_GRID_CELL;
}
nsresult

View File

@ -59,7 +59,7 @@ public:
NS_DECL_NSIACCESSIBLETABLE
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
protected:
@ -92,7 +92,7 @@ public:
virtual void Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
nsIAccessible **aChild);
@ -164,7 +164,7 @@ public:
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual PRUint32 NativeRole();
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRInt32 GetIndexInParent() { return GetColumnIndex(); }

View File

@ -4,7 +4,7 @@
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- Seamonkey tabbrowser -->
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>

View File

@ -4,7 +4,7 @@
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- Seamonkey tabbrowser -->
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>

View File

@ -13,11 +13,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
src="../common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
src="../role.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
src="../states.js"></script>
<script type="application/javascript">
function testThis(aID, aAcc, aRole, aAnchors, aName, aValid, aStartIndex,

View File

@ -12,11 +12,11 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
src="../common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js" />
src="../role.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js" />
src="../states.js" />
<script type="application/javascript">
<![CDATA[

View File

@ -4,7 +4,7 @@
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- Seamonkey tabbrowser -->
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>

View File

@ -2,8 +2,13 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL tabbrowser relation tests">

View File

@ -2,8 +2,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/a11y/accessible/treeview.css"
type="text/css"?>
<?xml-stylesheet href="../treeview.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL tree selectable tests">

View File

@ -2,8 +2,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/a11y/accessible/treeview.css"
type="text/css"?>
<?xml-stylesheet href="../treeview.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL tree selectable tests">

View File

@ -2,8 +2,7 @@
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/a11y/accessible/treeview.css"
type="text/css"?>
<?xml-stylesheet href="../treeview.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL tree selectable tests">

View File

@ -53,6 +53,7 @@ _TEST_FILES =\
test_colorpicker.xul \
test_combobox.xul \
test_cssoverflow.html \
test_dochierarchy.html \
test_filectrl.html \
test_formctrl.html \
test_formctrl.xul \

View File

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>Test document hierarchy</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript">
function doTest()
{
// tabDoc and testDoc are different documents depending on whether test
// is running in standalone mode or not.
var root = getRootAccessible();
var tabDoc = window.parent ?
getAccessible(window.parent.document, [nsIAccessibleDocument]) :
getAccessible(document, [nsIAccessibleDocument]);
var testDoc = getAccessible(document, [nsIAccessibleDocument]);
var iframeDoc = getAccessible("iframe").firstChild.
QueryInterface(nsIAccessibleDocument);
is(root.parentDocument, null,
"Wrong parent document of root accessible");
is(root.childDocumentCount, 1,
"Wrong child document count of root accessible");
is(root.getChildDocumentAt(0), tabDoc,
"Wrong child document at index 0 of root accessible");
is(tabDoc.parentDocument, root,
"Wrong parent document of tab document");
is(tabDoc.childDocumentCount, 1,
"Wrong child document count of tab document");
is(tabDoc.getChildDocumentAt(0), (tabDoc == testDoc ? iframeDoc : testDoc),
"Wrong child document at index 0 of tab document");
if (tabDoc != testDoc) {
is(testDoc.parentDocument, tabDoc,
"Wrong parent document of test document");
is(testDoc.childDocumentCount, 1,
"Wrong child document count of test document");
is(testDoc.getChildDocumentAt(0), iframeDoc,
"Wrong child document at index 0 of test document");
}
is(iframeDoc.parentDocument, (tabDoc == testDoc ? tabDoc : testDoc),
"Wrong parent document of iframe document");
is(iframeDoc.childDocumentCount, 0,
"Wrong child document count of iframe document");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=592913"
title="Provide a way to quickly determine whether an accessible object is a descendant of a tab document">
Mozilla Bug 592913
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<iframe src="about:mozilla" id="iframe"></iframe>
</body>
</html>

View File

@ -4,7 +4,7 @@
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- Seamonkey tabbrowser -->
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>

View File

@ -50,19 +50,7 @@
role: ROLE_ENTRY,
children: [
{
role: ROLE_TEXT_LEAF // hello1 text
},
{
role: ROLE_WHITESPACE
},
{
role: ROLE_TEXT_LEAF, // hello2 text
},
{
role: ROLE_WHITESPACE
},
{
role: ROLE_TEXT_LEAF, // whitepsace text
role: ROLE_TEXT_LEAF // hello1\nhello2 text
},
{
role: ROLE_WHITESPACE

View File

@ -172,7 +172,7 @@ image.study-result {
color: white;
font-weight: bold;
padding: 2px;
-moz-border-radius: 10000px;
border-radius: 10000px;
margin-right: 25px;
margin-bottom: 13px;
}

View File

@ -102,16 +102,16 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
font-size: 16px;
padding: 8px 12px;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
-moz-box-shadow:
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 1px 1px,
inset rgba(255, 255, 255, 1) 0 3px 1px,
inset rgba(255, 255, 255, 0.3) 0 16px 0px,
inset rgba(0, 0, 0, 0.2) 0 -1px 1px,
inset rgba(0, 0, 0, 0.1) 0 -2px 1px,
rgba(255, 255, 255, 1) 0 1px,
rgba(133, 153, 166, 0.3) 0px 1px 12px;
rgba(133, 153, 166, 0.3) 0px 1px 8.5px;
background-color: #e7eaec;
//display: inline;
}
@ -122,16 +122,16 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 8px 12px;
width: 240px;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
-moz-box-shadow:
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 1px 1px,
inset rgba(255, 255, 255, 1) 0 3px 1px,
inset rgba(255, 255, 255, 0.3) 0 16px 0px,
inset rgba(0, 0, 0, 0.2) 0 -1px 1px,
inset rgba(0, 0, 0, 0.1) 0 -2px 1px,
rgba(255, 255, 255, 1) 0 1px,
rgba(133, 153, 166, 0.3) 0px 1px 12px;
rgba(133, 153, 166, 0.3) 0px 1px 8.5px;
background-color: #e7eaec;
//display: inline;
}
@ -143,13 +143,13 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 8px 24px;
margin: 24px auto;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/callout.png') no-repeat top center;
-moz-box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 12px,
box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 8.5px,
inset rgba(185, 221, 234, 1) 0 0px 1px,
inset rgba(255, 255, 255, 0.2) 0 10px 12px;
inset rgba(255, 255, 255, 0.2) 0 10px 8.5px;
//display: inline;
}
@ -161,13 +161,13 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 8px 24px;
margin: 8px auto;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/callout.png') no-repeat top center;
-moz-box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 12px,
box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 8.5px,
inset rgba(185, 221, 234, 1) 0 0px 1px,
inset rgba(255, 255, 255, 0.2) 0 10px 12px;
inset rgba(255, 255, 255, 0.2) 0 10px 8.5px;
//display: inline;
}
@ -197,7 +197,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 4px 40px;
width: 800px;
text-align: left;
-moz-border-radius: 0.25em;
border-radius: 0.25em;
-webkit-border-radius: 0.25em;
border-top: 1px solid #adb6ba;
border-left: 1px solid #adb6ba;
@ -223,8 +223,8 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
font-size: 14px;
text-shadow: 1px 1px 1px rgba(173, 182, 186, 1);
background-color: rgba(173, 182, 186, 0.3);
-moz-box-shadow:
inset rgba(0, 0, 0, 0.2) 0 -10px 12px;
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 -10px 8.5px;
padding: 9px 8px 8px 8px;
}
@ -255,4 +255,4 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
p.embiggened {
font-size: 14px;
}
}

Some files were not shown because too many files have changed in this diff Show More