no bug - Correct some typos in the comments. a=typo-fix
[gecko.git] / accessible / base / AccGroupInfo.h
bloba9afa14b8eff7c8e88aa3b8ddc4b6665957a76bf
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 "nsISupportsImpl.h"
9 #include "mozilla/MemoryReporting.h"
10 #include "mozilla/a11y/Role.h"
12 namespace mozilla {
13 namespace a11y {
15 class Accessible;
17 /**
18 * Calculate and store group information.
20 class AccGroupInfo {
21 public:
22 MOZ_COUNTED_DTOR(AccGroupInfo)
24 AccGroupInfo() = default;
25 AccGroupInfo(AccGroupInfo&&) = default;
26 AccGroupInfo& operator=(AccGroupInfo&&) = default;
28 /**
29 * Return 1-based position in the group.
31 uint32_t PosInSet() const { return mPosInSet; }
33 /**
34 * Return a number of items in the group.
36 uint32_t SetSize() const { return mSetSize; }
38 /**
39 * Return a direct or logical parent of the accessible that this group info is
40 * created for.
42 Accessible* ConceptualParent() const;
44 /**
45 * Update group information.
47 void Update();
49 /**
50 * Create group info.
52 static AccGroupInfo* CreateGroupInfo(const Accessible* aAccessible);
54 /**
55 * Return a first item for the given container.
57 static Accessible* FirstItemOf(const Accessible* aContainer);
59 /**
60 * Return total number of items in container, and if it is has nested
61 * collections.
63 static uint32_t TotalItemCount(Accessible* aContainer, bool* aIsHierarchical);
65 /**
66 * Return next item of the same group to the given item.
68 static Accessible* NextItemTo(Accessible* aItem);
70 size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf);
72 protected:
73 AccGroupInfo(const Accessible* aItem, a11y::role aRole);
75 private:
76 AccGroupInfo(const AccGroupInfo&) = delete;
77 AccGroupInfo& operator=(const AccGroupInfo&) = delete;
79 /**
80 * Return true if the given parent and child roles should have their node
81 * relations reported.
83 static bool ShouldReportRelations(a11y::role aRole, a11y::role aParentRole);
85 /**
86 * Return ARIA level value or the default one if ARIA is missed for the
87 * given accessible.
89 static int32_t GetARIAOrDefaultLevel(const Accessible* aAccessible);
91 uint32_t mPosInSet;
92 uint32_t mSetSize;
93 uint64_t mParentId;
94 const Accessible* mItem;
95 a11y::role mRole;
98 } // namespace a11y
99 } // namespace mozilla
101 #endif