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_
10 #include "mozilla/Assertions.h"
18 * Used to organize and coalesce pending events.
22 explicit EventQueue(DocAccessible
* aDocument
) : mDocument(aDocument
) {
24 "There's no point creating an event queue for a null document");
28 * Put an accessible event into the queue to process it later.
30 bool PushEvent(AccEvent
* aEvent
);
33 * Puts name and/or description change events into the queue, if needed.
35 bool PushNameOrDescriptionChange(AccEvent
* aOrigEvent
);
38 * Process events from the queue and fires events.
40 void ProcessEventQueue();
43 EventQueue(const EventQueue
&) = delete;
44 EventQueue
& operator=(const EventQueue
&) = delete;
46 // Event queue processing
48 * Coalesce redundant events from the queue.
50 void CoalesceEvents();
53 * Coalesce events from the same subtree.
55 void CoalesceReorderEvents(AccEvent
* aTailEvent
);
58 * Coalesce two selection change events within the same select control.
60 void CoalesceSelChangeEvents(AccSelChangeEvent
* aTailEvent
,
61 AccSelChangeEvent
* aThisEvent
,
66 * The document accessible reference owning this queue.
68 DocAccessible
* mDocument
;
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
;
81 } // namespace mozilla
83 #endif // mozilla_a11y_EventQueue_h_