Bug 1687263: part 4) Defer and in some cases avoid removing spellchecking-ranges...
[gecko.git] / accessible / base / EventQueue.h
blobe8a5d210a92a706c93f61fbe569665ae04d19a2e
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"
11 namespace mozilla {
12 namespace a11y {
14 class DocAccessible;
16 /**
17 * Used to organize and coalesce pending events.
19 class EventQueue {
20 protected:
21 explicit EventQueue(DocAccessible* aDocument) : mDocument(aDocument) {}
23 /**
24 * Put an accessible event into the queue to process it later.
26 bool PushEvent(AccEvent* aEvent);
28 /**
29 * Puts name and/or description change events into the queue, if needed.
31 bool PushNameOrDescriptionChange(LocalAccessible* aTarget);
33 /**
34 * Process events from the queue and fires events.
36 void ProcessEventQueue();
38 private:
39 EventQueue(const EventQueue&) = delete;
40 EventQueue& operator=(const EventQueue&) = delete;
42 // Event queue processing
43 /**
44 * Coalesce redundant events from the queue.
46 void CoalesceEvents();
48 /**
49 * Coalesce events from the same subtree.
51 void CoalesceReorderEvents(AccEvent* aTailEvent);
53 /**
54 * Coalesce two selection change events within the same select control.
56 void CoalesceSelChangeEvents(AccSelChangeEvent* aTailEvent,
57 AccSelChangeEvent* aThisEvent,
58 uint32_t aThisIndex);
60 protected:
61 /**
62 * The document accessible reference owning this queue.
64 DocAccessible* mDocument;
66 /**
67 * Pending events array. Don't make this an AutoTArray; we use
68 * SwapElements() on it.
70 nsTArray<RefPtr<AccEvent>> mEvents;
73 } // namespace a11y
74 } // namespace mozilla
76 #endif // mozilla_a11y_EventQueue_h_