Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_a11y_logs_h__
8 #define mozilla_a11y_logs_h__
10 #include "nscore.h"
11 #include "nsStringFwd.h"
13 class nsIDocument;
14 class nsINode;
15 class nsIRequest;
16 class nsISelection;
17 class nsISupports;
18 class nsIWebProgress;
20 namespace mozilla {
21 namespace a11y {
23 class AccEvent;
24 class Accessible;
25 class DocAccessible;
26 class OuterDocAccessible;
28 namespace logging {
30 enum EModules {
31 eDocLoad = 1 << 0,
32 eDocCreate = 1 << 1,
33 eDocDestroy = 1 << 2,
34 eDocLifeCycle = eDocLoad | eDocCreate | eDocDestroy,
36 eEvents = 1 << 3,
37 ePlatforms = 1 << 4,
38 eStack = 1 << 5,
39 eText = 1 << 6,
40 eTree = 1 << 7,
42 eDOMEvents = 1 << 8,
43 eFocus = 1 << 9,
44 eSelection = 1 << 10,
45 eNotifications = eDOMEvents | eSelection | eFocus
46 };
48 /**
49 * Return true if any of the given modules is logged.
50 */
51 bool IsEnabled(uint32_t aModules);
53 /**
54 * Return true if the given module is logged.
55 */
56 bool IsEnabled(const nsAString& aModules);
58 /**
59 * Log the document loading progress.
60 */
61 void DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
62 nsIRequest* aRequest, uint32_t aStateFlags);
63 void DocLoad(const char* aMsg, nsIDocument* aDocumentNode);
64 void DocCompleteLoad(DocAccessible* aDocument, bool aIsLoadEventTarget);
66 /**
67 * Log that document load event was fired.
68 */
69 void DocLoadEventFired(AccEvent* aEvent);
71 /**
72 * Log that document laod event was handled.
73 */
74 void DocLoadEventHandled(AccEvent* aEvent);
76 /**
77 * Log the document was created.
78 */
79 void DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
80 DocAccessible* aDocument = nullptr);
82 /**
83 * Log the document was destroyed.
84 */
85 void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
86 DocAccessible* aDocument = nullptr);
88 /**
89 * Log the outer document was destroyed.
90 */
91 void OuterDocDestroy(OuterDocAccessible* OuterDoc);
93 /**
94 * Log the focus notification target.
95 */
96 void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
97 Accessible* aTarget);
98 void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
99 nsINode* aTargetNode);
100 void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
101 nsISupports* aTargetThing);
103 /**
104 * Log a cause of active item descendant change (submessage).
105 */
106 void ActiveItemChangeCausedBy(const char* aMsg, Accessible* aTarget);
108 /**
109 * Log the active widget (submessage).
110 */
111 void ActiveWidget(Accessible* aWidget);
113 /**
114 * Log the focus event was dispatched (submessage).
115 */
116 void FocusDispatched(Accessible* aTarget);
118 /**
119 * Log the selection change.
120 */
121 void SelChange(nsISelection* aSelection, DocAccessible* aDocument,
122 int16_t aReason);
124 /**
125 * Log the message ('title: text' format) on new line. Print the start and end
126 * boundaries of the message body designated by '{' and '}' (2 spaces indent for
127 * body).
128 */
129 void MsgBegin(const char* aTitle, const char* aMsgText, ...);
130 void MsgEnd();
132 /**
133 * Print start and end boundaries of the message body designated by '{' and '}'
134 * (2 spaces indent for body).
135 */
136 void SubMsgBegin();
137 void SubMsgEnd();
139 /**
140 * Log the entry into message body (4 spaces indent).
141 */
142 void MsgEntry(const char* aEntryText, ...);
144 /**
145 * Log the text, two spaces offset is used.
146 */
147 void Text(const char* aText);
149 /**
150 * Log the accessible object address as message entry (4 spaces indent).
151 */
152 void Address(const char* aDescr, Accessible* aAcc);
154 /**
155 * Log the DOM node info as message entry.
156 */
157 void Node(const char* aDescr, nsINode* aNode);
159 /**
160 * Log the document accessible info as message entry.
161 */
162 void Document(DocAccessible* aDocument);
164 /**
165 * Log the accessible and its DOM node as a message entry.
166 */
167 void AccessibleNNode(const char* aDescr, Accessible* aAccessible);
168 void AccessibleNNode(const char* aDescr, nsINode* aNode);
170 /**
171 * Log the DOM event.
172 */
173 void DOMEvent(const char* aDescr, nsINode* aOrigTarget,
174 const nsAString& aEventType);
176 /**
177 * Log the call stack, two spaces offset is used.
178 */
179 void Stack();
181 /**
182 * Enable logging of the specified modules, all other modules aren't logged.
183 */
184 void Enable(const nsAFlatCString& aModules);
186 /**
187 * Enable logging of modules specified by A11YLOG environment variable,
188 * all other modules aren't logged.
189 */
190 void CheckEnv();
192 } // namespace logs
193 } // namespace a11y
194 } // namespace mozilla
196 #endif