Bug 881092 - Allow decoding files we know we can't play, in the context of WebAudio...
[gecko.git] / accessible / src / base / Logging.h
blob288d8bc394aa6023e7cac31002a78d496656b1ea
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 "nsAString.h"
13 class nsIDocument;
14 class nsINode;
15 class nsIRequest;
16 class nsISelection;
17 class nsIWebProgress;
19 namespace mozilla {
20 namespace a11y {
22 class AccEvent;
23 class Accessible;
24 class DocAccessible;
25 class OuterDocAccessible;
27 namespace logging {
29 enum EModules {
30 eDocLoad = 1 << 0,
31 eDocCreate = 1 << 1,
32 eDocDestroy = 1 << 2,
33 eDocLifeCycle = eDocLoad | eDocCreate | eDocDestroy,
35 eEvents = 1 << 3,
36 ePlatforms = 1 << 4,
37 eStack = 1 << 5,
38 eText = 1 << 6,
39 eTree = 1 << 7,
41 eDOMEvents = 1 << 8,
42 eFocus = 1 << 9,
43 eSelection = 1 << 10,
44 eNotifications = eDOMEvents | eSelection | eFocus
47 /**
48 * Return true if any of the given modules is logged.
50 bool IsEnabled(uint32_t aModules);
52 /**
53 * Return true if the given module is logged.
55 bool IsEnabled(const nsAString& aModules);
57 /**
58 * Log the document loading progress.
60 void DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
61 nsIRequest* aRequest, uint32_t aStateFlags);
62 void DocLoad(const char* aMsg, nsIDocument* aDocumentNode);
63 void DocCompleteLoad(DocAccessible* aDocument, bool aIsLoadEventTarget);
65 /**
66 * Log that document load event was fired.
68 void DocLoadEventFired(AccEvent* aEvent);
70 /**
71 * Log that document laod event was handled.
73 void DocLoadEventHandled(AccEvent* aEvent);
75 /**
76 * Log the document was created.
78 void DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
79 DocAccessible* aDocument = nullptr);
81 /**
82 * Log the document was destroyed.
84 void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
85 DocAccessible* aDocument = nullptr);
87 /**
88 * Log the outer document was destroyed.
90 void OuterDocDestroy(OuterDocAccessible* OuterDoc);
92 /**
93 * Log the focus notification target.
95 void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
96 Accessible* aTarget);
97 void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
98 nsINode* aTargetNode);
99 void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
100 nsISupports* aTargetThing);
103 * Log a cause of active item descendant change (submessage).
105 void ActiveItemChangeCausedBy(const char* aMsg, Accessible* aTarget);
108 * Log the active widget (submessage).
110 void ActiveWidget(Accessible* aWidget);
113 * Log the focus event was dispatched (submessage).
115 void FocusDispatched(Accessible* aTarget);
118 * Log the selection change.
120 void SelChange(nsISelection* aSelection, DocAccessible* aDocument);
123 * Log the message ('title: text' format) on new line. Print the start and end
124 * boundaries of the message body designated by '{' and '}' (2 spaces indent for
125 * body).
127 void MsgBegin(const char* aTitle, const char* aMsgText, ...);
128 void MsgEnd();
131 * Print start and end boundaries of the message body designated by '{' and '}'
132 * (2 spaces indent for body).
134 void SubMsgBegin();
135 void SubMsgEnd();
138 * Log the entry into message body (4 spaces indent).
140 void MsgEntry(const char* aEntryText, ...);
143 * Log the text, two spaces offset is used.
145 void Text(const char* aText);
148 * Log the accessible object address as message entry (4 spaces indent).
150 void Address(const char* aDescr, Accessible* aAcc);
153 * Log the DOM node info as message entry.
155 void Node(const char* aDescr, nsINode* aNode);
158 * Log the document accessible info as message entry.
160 void Document(DocAccessible* aDocument);
163 * Log the accessible and its DOM node as a message entry.
165 void AccessibleNNode(const char* aDescr, Accessible* aAccessible);
166 void AccessibleNNode(const char* aDescr, nsINode* aNode);
169 * Log the DOM event.
171 void DOMEvent(const char* aDescr, nsINode* aOrigTarget,
172 const nsAString& aEventType);
175 * Log the call stack, two spaces offset is used.
177 void Stack();
180 * Enable logging of the specified modules, all other modules aren't logged.
182 void Enable(const nsAFlatCString& aModules);
185 * Enable logging of modules specified by A11YLOG environment variable,
186 * all other modules aren't logged.
188 void CheckEnv();
190 } // namespace logs
191 } // namespace a11y
192 } // namespace mozilla
194 #endif