Bumping manifests a=b2g-bump
[gecko.git] / accessible / base / AccGroupInfo.h
bloba1e30a2df8af730c6b2a9133309ae629f7ba6887
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"
10 namespace mozilla {
11 namespace a11y {
13 /**
14 * Calculate and store group information.
16 class AccGroupInfo
18 public:
19 ~AccGroupInfo() { MOZ_COUNT_DTOR(AccGroupInfo); }
21 /**
22 * Return 1-based position in the group.
24 uint32_t PosInSet() const { return mPosInSet; }
26 /**
27 * Return a number of items in the group.
29 uint32_t SetSize() const { return mSetSize; }
31 /**
32 * Return a direct or logical parent of the accessible that this group info is
33 * created for.
35 Accessible* ConceptualParent() const { return mParent; }
37 /**
38 * Update group information.
40 void Update();
42 /**
43 * Create group info.
45 static AccGroupInfo* CreateGroupInfo(Accessible* aAccessible)
47 mozilla::a11y::role role = aAccessible->Role();
48 if (role != mozilla::a11y::roles::ROW &&
49 role != mozilla::a11y::roles::OUTLINEITEM &&
50 role != mozilla::a11y::roles::OPTION &&
51 role != mozilla::a11y::roles::LISTITEM &&
52 role != mozilla::a11y::roles::MENUITEM &&
53 role != mozilla::a11y::roles::COMBOBOX_OPTION &&
54 role != mozilla::a11y::roles::RICH_OPTION &&
55 role != mozilla::a11y::roles::CHECK_RICH_OPTION &&
56 role != mozilla::a11y::roles::PARENT_MENUITEM &&
57 role != mozilla::a11y::roles::CHECK_MENU_ITEM &&
58 role != mozilla::a11y::roles::RADIO_MENU_ITEM &&
59 role != mozilla::a11y::roles::RADIOBUTTON &&
60 role != mozilla::a11y::roles::PAGETAB)
61 return nullptr;
63 AccGroupInfo* info = new AccGroupInfo(aAccessible, BaseRole(role));
64 return info;
67 /**
68 * Return a first item for the given container.
70 static Accessible* FirstItemOf(Accessible* aContainer);
72 /**
73 * Return next item of the same group to the given item.
75 static Accessible* NextItemTo(Accessible* aItem);
77 protected:
78 AccGroupInfo(Accessible* aItem, a11y::role aRole);
80 private:
81 AccGroupInfo() MOZ_DELETE;
82 AccGroupInfo(const AccGroupInfo&) MOZ_DELETE;
83 AccGroupInfo& operator =(const AccGroupInfo&) MOZ_DELETE;
85 static mozilla::a11y::role BaseRole(mozilla::a11y::role aRole)
87 if (aRole == mozilla::a11y::roles::CHECK_MENU_ITEM ||
88 aRole == mozilla::a11y::roles::PARENT_MENUITEM ||
89 aRole == mozilla::a11y::roles::RADIO_MENU_ITEM)
90 return mozilla::a11y::roles::MENUITEM;
92 if (aRole == mozilla::a11y::roles::CHECK_RICH_OPTION)
93 return mozilla::a11y::roles::RICH_OPTION;
95 return aRole;
98 /**
99 * Return true if the given parent and child roles should have their node
100 * relations reported.
102 static bool ShouldReportRelations(a11y::role aRole, a11y::role aParentRole);
104 uint32_t mPosInSet;
105 uint32_t mSetSize;
106 Accessible* mParent;
107 Accessible* mItem;
108 a11y::role mRole;
111 } // namespace mozilla
112 } // namespace a11y
114 #endif