Bug 1883888 [wpt PR 44943] - Name unhandledrejection event correctly, a=testonly
[gecko.git] / accessible / base / EventTree.h
blobbd9976b4fbe70f785e6779ff45d7bbe8749fcb20
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_a11y_EventTree_h_
7 #define mozilla_a11y_EventTree_h_
9 #include "AccEvent.h"
10 #include "LocalAccessible.h"
12 #include "mozilla/a11y/DocAccessible.h"
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/UniquePtr.h"
16 namespace mozilla {
17 namespace a11y {
19 class NotificationController;
21 /**
22 * This class makes sure required tasks are done before and after tree
23 * mutations. Currently this only includes group info invalidation. You must
24 * have an object of this class on the stack when calling methods that mutate
25 * the accessible tree.
27 class TreeMutation final {
28 public:
29 static const bool kNoEvents = true;
30 static const bool kNoShutdown = true;
32 explicit TreeMutation(LocalAccessible* aParent, bool aNoEvents = false);
33 ~TreeMutation();
35 void AfterInsertion(LocalAccessible* aChild);
36 void BeforeRemoval(LocalAccessible* aChild, bool aNoShutdown = false);
37 void Done();
39 private:
40 NotificationController* Controller() const {
41 return mParent->Document()->Controller();
44 LocalAccessible* mParent;
45 uint32_t mStartIdx;
46 uint32_t mStateFlagsCopy;
49 * True if mutation events should be queued.
51 bool mQueueEvents;
53 #ifdef DEBUG
54 bool mIsDone;
55 #endif
58 } // namespace a11y
59 } // namespace mozilla
61 #endif // mozilla_a11y_EventQueue_h_