Bumping manifests a=b2g-bump
[gecko.git] / accessible / base / EventQueue.h
bloba5457d5b0a5fc657a054f31c5db6b5ab4e826205
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
21 protected:
22 EventQueue(DocAccessible* aDocument) : mDocument(aDocument) { }
24 /**
25 * Put an accessible event into the queue to process it later.
27 bool PushEvent(AccEvent* aEvent);
29 /**
30 * Process events from the queue and fires events.
32 void ProcessEventQueue();
34 private:
35 EventQueue(const EventQueue&) MOZ_DELETE;
36 EventQueue& operator = (const EventQueue&) MOZ_DELETE;
38 // Event queue processing
39 /**
40 * Coalesce redundant events from the queue.
42 void CoalesceEvents();
44 /**
45 * Coalesce events from the same subtree.
47 void CoalesceReorderEvents(AccEvent* aTailEvent);
49 /**
50 * Coalesce two selection change events within the same select control.
52 void CoalesceSelChangeEvents(AccSelChangeEvent* aTailEvent,
53 AccSelChangeEvent* aThisEvent,
54 uint32_t aThisIndex);
56 /**
57 * Coalesce text change events caused by sibling hide events.
59 void CoalesceTextChangeEventsFor(AccHideEvent* aTailEvent,
60 AccHideEvent* aThisEvent);
61 void CoalesceTextChangeEventsFor(AccShowEvent* aTailEvent,
62 AccShowEvent* aThisEvent);
64 /**
65 * Create text change event caused by hide or show event. When a node is
66 * hidden/removed or shown/appended, the text in an ancestor hyper text will
67 * lose or get new characters.
69 void CreateTextChangeEventFor(AccMutationEvent* aEvent);
71 protected:
73 /**
74 * The document accessible reference owning this queue.
76 DocAccessible* mDocument;
78 /**
79 * Pending events array. Don't make this an nsAutoTArray; we use
80 * SwapElements() on it.
82 nsTArray<nsRefPtr<AccEvent> > mEvents;
85 } // namespace a11y
86 } // namespace mozilla
88 #endif // mozilla_a11y_EventQueue_h_