michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_a11y_logs_h__ michael@0: #define mozilla_a11y_logs_h__ michael@0: michael@0: #include "nscore.h" michael@0: #include "nsStringFwd.h" michael@0: michael@0: class nsIDocument; michael@0: class nsINode; michael@0: class nsIRequest; michael@0: class nsISelection; michael@0: class nsISupports; michael@0: class nsIWebProgress; michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: class AccEvent; michael@0: class Accessible; michael@0: class DocAccessible; michael@0: class OuterDocAccessible; michael@0: michael@0: namespace logging { michael@0: michael@0: enum EModules { michael@0: eDocLoad = 1 << 0, michael@0: eDocCreate = 1 << 1, michael@0: eDocDestroy = 1 << 2, michael@0: eDocLifeCycle = eDocLoad | eDocCreate | eDocDestroy, michael@0: michael@0: eEvents = 1 << 3, michael@0: ePlatforms = 1 << 4, michael@0: eStack = 1 << 5, michael@0: eText = 1 << 6, michael@0: eTree = 1 << 7, michael@0: michael@0: eDOMEvents = 1 << 8, michael@0: eFocus = 1 << 9, michael@0: eSelection = 1 << 10, michael@0: eNotifications = eDOMEvents | eSelection | eFocus michael@0: }; michael@0: michael@0: /** michael@0: * Return true if any of the given modules is logged. michael@0: */ michael@0: bool IsEnabled(uint32_t aModules); michael@0: michael@0: /** michael@0: * Return true if the given module is logged. michael@0: */ michael@0: bool IsEnabled(const nsAString& aModules); michael@0: michael@0: /** michael@0: * Log the document loading progress. michael@0: */ michael@0: void DocLoad(const char* aMsg, nsIWebProgress* aWebProgress, michael@0: nsIRequest* aRequest, uint32_t aStateFlags); michael@0: void DocLoad(const char* aMsg, nsIDocument* aDocumentNode); michael@0: void DocCompleteLoad(DocAccessible* aDocument, bool aIsLoadEventTarget); michael@0: michael@0: /** michael@0: * Log that document load event was fired. michael@0: */ michael@0: void DocLoadEventFired(AccEvent* aEvent); michael@0: michael@0: /** michael@0: * Log that document laod event was handled. michael@0: */ michael@0: void DocLoadEventHandled(AccEvent* aEvent); michael@0: michael@0: /** michael@0: * Log the document was created. michael@0: */ michael@0: void DocCreate(const char* aMsg, nsIDocument* aDocumentNode, michael@0: DocAccessible* aDocument = nullptr); michael@0: michael@0: /** michael@0: * Log the document was destroyed. michael@0: */ michael@0: void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode, michael@0: DocAccessible* aDocument = nullptr); michael@0: michael@0: /** michael@0: * Log the outer document was destroyed. michael@0: */ michael@0: void OuterDocDestroy(OuterDocAccessible* OuterDoc); michael@0: michael@0: /** michael@0: * Log the focus notification target. michael@0: */ michael@0: void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, michael@0: Accessible* aTarget); michael@0: void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, michael@0: nsINode* aTargetNode); michael@0: void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, michael@0: nsISupports* aTargetThing); michael@0: michael@0: /** michael@0: * Log a cause of active item descendant change (submessage). michael@0: */ michael@0: void ActiveItemChangeCausedBy(const char* aMsg, Accessible* aTarget); michael@0: michael@0: /** michael@0: * Log the active widget (submessage). michael@0: */ michael@0: void ActiveWidget(Accessible* aWidget); michael@0: michael@0: /** michael@0: * Log the focus event was dispatched (submessage). michael@0: */ michael@0: void FocusDispatched(Accessible* aTarget); michael@0: michael@0: /** michael@0: * Log the selection change. michael@0: */ michael@0: void SelChange(nsISelection* aSelection, DocAccessible* aDocument, michael@0: int16_t aReason); michael@0: michael@0: /** michael@0: * Log the message ('title: text' format) on new line. Print the start and end michael@0: * boundaries of the message body designated by '{' and '}' (2 spaces indent for michael@0: * body). michael@0: */ michael@0: void MsgBegin(const char* aTitle, const char* aMsgText, ...); michael@0: void MsgEnd(); michael@0: michael@0: /** michael@0: * Print start and end boundaries of the message body designated by '{' and '}' michael@0: * (2 spaces indent for body). michael@0: */ michael@0: void SubMsgBegin(); michael@0: void SubMsgEnd(); michael@0: michael@0: /** michael@0: * Log the entry into message body (4 spaces indent). michael@0: */ michael@0: void MsgEntry(const char* aEntryText, ...); michael@0: michael@0: /** michael@0: * Log the text, two spaces offset is used. michael@0: */ michael@0: void Text(const char* aText); michael@0: michael@0: /** michael@0: * Log the accessible object address as message entry (4 spaces indent). michael@0: */ michael@0: void Address(const char* aDescr, Accessible* aAcc); michael@0: michael@0: /** michael@0: * Log the DOM node info as message entry. michael@0: */ michael@0: void Node(const char* aDescr, nsINode* aNode); michael@0: michael@0: /** michael@0: * Log the document accessible info as message entry. michael@0: */ michael@0: void Document(DocAccessible* aDocument); michael@0: michael@0: /** michael@0: * Log the accessible and its DOM node as a message entry. michael@0: */ michael@0: void AccessibleNNode(const char* aDescr, Accessible* aAccessible); michael@0: void AccessibleNNode(const char* aDescr, nsINode* aNode); michael@0: michael@0: /** michael@0: * Log the DOM event. michael@0: */ michael@0: void DOMEvent(const char* aDescr, nsINode* aOrigTarget, michael@0: const nsAString& aEventType); michael@0: michael@0: /** michael@0: * Log the call stack, two spaces offset is used. michael@0: */ michael@0: void Stack(); michael@0: michael@0: /** michael@0: * Enable logging of the specified modules, all other modules aren't logged. michael@0: */ michael@0: void Enable(const nsAFlatCString& aModules); michael@0: michael@0: /** michael@0: * Enable logging of modules specified by A11YLOG environment variable, michael@0: * all other modules aren't logged. michael@0: */ michael@0: void CheckEnv(); michael@0: michael@0: } // namespace logs michael@0: } // namespace a11y michael@0: } // namespace mozilla michael@0: michael@0: #endif michael@0: