Bug 818407, part1 - don't mix up with accessible types of ARIA role, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-12-20 14:11:55 +09:00
parent ff6a1d0ce7
commit 4e81c4d2ca
9 changed files with 35 additions and 19 deletions

View File

@ -5,7 +5,7 @@
#include "AccIterator.h"
#include "nsAccessibilityService.h"
#include "Accessible.h"
#include "Accessible-inl.h"
#include "mozilla/dom/Element.h"
#include "nsBindingManager.h"

View File

@ -9,6 +9,7 @@
#define _nsARIAMap_H_
#include "ARIAStateMap.h"
#include "mozilla/a11y/AccTypes.h"
#include "mozilla/a11y/Role.h"
#include "nsIAtom.h"
@ -149,6 +150,12 @@ struct nsRoleMapEntry
bool Is(nsIAtom* aARIARole) const
{ return *roleAtom == aARIARole; }
/**
* Return true if ARIA role has the given accessible type.
*/
bool IsOfType(mozilla::a11y::AccGenericType aType) const
{ return accTypes & aType; }
/**
* Return ARIA role.
*/

View File

@ -31,12 +31,11 @@ Accessible::ARIARole()
return ARIATransformRole(mRoleMapEntry->role);
}
inline void
Accessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
inline bool
Accessible::HasGenericType(AccGenericType aType) const
{
mRoleMapEntry = aRoleMapEntry;
if (mRoleMapEntry)
mGenericTypes |= mRoleMapEntry->accTypes;
return (mGenericTypes & aType) ||
(mRoleMapEntry && mRoleMapEntry->IsOfType(aType));
}
inline bool

View File

@ -304,7 +304,8 @@ public:
/**
* Set the ARIA role map entry for a new accessible.
*/
void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
{ mRoleMapEntry = aRoleMapEntry; }
/**
* Update the children cache.
@ -468,17 +469,17 @@ public:
bool IsApplication() const { return mType == eApplicationType; }
bool IsAutoComplete() const { return mGenericTypes & eAutoComplete; }
bool IsAutoComplete() const { return HasGenericType(eAutoComplete); }
bool IsAutoCompletePopup() const
{ return mGenericTypes & eAutoCompletePopup; }
{ return HasGenericType(eAutoCompletePopup); }
bool IsCombobox() const { return mGenericTypes & eCombobox; }
bool IsCombobox() const { return HasGenericType(eCombobox); }
bool IsDoc() const { return mGenericTypes & eDocument; }
bool IsDoc() const { return HasGenericType(eDocument); }
DocAccessible* AsDoc();
bool IsHyperText() const { return mGenericTypes & eHyperText; }
bool IsHyperText() const { return HasGenericType(eHyperText); }
HyperTextAccessible* AsHyperText();
bool IsHTMLFileInput() const { return mType == eHTMLFileInputType; }
@ -494,11 +495,11 @@ public:
bool IsImageMap() const { return mType == eImageMapType; }
HTMLImageMapAccessible* AsImageMap();
bool IsList() const { return mGenericTypes & eList; }
bool IsList() const { return HasGenericType(eList); }
bool IsListControl() const { return mGenericTypes & eListControl; }
bool IsListControl() const { return HasGenericType(eListControl); }
bool IsMenuButton() const { return mGenericTypes & eMenuButton; }
bool IsMenuButton() const { return HasGenericType(eMenuButton); }
bool IsMenuPopup() const { return mType == eMenuPopupType; }
@ -507,14 +508,14 @@ public:
bool IsRoot() const { return mType == eRootType; }
a11y::RootAccessible* AsRoot();
bool IsSelect() const { return mGenericTypes & eSelect; }
bool IsSelect() const { return HasGenericType(eSelect); }
bool IsTable() const { return mGenericTypes & eTable; }
bool IsTable() const { return HasGenericType(eTable); }
virtual TableAccessible* AsTable() { return nullptr; }
virtual TableCellAccessible* AsTableCell() { return nullptr; }
bool IsTableRow() const { return mGenericTypes & eTableRow; }
bool IsTableRow() const { return HasGenericType(eTableRow); }
bool IsTextLeaf() const { return mType == eTextLeafType; }
TextLeafAccessible* AsTextLeaf();
@ -524,6 +525,11 @@ public:
bool IsXULTree() const { return mType == eXULTreeType; }
XULTreeAccessible* AsXULTree();
/**
* Return true if the accessible belongs to the given accessible type.
*/
bool HasGenericType(AccGenericType aType) const;
//////////////////////////////////////////////////////////////////////////////
// ActionAccessible

View File

@ -5,6 +5,7 @@
#include "OuterDocAccessible.h"
#include "Accessible-inl.h"
#include "nsAccUtils.h"
#include "DocAccessible.h"
#include "Role.h"

View File

@ -7,6 +7,7 @@
#import "mozHTMLAccessible.h"
#import "Accessible-inl.h"
#import "HyperTextAccessible.h"
#import "nsCocoaUtils.h"

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Accessible-inl.h"
#include "AccessibleWrap.h"
#include "TextLeafAccessible.h"

View File

@ -5,6 +5,7 @@
#include "XULAlertAccessible.h"
#include "Accessible-inl.h"
#include "Role.h"
#include "States.h"

View File

@ -6,6 +6,7 @@
#include "XULTreeAccessible.h"
#include "Accessible-inl.h"
#include "DocAccessible-inl.h"
#include "nsAccCache.h"
#include "nsAccUtils.h"