accessible/src/base/Logging.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial