1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef AccGroupInfo_h_
6 #define AccGroupInfo_h_
8 #include "Accessible-inl.h"
9 #include "nsAccUtils.h"
15 * Calculate and store group information.
20 ~AccGroupInfo() { MOZ_COUNT_DTOR(AccGroupInfo
); }
23 * Return 1-based position in the group.
25 uint32_t PosInSet() const { return mPosInSet
; }
28 * Return a number of items in the group.
30 uint32_t SetSize() const { return mSetSize
; }
33 * Return a direct or logical parent of the accessible that this group info is
36 Accessible
* ConceptualParent() const { return mParent
; }
41 static AccGroupInfo
* CreateGroupInfo(Accessible
* aAccessible
)
43 mozilla::a11y::role role
= aAccessible
->Role();
44 if (role
!= mozilla::a11y::roles::ROW
&&
45 role
!= mozilla::a11y::roles::GRID_CELL
&&
46 role
!= mozilla::a11y::roles::OUTLINEITEM
&&
47 role
!= mozilla::a11y::roles::OPTION
&&
48 role
!= mozilla::a11y::roles::LISTITEM
&&
49 role
!= mozilla::a11y::roles::MENUITEM
&&
50 role
!= mozilla::a11y::roles::COMBOBOX_OPTION
&&
51 role
!= mozilla::a11y::roles::RICH_OPTION
&&
52 role
!= mozilla::a11y::roles::CHECK_RICH_OPTION
&&
53 role
!= mozilla::a11y::roles::PARENT_MENUITEM
&&
54 role
!= mozilla::a11y::roles::CHECK_MENU_ITEM
&&
55 role
!= mozilla::a11y::roles::RADIO_MENU_ITEM
&&
56 role
!= mozilla::a11y::roles::RADIOBUTTON
&&
57 role
!= mozilla::a11y::roles::PAGETAB
)
60 AccGroupInfo
* info
= new AccGroupInfo(aAccessible
, BaseRole(role
));
65 * Return a first item for the given container.
67 static Accessible
* FirstItemOf(Accessible
* aContainer
);
70 * Return next item of the same group to the given item.
72 static Accessible
* NextItemTo(Accessible
* aItem
);
75 AccGroupInfo(Accessible
* aItem
, a11y::role aRole
);
78 AccGroupInfo() MOZ_DELETE
;
79 AccGroupInfo(const AccGroupInfo
&) MOZ_DELETE
;
80 AccGroupInfo
& operator =(const AccGroupInfo
&) MOZ_DELETE
;
82 static mozilla::a11y::role
BaseRole(mozilla::a11y::role aRole
)
84 if (aRole
== mozilla::a11y::roles::CHECK_MENU_ITEM
||
85 aRole
== mozilla::a11y::roles::PARENT_MENUITEM
||
86 aRole
== mozilla::a11y::roles::RADIO_MENU_ITEM
)
87 return mozilla::a11y::roles::MENUITEM
;
89 if (aRole
== mozilla::a11y::roles::CHECK_RICH_OPTION
)
90 return mozilla::a11y::roles::RICH_OPTION
;
96 * Return true if the given parent role is conceptual parent of the given
99 static bool IsConceptualParent(a11y::role aRole
, a11y::role aParentRole
);
106 } // namespace mozilla