accessible/src/base/Logging.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/src/base/Logging.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,197 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_a11y_logs_h__
    1.11 +#define mozilla_a11y_logs_h__
    1.12 +
    1.13 +#include "nscore.h"
    1.14 +#include "nsStringFwd.h"
    1.15 +
    1.16 +class nsIDocument;
    1.17 +class nsINode;
    1.18 +class nsIRequest;
    1.19 +class nsISelection;
    1.20 +class nsISupports;
    1.21 +class nsIWebProgress;
    1.22 +
    1.23 +namespace mozilla {
    1.24 +namespace a11y {
    1.25 +
    1.26 +class AccEvent;
    1.27 +class Accessible;
    1.28 +class DocAccessible;
    1.29 +class OuterDocAccessible;
    1.30 +
    1.31 +namespace logging {
    1.32 +
    1.33 +enum EModules {
    1.34 +  eDocLoad = 1 << 0,
    1.35 +  eDocCreate = 1 << 1,
    1.36 +  eDocDestroy = 1 << 2,
    1.37 +  eDocLifeCycle = eDocLoad | eDocCreate | eDocDestroy,
    1.38 +
    1.39 +  eEvents = 1 << 3,
    1.40 +  ePlatforms = 1 << 4,
    1.41 +  eStack = 1 << 5,
    1.42 +  eText = 1 << 6,
    1.43 +  eTree = 1 << 7,
    1.44 +
    1.45 +  eDOMEvents = 1 << 8,
    1.46 +  eFocus = 1 << 9,
    1.47 +  eSelection = 1 << 10,
    1.48 +  eNotifications = eDOMEvents | eSelection | eFocus
    1.49 +};
    1.50 +
    1.51 +/**
    1.52 + * Return true if any of the given modules is logged.
    1.53 + */
    1.54 +bool IsEnabled(uint32_t aModules);
    1.55 +
    1.56 +/**
    1.57 + * Return true if the given module is logged.
    1.58 + */
    1.59 +bool IsEnabled(const nsAString& aModules);
    1.60 +
    1.61 +/**
    1.62 + * Log the document loading progress.
    1.63 + */
    1.64 +void DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
    1.65 +             nsIRequest* aRequest, uint32_t aStateFlags);
    1.66 +void DocLoad(const char* aMsg, nsIDocument* aDocumentNode);
    1.67 +void DocCompleteLoad(DocAccessible* aDocument, bool aIsLoadEventTarget);
    1.68 +
    1.69 +/**
    1.70 + * Log that document load event was fired.
    1.71 + */
    1.72 +void DocLoadEventFired(AccEvent* aEvent);
    1.73 +
    1.74 +/**
    1.75 + * Log that document laod event was handled.
    1.76 + */
    1.77 +void DocLoadEventHandled(AccEvent* aEvent);
    1.78 +
    1.79 +/**
    1.80 + * Log the document was created.
    1.81 + */
    1.82 +void DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
    1.83 +               DocAccessible* aDocument = nullptr);
    1.84 +
    1.85 +/**
    1.86 + * Log the document was destroyed.
    1.87 + */
    1.88 +void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
    1.89 +                DocAccessible* aDocument = nullptr);
    1.90 +
    1.91 +/**
    1.92 + * Log the outer document was destroyed.
    1.93 + */
    1.94 +void OuterDocDestroy(OuterDocAccessible* OuterDoc);
    1.95 +
    1.96 +/**
    1.97 + * Log the focus notification target.
    1.98 + */
    1.99 +void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
   1.100 +                             Accessible* aTarget);
   1.101 +void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
   1.102 +                             nsINode* aTargetNode);
   1.103 +void FocusNotificationTarget(const char* aMsg, const char* aTargetDescr,
   1.104 +                             nsISupports* aTargetThing);
   1.105 +
   1.106 +/**
   1.107 + * Log a cause of active item descendant change (submessage).
   1.108 + */
   1.109 +void ActiveItemChangeCausedBy(const char* aMsg, Accessible* aTarget);
   1.110 +
   1.111 +/**
   1.112 + * Log the active widget (submessage).
   1.113 + */
   1.114 +void ActiveWidget(Accessible* aWidget);
   1.115 +
   1.116 +/**
   1.117 + * Log the focus event was dispatched (submessage).
   1.118 + */
   1.119 +void FocusDispatched(Accessible* aTarget);
   1.120 +
   1.121 +/**
   1.122 + * Log the selection change.
   1.123 + */
   1.124 +void SelChange(nsISelection* aSelection, DocAccessible* aDocument,
   1.125 +               int16_t aReason);
   1.126 +
   1.127 +/**
   1.128 + * Log the message ('title: text' format) on new line. Print the start and end
   1.129 + * boundaries of the message body designated by '{' and '}' (2 spaces indent for
   1.130 + * body).
   1.131 + */
   1.132 +void MsgBegin(const char* aTitle, const char* aMsgText, ...);
   1.133 +void MsgEnd();
   1.134 +
   1.135 +/**
   1.136 + * Print start and end boundaries of the message body designated by '{' and '}'
   1.137 + * (2 spaces indent for body).
   1.138 + */
   1.139 +void SubMsgBegin();
   1.140 +void SubMsgEnd();
   1.141 +
   1.142 +/**
   1.143 + * Log the entry into message body (4 spaces indent).
   1.144 + */
   1.145 +void MsgEntry(const char* aEntryText, ...);
   1.146 +
   1.147 +/**
   1.148 + * Log the text, two spaces offset is used.
   1.149 + */
   1.150 +void Text(const char* aText);
   1.151 +
   1.152 +/**
   1.153 + * Log the accessible object address as message entry (4 spaces indent).
   1.154 + */
   1.155 +void Address(const char* aDescr, Accessible* aAcc);
   1.156 +
   1.157 +/**
   1.158 + * Log the DOM node info as message entry.
   1.159 + */
   1.160 +void Node(const char* aDescr, nsINode* aNode);
   1.161 +
   1.162 +/**
   1.163 + * Log the document accessible info as message entry.
   1.164 + */
   1.165 +void Document(DocAccessible* aDocument);
   1.166 +
   1.167 +/**
   1.168 + * Log the accessible and its DOM node as a message entry.
   1.169 + */
   1.170 +void AccessibleNNode(const char* aDescr, Accessible* aAccessible);
   1.171 +void AccessibleNNode(const char* aDescr, nsINode* aNode);
   1.172 +
   1.173 +/**
   1.174 + * Log the DOM event.
   1.175 + */
   1.176 +void DOMEvent(const char* aDescr, nsINode* aOrigTarget,
   1.177 +              const nsAString& aEventType);
   1.178 +
   1.179 +/**
   1.180 + * Log the call stack, two spaces offset is used.
   1.181 + */
   1.182 +void Stack();
   1.183 +
   1.184 +/**
   1.185 + * Enable logging of the specified modules, all other modules aren't logged.
   1.186 + */
   1.187 +void Enable(const nsAFlatCString& aModules);
   1.188 +
   1.189 +/**
   1.190 + * Enable logging of modules specified by A11YLOG environment variable,
   1.191 + * all other modules aren't logged.
   1.192 + */
   1.193 +void CheckEnv();
   1.194 +
   1.195 +} // namespace logs
   1.196 +} // namespace a11y
   1.197 +} // namespace mozilla
   1.198 +
   1.199 +#endif
   1.200 +

mercurial