no bug - Correct some typos in the comments. a=typo-fix
[gecko.git] / accessible / base / EventQueue.h
blob87bcf89340661df9961cfe8e73d56963a7baba60
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_EventQueue_h_
7 #define mozilla_a11y_EventQueue_h_
9 #include "AccEvent.h"
10 #include "mozilla/Assertions.h"
12 namespace mozilla {
13 namespace a11y {
15 class DocAccessible;
17 /**
18 * Used to organize and coalesce pending events.
20 class EventQueue {
21 protected:
22 explicit EventQueue(DocAccessible* aDocument) : mDocument(aDocument) {
23 MOZ_ASSERT(mDocument,
24 "There's no point creating an event queue for a null document");
27 /**
28 * Put an accessible event into the queue to process it later.
30 bool PushEvent(AccEvent* aEvent);
32 /**
33 * Puts name and/or description change events into the queue, if needed.
35 bool PushNameOrDescriptionChange(AccEvent* aOrigEvent);
37 /**
38 * Process events from the queue and fires events.
40 void ProcessEventQueue();
42 private:
43 EventQueue(const EventQueue&) = delete;
44 EventQueue& operator=(const EventQueue&) = delete;
46 // Event queue processing
47 /**
48 * Coalesce redundant events from the queue.
50 void CoalesceEvents();
52 /**
53 * Coalesce events from the same subtree.
55 void CoalesceReorderEvents(AccEvent* aTailEvent);
57 /**
58 * Coalesce two selection change events within the same select control.
60 void CoalesceSelChangeEvents(AccSelChangeEvent* aTailEvent,
61 AccSelChangeEvent* aThisEvent,
62 uint32_t aThisIndex);
64 protected:
65 /**
66 * The document accessible reference owning this queue.
68 DocAccessible* mDocument;
70 /**
71 * Pending events array. Don't make this an AutoTArray; we use
72 * SwapElements() on it.
74 nsTArray<RefPtr<AccEvent>> mEvents;
76 // Pending focus event.
77 RefPtr<AccEvent> mFocusEvent;
80 } // namespace a11y
81 } // namespace mozilla
83 #endif // mozilla_a11y_EventQueue_h_