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 mozilla_a11y_EmbeddedObjCollector_h__
6 #define mozilla_a11y_EmbeddedObjCollector_h__
13 class LocalAccessible
;
16 * Collect embedded objects. Provide quick access to accessible by index and
19 class EmbeddedObjCollector final
{
21 ~EmbeddedObjCollector() {}
24 * Return index of the given accessible within the collection.
26 int32_t GetIndexAt(LocalAccessible
* aAccessible
);
29 * Return accessible count within the collection.
34 * Return an accessible from the collection at the given index.
36 LocalAccessible
* GetAccessibleAt(uint32_t aIndex
);
40 * Ensure accessible at the given index is stored and return it.
42 LocalAccessible
* EnsureNGetObject(uint32_t aIndex
);
45 * Ensure index for the given accessible is stored and return it.
47 int32_t EnsureNGetIndex(LocalAccessible
* aAccessible
);
49 // Make sure it's used by LocalAccessible class only.
50 explicit EmbeddedObjCollector(LocalAccessible
* aRoot
)
51 : mRoot(aRoot
), mRootChildIdx(0) {}
54 * Append the object to collection.
56 void AppendObject(LocalAccessible
* aAccessible
);
58 friend class LocalAccessible
;
60 LocalAccessible
* mRoot
;
61 uint32_t mRootChildIdx
;
62 nsTArray
<LocalAccessible
*> mObjects
;
66 } // namespace mozilla