Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/accessible/base/EventQueue.h
Line
Count
Source (jump to first uncovered line)
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/. */
5
6
#ifndef mozilla_a11y_EventQueue_h_
7
#define mozilla_a11y_EventQueue_h_
8
9
#include "AccEvent.h"
10
11
namespace mozilla {
12
namespace a11y {
13
14
class DocAccessible;
15
16
/**
17
 * Used to organize and coalesce pending events.
18
 */
19
class EventQueue
20
{
21
protected:
22
0
  explicit EventQueue(DocAccessible* aDocument) : mDocument(aDocument) { }
23
24
  /**
25
   * Put an accessible event into the queue to process it later.
26
   */
27
  bool PushEvent(AccEvent* aEvent);
28
29
  /**
30
   * Puts a name change event into the queue, if needed.
31
   */
32
  bool PushNameChange(Accessible* aTarget);
33
34
  /**
35
   * Process events from the queue and fires events.
36
   */
37
  void ProcessEventQueue();
38
39
private:
40
  EventQueue(const EventQueue&) = delete;
41
  EventQueue& operator = (const EventQueue&) = delete;
42
43
  // Event queue processing
44
  /**
45
   * Coalesce redundant events from the queue.
46
   */
47
  void CoalesceEvents();
48
49
  /**
50
   * Coalesce events from the same subtree.
51
   */
52
  void CoalesceReorderEvents(AccEvent* aTailEvent);
53
54
  /**
55
   * Coalesce two selection change events within the same select control.
56
   */
57
  void CoalesceSelChangeEvents(AccSelChangeEvent* aTailEvent,
58
                               AccSelChangeEvent* aThisEvent,
59
                               uint32_t aThisIndex);
60
61
protected:
62
  /**
63
   * The document accessible reference owning this queue.
64
   */
65
  DocAccessible* mDocument;
66
67
  /**
68
   * Pending events array. Don't make this an AutoTArray; we use
69
   * SwapElements() on it.
70
   */
71
  nsTArray<RefPtr<AccEvent>> mEvents;
72
};
73
74
} // namespace a11y
75
} // namespace mozilla
76
77
#endif // mozilla_a11y_EventQueue_h_