Bug 812466 - namespacify Accessible classes, r=tbsaunde
authorAlexander Surkov <surkov.alexander@gmail.com>
Sun, 18 Nov 2012 11:01:44 +0900
changeset 121571 5cb2cc9be615d66b1eb96843a4c8c45b9b60e29d
parent 121570 571ae303c8dc7bb364dfc481b319752a22cd6a5f
child 121572 9698b66d6b3cb5313dd5cf6acf24134be71f0aae
push id1997
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 21:25:26 +0000
treeherdermozilla-beta@4baf45cdcf21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs812466
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 812466 - namespacify Accessible classes, r=tbsaunde
accessible/public/nsIAccessibilityService.h
accessible/src/atk/AccessibleWrap.h
accessible/src/atk/AtkSocketAccessible.cpp
accessible/src/atk/AtkSocketAccessible.h
accessible/src/atk/DocAccessibleWrap.cpp
accessible/src/atk/DocAccessibleWrap.h
accessible/src/atk/HyperTextAccessibleWrap.h
accessible/src/atk/InterfaceInitFuncs.h
accessible/src/atk/nsAccessNodeWrap.cpp
accessible/src/atk/nsAccessNodeWrap.h
accessible/src/atk/nsMai.h
accessible/src/atk/nsMaiHyperlink.cpp
accessible/src/atk/nsMaiHyperlink.h
accessible/src/atk/nsMaiInterfaceComponent.cpp
accessible/src/atk/nsMaiInterfaceDocument.cpp
accessible/src/atk/nsMaiInterfaceEditableText.cpp
accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
accessible/src/atk/nsMaiInterfaceHypertext.cpp
accessible/src/atk/nsMaiInterfaceSelection.cpp
accessible/src/atk/nsMaiInterfaceValue.cpp
accessible/src/base/AccCollector.h
accessible/src/base/AccEvent.h
accessible/src/base/AccGroupInfo.h
accessible/src/base/AccIterator.h
accessible/src/base/Filters.h
accessible/src/base/FocusManager.h
accessible/src/base/Logging.h
accessible/src/base/NotificationController.h
accessible/src/base/TextAttrs.h
accessible/src/base/nsAccCache.h
accessible/src/base/nsAccDocManager.h
accessible/src/base/nsAccTreeWalker.cpp
accessible/src/base/nsAccTreeWalker.h
accessible/src/base/nsAccUtils.h
accessible/src/base/nsAccessNode.h
accessible/src/base/nsAccessiblePivot.h
accessible/src/base/nsCaretAccessible.h
accessible/src/base/nsEventShell.cpp
accessible/src/base/nsEventShell.h
accessible/src/base/nsTextEquivUtils.h
accessible/src/generic/ARIAGridAccessible-inl.h
accessible/src/generic/Accessible-inl.h
accessible/src/generic/Accessible.h
accessible/src/generic/DocAccessible-inl.h
accessible/src/generic/DocAccessible.h
accessible/src/generic/HyperTextAccessible.h
accessible/src/generic/ImageAccessible.h
accessible/src/generic/RootAccessible.h
accessible/src/generic/TableAccessible.h
accessible/src/generic/TableCellAccessible.h
accessible/src/generic/TextLeafAccessible.h
accessible/src/html/HTMLImageMapAccessible.h
accessible/src/html/HTMLListAccessible.h
accessible/src/mac/AccessibleWrap.h
accessible/src/mac/DocAccessibleWrap.h
accessible/src/mac/DocAccessibleWrap.mm
accessible/src/mac/HyperTextAccessibleWrap.h
accessible/src/mac/mozAccessible.h
accessible/src/mac/mozTextAccessible.h
accessible/src/mac/nsAccessNodeWrap.h
accessible/src/mac/nsAccessNodeWrap.mm
accessible/src/msaa/AccessibleWrap.h
accessible/src/msaa/Compatibility.h
accessible/src/msaa/DocAccessibleWrap.h
accessible/src/msaa/HyperTextAccessibleWrap.cpp
accessible/src/msaa/HyperTextAccessibleWrap.h
accessible/src/msaa/nsAccessNodeWrap.h
accessible/src/other/AccessibleWrap.cpp
accessible/src/other/AccessibleWrap.h
accessible/src/other/DocAccessibleWrap.h
accessible/src/other/HyperTextAccessibleWrap.h
accessible/src/other/nsAccessNodeWrap.cpp
accessible/src/other/nsAccessNodeWrap.h
accessible/src/windows/ia2/ia2AccessibleAction.cpp
accessible/src/windows/ia2/ia2AccessibleEditableText.cpp
accessible/src/windows/ia2/ia2AccessibleHyperlink.cpp
accessible/src/windows/ia2/ia2AccessibleHypertext.cpp
accessible/src/windows/ia2/ia2AccessibleTableCell.cpp
accessible/src/windows/ia2/ia2AccessibleText.cpp
accessible/src/windows/ia2/ia2AccessibleValue.cpp
accessible/src/windows/uia/uiaRawElmProvider.h
accessible/src/xpcom/nsAccEvent.cpp
accessible/src/xpcom/nsAccEvent.h
accessible/src/xpcom/xpcAccessibleTable.cpp
accessible/src/xpcom/xpcAccessibleTable.h
accessible/src/xpcom/xpcAccessibleTableCell.h
accessible/src/xul/XULTreeAccessible.h
layout/base/nsIPresShell.h
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/xpwidgets/nsBaseWidget.cpp
widget/xpwidgets/nsBaseWidget.h
--- a/accessible/public/nsIAccessibilityService.h
+++ b/accessible/public/nsIAccessibilityService.h
@@ -7,17 +7,24 @@
 #ifndef _nsIAccessibilityService_h_
 #define _nsIAccessibilityService_h_
 
 #include "nsIAccessibleRetrieval.h"
 #include "nsIAccessibleEvent.h"
 
 #include "nsAutoPtr.h"
 
+namespace mozilla {
+namespace a11y {
+
 class Accessible;
+
+} // namespace a11y
+} // namespace mozilla
+
 class nsINode;
 class nsIContent;
 class nsIFrame;
 class nsIPresShell;
 class nsObjectFrame;
 
 // 10ff6dca-b219-4b64-9a4c-67a62b86edce
 #define NS_IACCESSIBILITYSERVICE_IID \
@@ -32,33 +39,36 @@ public:
   /**
    * Return root document accessible that is or contains a document accessible
    * for the given presshell.
    *
    * @param aPresShell  [in] the presshell
    * @param aCanCreate  [in] points whether the root document accessible
    *                        should be returned from the cache or can be created
    */
-  virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
-                                                bool aCanCreate) = 0;
+  virtual mozilla::a11y::Accessible*
+    GetRootDocumentAccessible(nsIPresShell* aPresShell, bool aCanCreate) = 0;
 
    /**
    * Adds/remove ATK root accessible for gtk+ native window to/from children
    * of the application accessible.
    */
-  virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible) = 0;
-  virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible) = 0;
+  virtual mozilla::a11y::Accessible*
+    AddNativeRootAccessible(void* aAtkAccessible) = 0;
+  virtual void
+    RemoveNativeRootAccessible(mozilla::a11y::Accessible* aRootAccessible) = 0;
 
   /**
    * Fire accessible event of the given type for the given target.
    *
    * @param aEvent   [in] accessible event type
    * @param aTarget  [in] target of accessible event
    */
-  virtual void FireAccessibleEvent(uint32_t aEvent, Accessible* aTarget) = 0;
+  virtual void FireAccessibleEvent(uint32_t aEvent,
+                                   mozilla::a11y::Accessible* aTarget) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIAccessibilityService,
                               NS_IACCESSIBILITYSERVICE_IID)
 
 // for component registration
 // {DE401C37-9A7F-4278-A6F8-3DE2833989EF}
 #define NS_ACCESSIBILITY_SERVICE_CID \
--- a/accessible/src/atk/AccessibleWrap.h
+++ b/accessible/src/atk/AccessibleWrap.h
@@ -36,16 +36,19 @@ enum AtkProperty {
 };
 
 struct AtkPropertyChange {
   int32_t type;     // property type as listed above
   void *oldvalue;
   void *newvalue;
 };
 
+namespace mozilla {
+namespace a11y {
+
 class MaiHyperlink;
 
 /**
  * AccessibleWrap, and its descendents in atk directory provide the
  * implementation of AtkObject.
  */
 class AccessibleWrap : public Accessible
 {
@@ -105,9 +108,12 @@ private:
     eNoNewAtkSignals
   };
 
   static EAvailableAtkSignals gAvailableAtkSignals;
 
   uint16_t CreateMaiInterfaces(void);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif /* __NS_ACCESSIBLE_WRAP_H__ */
--- a/accessible/src/atk/AtkSocketAccessible.cpp
+++ b/accessible/src/atk/AtkSocketAccessible.cpp
@@ -6,16 +6,18 @@
 
 #include <atk/atk.h>
 #include "AtkSocketAccessible.h"
 
 #include "InterfaceInitFuncs.h"
 #include "nsMai.h"
 #include "mozilla/Likely.h"
 
+using namespace mozilla::a11y;
+
 AtkSocketEmbedType AtkSocketAccessible::g_atk_socket_embed = NULL;
 GType AtkSocketAccessible::g_atk_socket_type = G_TYPE_INVALID;
 const char* AtkSocketAccessible::sATKSocketEmbedSymbol = "atk_socket_embed";
 const char* AtkSocketAccessible::sATKSocketGetTypeSymbol = "atk_socket_get_type";
 
 bool AtkSocketAccessible::gCanEmbed = FALSE;
 
 extern "C" void mai_atk_component_iface_init(AtkComponentIface* aIface);
--- a/accessible/src/atk/AtkSocketAccessible.h
+++ b/accessible/src/atk/AtkSocketAccessible.h
@@ -12,16 +12,19 @@
 // This file gets included by nsAccessibilityService.cpp, which can't include
 // atk.h (or glib.h), so we can't rely on it being included.
 #ifdef __ATK_H__
 extern "C" typedef void (*AtkSocketEmbedType) (AtkSocket*, gchar*);
 #else
 extern "C" typedef void (*AtkSocketEmbedType) (void*, void*);
 #endif
 
+namespace mozilla {
+namespace a11y {
+
 /**
  * Provides a AccessibleWrap wrapper around AtkSocket for out-of-process
  * accessibles.
  */
 class AtkSocketAccessible : public AccessibleWrap
 {
 public:
 
@@ -44,9 +47,12 @@ public:
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsIAccessible
   NS_IMETHODIMP GetNativeInterface(void** aOutAccessible);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/atk/DocAccessibleWrap.cpp
+++ b/accessible/src/atk/DocAccessibleWrap.cpp
@@ -2,16 +2,18 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsMai.h"
 #include "DocAccessibleWrap.h"
 
+using namespace mozilla::a11y;
+
 ////////////////////////////////////////////////////////////////////////////////
 // DocAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 DocAccessibleWrap::
   DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
                     nsIPresShell* aPresShell) :
   DocAccessible(aDocument, aRootContent, aPresShell), mActivated(false)
--- a/accessible/src/atk/DocAccessibleWrap.h
+++ b/accessible/src/atk/DocAccessibleWrap.h
@@ -8,19 +8,25 @@
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 #ifndef mozilla_a11y_DocAccessibleWrap_h__
 #define mozilla_a11y_DocAccessibleWrap_h__
 
 #include "DocAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 class DocAccessibleWrap : public DocAccessible
 {
 public:
   DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
                     nsIPresShell* aPresShell);
   virtual ~DocAccessibleWrap();
 
   bool mActivated;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/atk/HyperTextAccessibleWrap.h
+++ b/accessible/src/atk/HyperTextAccessibleWrap.h
@@ -4,12 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
 #define mozilla_a11y_HyperTextAccessibleWrap_h__
 
 #include "HyperTextAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 typedef class HyperTextAccessible HyperTextAccessibleWrap;
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/atk/InterfaceInitFuncs.h
+++ b/accessible/src/atk/InterfaceInitFuncs.h
@@ -4,18 +4,24 @@
  *  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  *   * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef ATK_INTERFACE_INIT_FUNCS_H_
 #define ATK_INTERFACE_INIT_FUNCS_H_
 
 #include <atk/atk.h>
 
+namespace mozilla {
+namespace a11y {
+
 class AccessibleWrap;
 
+} // namespace a11y
+} // namespace mozilla
+
 extern "C" {
 void actionInterfaceInitCB(AtkActionIface* aIface);
 void componentInterfaceInitCB(AtkComponentIface* aIface);
 void documentInterfaceInitCB(AtkDocumentIface *aIface);
 void editableTextInterfaceInitCB(AtkEditableTextIface* aIface);
 void hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface);
 void hypertextInterfaceInitCB(AtkHypertextIface* aIface);
 void imageInterfaceInitCB(AtkImageIface* aIface);
@@ -23,15 +29,15 @@ void selectionInterfaceInitCB(AtkSelecti
 void tableInterfaceInitCB(AtkTableIface *aIface);
 void textInterfaceInitCB(AtkTextIface* aIface);
 void valueInterfaceInitCB(AtkValueIface *aIface);
 }
 
 /**
  * XXX these should live in a file of utils for atk.
  */
-AtkObject* refAccessibleAtPointHelper(AccessibleWrap* aAccWrap,
+AtkObject* refAccessibleAtPointHelper(mozilla::a11y::AccessibleWrap* aAccWrap,
                                       gint aX, gint aY, AtkCoordType aCoordType);
-void getExtentsHelper(AccessibleWrap* aAccWrap,
+void getExtentsHelper(mozilla::a11y::AccessibleWrap* aAccWrap,
                       gint* aX, gint* aY, gint* aWidth, gint* aHeight,
                       AtkCoordType aCoordType);
 
 #endif // ATK_INTERFACE_INIT_FUNCS_H_
--- a/accessible/src/atk/nsAccessNodeWrap.cpp
+++ b/accessible/src/atk/nsAccessNodeWrap.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAccessNodeWrap.h"
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
+using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNodeWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 //-----------------------------------------------------
 // construction 
 //-----------------------------------------------------
--- a/accessible/src/atk/nsAccessNodeWrap.h
+++ b/accessible/src/atk/nsAccessNodeWrap.h
@@ -8,19 +8,25 @@
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 #ifndef _nsAccessNodeWrap_H_
 #define _nsAccessNodeWrap_H_
 
 #include "nsAccessNode.h"
 
-class nsAccessNodeWrap :  public nsAccessNode
+namespace mozilla {
+namespace a11y {
+
+class nsAccessNodeWrap : public nsAccessNode
 {
 public: // construction, destruction
   nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsAccessNodeWrap();
 
   static void InitAccessibility();
   static void ShutdownAccessibility();
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/atk/nsMai.h
+++ b/accessible/src/atk/nsMai.h
@@ -41,11 +41,11 @@ PR_END_MACRO
 #define IS_MAI_OBJECT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
                                          MAI_TYPE_ATK_OBJECT))
 #define IS_MAI_OBJECT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), \
                                          MAI_TYPE_ATK_OBJECT))
 #define MAI_ATK_OBJECT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), \
                                          MAI_TYPE_ATK_OBJECT, \
                                          MaiAtkObjectClass))
 GType mai_atk_object_get_type(void);
-AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
+mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
 
 #endif /* __NS_MAI_H__ */
--- a/accessible/src/atk/nsMaiHyperlink.cpp
+++ b/accessible/src/atk/nsMaiHyperlink.cpp
@@ -2,16 +2,18 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIURI.h"
 #include "nsMaiHyperlink.h"
 
+using namespace mozilla::a11y;
+
 /* MaiAtkHyperlink */
 
 #define MAI_TYPE_ATK_HYPERLINK      (mai_atk_hyperlink_get_type ())
 #define MAI_ATK_HYPERLINK(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
                                      MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlink))
 #define MAI_ATK_HYPERLINK_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass),\
                                  MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlinkClass))
 #define MAI_IS_ATK_HYPERLINK(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
--- a/accessible/src/atk/nsMaiHyperlink.h
+++ b/accessible/src/atk/nsMaiHyperlink.h
@@ -8,16 +8,19 @@
 #define __MAI_HYPERLINK_H__
 
 #include "nsMai.h"
 #include "Accessible.h"
 
 struct _AtkHyperlink;
 typedef struct _AtkHyperlink                      AtkHyperlink;
 
+namespace mozilla {
+namespace a11y {
+
 /*
  * MaiHyperlink is a auxiliary class for MaiInterfaceHyperText.
  */
 
 class MaiHyperlink
 {
 public:
   MaiHyperlink(Accessible* aHyperLink);
@@ -29,9 +32,13 @@ public:
     { return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; }
 
 protected:
   Accessible* mHyperlink;
   AtkHyperlink* mMaiAtkHyperlink;
 public:
   static nsresult Initialize(AtkHyperlink *aObj, MaiHyperlink *aClass);
 };
+
+} // namespace a11y
+} // namespace mozilla
+
 #endif /* __MAI_HYPERLINK_H__ */
--- a/accessible/src/atk/nsMaiInterfaceComponent.cpp
+++ b/accessible/src/atk/nsMaiInterfaceComponent.cpp
@@ -7,16 +7,18 @@
 #include "InterfaceInitFuncs.h"
 
 #include "AccessibleWrap.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsMai.h"
 #include "mozilla/Likely.h"
 
+using namespace mozilla::a11y;
+
 extern "C" {
 
 static AtkObject*
 refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
                        AtkCoordType aCoordType)
 {
   return refAccessibleAtPointHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
                                     aAccX, aAccY, aCoordType);
--- a/accessible/src/atk/nsMaiInterfaceDocument.cpp
+++ b/accessible/src/atk/nsMaiInterfaceDocument.cpp
@@ -6,16 +6,18 @@
 
 #include "InterfaceInitFuncs.h"
 
 #include "AccessibleWrap.h"
 #include "DocAccessible.h"
 #include "nsMai.h"
 #include "mozilla/Likely.h"
 
+using namespace mozilla::a11y;
+
 static const char* const kDocTypeName = "W3C-doctype";
 static const char* const kDocUrlName = "DocURL";
 static const char* const kMimeTypeName = "MimeType";
 
 // below functions are vfuncs on an ATK  interface so they need to be C call
 extern "C" {
 
 static const gchar* getDocumentLocaleCB(AtkDocument* aDocument);
--- a/accessible/src/atk/nsMaiInterfaceEditableText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceEditableText.cpp
@@ -7,16 +7,18 @@
 #include "InterfaceInitFuncs.h"
 
 #include "HyperTextAccessible.h"
 #include "nsMai.h"
 
 #include "nsString.h"
 #include "mozilla/Likely.h"
 
+using namespace mozilla::a11y;
+
 extern "C" {
 static void
 setTextContentsCB(AtkEditableText *aText, const gchar *aString)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return;
 
--- a/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
+++ b/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
@@ -4,16 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "InterfaceInitFuncs.h"
 
 #include "nsMaiHyperlink.h"
 #include "mozilla/Likely.h"
 
+using namespace mozilla::a11y;
+
 extern "C" {
 static AtkHyperlink*
 getHyperlinkCB(AtkHyperlinkImpl* aImpl)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
   if (!accWrap)
     return nullptr;
 
--- a/accessible/src/atk/nsMaiInterfaceHypertext.cpp
+++ b/accessible/src/atk/nsMaiInterfaceHypertext.cpp
@@ -6,16 +6,18 @@
 
 #include "InterfaceInitFuncs.h"
 
 #include "HyperTextAccessible.h"
 #include "nsMai.h"
 #include "nsMaiHyperlink.h"
 #include "mozilla/Likely.h"
 
+using namespace mozilla::a11y;
+
 extern "C" {
 
 static AtkHyperlink*
 getLinkCB(AtkHypertext *aText, gint aLinkIndex)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return nullptr;
--- a/accessible/src/atk/nsMaiInterfaceSelection.cpp
+++ b/accessible/src/atk/nsMaiInterfaceSelection.cpp
@@ -7,16 +7,18 @@
 #include "InterfaceInitFuncs.h"
 
 #include "AccessibleWrap.h"
 #include "nsMai.h"
 #include "mozilla/Likely.h"
 
 #include <atk/atk.h>
 
+using namespace mozilla::a11y;
+
 extern "C" {
 
 static gboolean
 addSelectionCB(AtkSelection *aSelection, gint i)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
   if (!accWrap || !accWrap->IsSelect())
     return FALSE;
--- a/accessible/src/atk/nsMaiInterfaceValue.cpp
+++ b/accessible/src/atk/nsMaiInterfaceValue.cpp
@@ -5,16 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "InterfaceInitFuncs.h"
 #include "mozilla/Likely.h"
 
 #include "AccessibleWrap.h"
 #include "nsMai.h"
 
+using namespace mozilla::a11y;
+
 extern "C" {
 
 static void
 getCurrentValueCB(AtkValue *obj, GValue *value)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
   if (!accWrap)
     return;
--- a/accessible/src/base/AccCollector.h
+++ b/accessible/src/base/AccCollector.h
@@ -4,21 +4,21 @@
 
 #ifndef mozilla_a11y_AccCollector_h__
 #define mozilla_a11y_AccCollector_h__
 
 #include "Filters.h"
 
 #include "nsTArray.h"
 
-class Accessible;
-
 namespace mozilla {
 namespace a11y {
 
+class Accessible;
+
 /**
  * Collect accessible children complying with filter function. Provides quick
  * access to accessible by index.
  */
 class AccCollector
 {
 public:
   AccCollector(Accessible* aRoot, filters::FilterFuncPtr aFilterFunc);
@@ -81,15 +81,15 @@ public:
 
 protected:
   // Make sure it's used by Accessible class only.
   EmbeddedObjCollector(Accessible* aRoot) :
     AccCollector(aRoot, filters::GetEmbeddedObject) { }
 
   virtual void AppendObject(Accessible* aAccessible);
 
-  friend class ::Accessible;
+  friend class Accessible;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/src/base/AccEvent.h
+++ b/accessible/src/base/AccEvent.h
@@ -5,18 +5,22 @@
 
 #ifndef _AccEvent_H_
 #define _AccEvent_H_
 
 #include "nsIAccessibleEvent.h"
 
 #include "mozilla/a11y/Accessible.h"
 
+namespace mozilla {
+namespace a11y {
+
+class DocAccessible;
+
 class nsAccEvent;
-class DocAccessible;
 
 // Constants used to point whether the event is from user input.
 enum EIsFromUserInput
 {
   // eNoUserInput: event is not from user input
   eNoUserInput = 0,
   // eFromUserInput: event is from user input
   eFromUserInput = 1,
@@ -481,10 +485,13 @@ public:
     return mRawPtr->GetEventGroups() & (1U << Destination::kEventGroup) ?
       static_cast<Destination*>(mRawPtr) : nullptr;
   }
 
 private:
   AccEvent* mRawPtr;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/base/AccGroupInfo.h
+++ b/accessible/src/base/AccGroupInfo.h
@@ -3,16 +3,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef AccGroupInfo_h_
 #define AccGroupInfo_h_
 
 #include "Accessible-inl.h"
 #include "nsAccUtils.h"
 
+namespace mozilla {
+namespace a11y {
+
 /**
  * Calculate and store group information.
  */
 class AccGroupInfo
 {
 public:
   AccGroupInfo(Accessible* aItem, mozilla::a11y::role aRole);
   ~AccGroupInfo() { MOZ_COUNT_DTOR(AccGroupInfo); }
@@ -71,9 +74,12 @@ private:
   static bool IsConceptualParent(mozilla::a11y::role aRole,
 				 mozilla::a11y::role aParentRole);
 
   uint32_t mPosInSet;
   uint32_t mSetSize;
   Accessible* mParent;
 };
 
+} // namespace mozilla
+} // namespace a11y
+
 #endif
--- a/accessible/src/base/AccIterator.h
+++ b/accessible/src/base/AccIterator.h
@@ -19,17 +19,17 @@ namespace a11y {
  */
 class AccIterable
 {
 public:
   virtual ~AccIterable() { }
   virtual Accessible* Next() = 0;
 
 private:
-  friend class mozilla::a11y::Relation;
+  friend class Relation;
   nsAutoPtr<AccIterable> mNextIter;
 };
 
 /**
  * Allows to iterate through accessible children or subtree complying with
  * filter function.
  */
 class AccIterator : public AccIterable
--- a/accessible/src/base/Filters.h
+++ b/accessible/src/base/Filters.h
@@ -2,23 +2,24 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_Filters_h__
 #define mozilla_a11y_Filters_h__
 
 #include "mozilla/StandardInteger.h"
 
-class Accessible;
-
 /**
  * Predefined filters used for nsAccIterator and nsAccCollector.
  */
 namespace mozilla {
 namespace a11y {
+
+class Accessible;
+
 namespace filters {
 
 enum EResult {
   eSkip = 0,
   eMatch = 1,
   eSkipSubtree = 2
 };
 
--- a/accessible/src/base/FocusManager.h
+++ b/accessible/src/base/FocusManager.h
@@ -3,23 +3,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_FocusManager_h_
 #define mozilla_a11y_FocusManager_h_
 
 #include "nsAutoPtr.h"
 #include "mozilla/dom/Element.h"
 
+namespace mozilla {
+namespace a11y {
+
 class AccEvent;
 class Accessible;
 class DocAccessible;
 
-namespace mozilla {
-namespace a11y {
-
 /**
  * Manage the accessible focus. Used to fire and process accessible events.
  */
 class FocusManager
 {
 public:
   virtual ~FocusManager();
 
--- a/accessible/src/base/Logging.h
+++ b/accessible/src/base/Logging.h
@@ -5,29 +5,28 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_logs_h__
 #define mozilla_a11y_logs_h__
 
 #include "nscore.h"
 #include "nsAString.h"
 
-class AccEvent;
-class Accessible;
-class DocAccessible;
-
 class nsIDocument;
 class nsINode;
 class nsIRequest;
 class nsISelection;
 class nsIWebProgress;
 
 namespace mozilla {
 namespace a11y {
 
+class AccEvent;
+class Accessible;
+class DocAccessible;
 class OuterDocAccessible;
 
 namespace logging {
 
 enum EModules {
   eDocLoad = 1 << 0,
   eDocCreate = 1 << 1,
   eDocDestroy = 1 << 2,
--- a/accessible/src/base/NotificationController.h
+++ b/accessible/src/base/NotificationController.h
@@ -9,19 +9,23 @@
 #include "AccEvent.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsRefreshDriver.h"
 
 #ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
+class nsIContent;
+
+namespace mozilla {
+namespace a11y {
+
 class Accessible;
 class DocAccessible;
-class nsIContent;
 
 /**
  * Notification interface.
  */
 class Notification
 {
 public:
   virtual ~Notification() { };
@@ -342,9 +346,12 @@ private:
 
   /**
    * Pending events array. Don't make this an nsAutoTArray; we use
    * SwapElements() on it.
    */
   nsTArray<nsRefPtr<AccEvent> > mEvents;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/base/TextAttrs.h
+++ b/accessible/src/base/TextAttrs.h
@@ -5,26 +5,27 @@
 
 #ifndef nsTextAttrs_h_
 #define nsTextAttrs_h_
 
 #include "nsCOMPtr.h"
 #include "nsColor.h"
 #include "nsStyleConsts.h"
 
-class HyperTextAccessible;
 class nsIFrame;
 class nsIPersistentProperties;
 class nsIContent;
-class Accessible;
 class nsDeviceContext;
 
 namespace mozilla {
 namespace a11y {
 
+class Accessible;
+class HyperTextAccessible;
+
 /**
  * Used to expose text attributes for the hyper text accessible (see
  * HyperTextAccessible class).
  *
  * @note "invalid: spelling" text attribute is implemented entirely in
  *       HyperTextAccessible class.
  */
 class TextAttrsMgr
--- a/accessible/src/base/nsAccCache.h
+++ b/accessible/src/base/nsAccCache.h
@@ -28,19 +28,19 @@ ClearCacheEntry(const void* aKey, nsRefP
   return PL_DHASH_REMOVE;
 }
 
 /**
  * Clear the cache and shutdown the accessibles.
  */
 
 static void
-ClearCache(AccessibleHashtable& aCache)
+ClearCache(mozilla::a11y::AccessibleHashtable& aCache)
 {
-  aCache.Enumerate(ClearCacheEntry<Accessible>, nullptr);
+  aCache.Enumerate(ClearCacheEntry<mozilla::a11y::Accessible>, nullptr);
 }
 
 /**
  * Traverse the accessible cache entry for cycle collector.
  */
 template <class T>
 static PLDHashOperator
 CycleCollectorTraverseCacheEntry(const void *aKey, T *aAccessible,
@@ -56,15 +56,16 @@ CycleCollectorTraverseCacheEntry(const v
   return PL_DHASH_NEXT;
 }
 
 /**
  * Traverse the accessible cache for cycle collector.
  */
 
 static void
-CycleCollectorTraverseCache(AccessibleHashtable& aCache,
+CycleCollectorTraverseCache(mozilla::a11y::AccessibleHashtable& aCache,
                             nsCycleCollectionTraversalCallback *aCallback)
 {
-  aCache.EnumerateRead(CycleCollectorTraverseCacheEntry<Accessible>, aCallback);
+  aCache.EnumerateRead(CycleCollectorTraverseCacheEntry<mozilla::a11y::Accessible>,
+                       aCallback);
 }
 
 #endif
--- a/accessible/src/base/nsAccDocManager.h
+++ b/accessible/src/base/nsAccDocManager.h
@@ -8,27 +8,36 @@
 #include "nsIDocument.h"
 #include "nsIDOMEventListener.h"
 #include "nsRefPtrHashtable.h"
 #include "nsIWebProgress.h"
 #include "nsIWebProgressListener.h"
 #include "nsWeakReference.h"
 #include "nsIPresShell.h"
 
+namespace mozilla {
+namespace a11y {
+
 class Accessible;
 class DocAccessible;
 
+} // namespace a11y
+} // namespace mozilla
+
 /**
  * Manage the document accessible life cycle.
  */
 class nsAccDocManager : public nsIWebProgressListener,
                         public nsIDOMEventListener,
                         public nsSupportsWeakReference
 {
 public:
+  typedef mozilla::a11y::Accessible Accessible;
+  typedef mozilla::a11y::DocAccessible DocAccessible;
+
   virtual ~nsAccDocManager() { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIWEBPROGRESSLISTENER
   NS_DECL_NSIDOMEVENTLISTENER
 
   /**
    * Return document accessible for the given DOM node.
--- a/accessible/src/base/nsAccTreeWalker.cpp
+++ b/accessible/src/base/nsAccTreeWalker.cpp
@@ -6,16 +6,18 @@
 #include "nsAccTreeWalker.h"
 
 #include "Accessible.h"
 #include "nsAccessibilityService.h"
 #include "DocAccessible.h"
 
 #include "nsINodeList.h"
 
+using namespace mozilla::a11y;
+
 ////////////////////////////////////////////////////////////////////////////////
 // WalkState
 ////////////////////////////////////////////////////////////////////////////////
 
 struct WalkState
 {
   WalkState(nsIContent *aContent) :
     content(aContent), childIdx(0), prevState(nullptr) {}
--- a/accessible/src/base/nsAccTreeWalker.h
+++ b/accessible/src/base/nsAccTreeWalker.h
@@ -4,26 +4,36 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _nsAccTreeWalker_H_
 #define _nsAccTreeWalker_H_
 
 #include "nsAutoPtr.h"
 #include "nsIContent.h"
 
+namespace mozilla {
+namespace a11y {
+
 class Accessible;
 class DocAccessible;
+
+} // namespace a11y
+} // namespace mozilla
+
 struct WalkState;
 
 /**
  * This class is used to walk the DOM tree to create accessible tree.
  */
 class nsAccTreeWalker
 {
 public:
+  typedef mozilla::a11y::Accessible Accessible;
+  typedef mozilla::a11y::DocAccessible DocAccessible;
+
   nsAccTreeWalker(DocAccessible* aDoc, Accessible* aContext, nsIContent* aNode,
                   bool aWalkCache = false);
   virtual ~nsAccTreeWalker();
 
   /**
    * Return the next child accessible.
    *
    * @note Returned accessible is bound to the document, if the accessible is
--- a/accessible/src/base/nsAccUtils.h
+++ b/accessible/src/base/nsAccUtils.h
@@ -15,21 +15,25 @@
 
 #include "mozilla/dom/Element.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIPersistentProperties2.h"
 #include "nsIPresShell.h"
 #include "nsPoint.h"
 
+struct nsRoleMapEntry;
+
+namespace mozilla {
+namespace a11y {
+
 class nsAccessNode;
 class Accessible;
 class HyperTextAccessible;
 class DocAccessible;
-struct nsRoleMapEntry;
 
 class nsAccUtils
 {
 public:
   /**
    * Returns value of attribute from the given attributes container.
    *
    * @param aAttributes - attributes container
@@ -288,9 +292,12 @@ public:
 
   /**
    * Return true if the given accessible can't have children. Used when exposing
    * to platform accessibility APIs, should the children be pruned off?
    */
   static bool MustPrune(Accessible* aAccessible);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -8,33 +8,29 @@
  */
 
 #ifndef _nsAccessNode_H_
 #define _nsAccessNode_H_
 
 #include "nsIAccessibleTypes.h"
 #include "nsINode.h"
 
-class nsAccessNode;
-class DocAccessible;
-class nsIAccessibleDocument;
 class nsIContent;
+class nsIDocShellTreeItem;
+class nsIFrame;
+class nsIPresShell;
+class nsPresContext;
 
 namespace mozilla {
 namespace a11y {
-class RootAccessible;
-}
-}
 
-class nsIPresShell;
-class nsPresContext;
-class nsIFrame;
-class nsIDocShellTreeItem;
+class DocAccessible;
+class RootAccessible;
 
-class nsAccessNode: public nsISupports
+class nsAccessNode : public nsISupports
 {
 public:
 
   nsAccessNode(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsAccessNode();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode)
@@ -42,27 +38,28 @@ public:
   /**
    * Return the document accessible for this access node.
    */
   DocAccessible* Document() const { return mDoc; }
 
   /**
    * Return the root document accessible for this accessnode.
    */
-  mozilla::a11y::RootAccessible* RootAccessible() const;
+  a11y::RootAccessible* RootAccessible() const;
 
   /**
    * Shutdown the access node object.
    */
   virtual void Shutdown();
 
   /**
    * Return frame for the given access node object.
    */
   virtual nsIFrame* GetFrame() const;
+
   /**
    * Return DOM node associated with the accessible.
    */
   virtual nsINode* GetNode() const;
   nsIContent* GetContent() const { return mContent; }
 
   /**
    * Return node type information of DOM node associated with the accessible.
@@ -98,10 +95,13 @@ protected:
   DocAccessible* mDoc;
 
 private:
   nsAccessNode() MOZ_DELETE;
   nsAccessNode(const nsAccessNode&) MOZ_DELETE;
   nsAccessNode& operator =(const nsAccessNode&) MOZ_DELETE;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/base/nsAccessiblePivot.h
+++ b/accessible/src/base/nsAccessiblePivot.h
@@ -9,25 +9,34 @@
 
 #include "nsIAccessiblePivot.h"
 
 #include "nsAutoPtr.h"
 #include "nsTObserverArray.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/Attributes.h"
 
+namespace mozilla {
+namespace a11y {
+
 class Accessible;
+
+} // namespace a11y
+} // namespace mozilla
+
 class nsIAccessibleTraversalRule;
 
 /**
  * Class represents an accessible pivot.
  */
 class nsAccessiblePivot MOZ_FINAL : public nsIAccessiblePivot
 {
 public:
+  typedef mozilla::a11y::Accessible Accessible;
+
   nsAccessiblePivot(Accessible* aRoot);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessiblePivot, nsIAccessiblePivot)
 
   NS_DECL_NSIACCESSIBLEPIVOT
 
   /*
--- a/accessible/src/base/nsCaretAccessible.h
+++ b/accessible/src/base/nsCaretAccessible.h
@@ -112,15 +112,15 @@ private:
 
   // Currently focused control.
   nsCOMPtr<nsIContent> mCurrentControl;
 
   // Info for the the last selection event.
   // If it was on a control, then its control's selection. Otherwise, it's for
   // a document where the selection changed.
   nsCOMPtr<nsIWeakReference> mLastUsedSelection; // Weak ref to nsISelection
-  nsRefPtr<HyperTextAccessible> mLastTextAccessible;
+  nsRefPtr<mozilla::a11y::HyperTextAccessible> mLastTextAccessible;
   int32_t mLastCaretOffset;
 
   mozilla::a11y::RootAccessible* mRootAccessible;
 };
 
 #endif
--- a/accessible/src/base/nsEventShell.cpp
+++ b/accessible/src/base/nsEventShell.cpp
@@ -2,16 +2,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsEventShell.h"
 
 #include "nsAccUtils.h"
 
+using namespace mozilla::a11y;
+
 ////////////////////////////////////////////////////////////////////////////////
 // nsEventShell
 ////////////////////////////////////////////////////////////////////////////////
 
 void
 nsEventShell::FireEvent(AccEvent* aEvent)
 {
   if (!aEvent)
--- a/accessible/src/base/nsEventShell.h
+++ b/accessible/src/base/nsEventShell.h
@@ -15,26 +15,27 @@ class nsIPersistentProperties;
  */
 class nsEventShell
 {
 public:
 
   /**
    * Fire the accessible event.
    */
-  static void FireEvent(AccEvent* aEvent);
+  static void FireEvent(mozilla::a11y::AccEvent* aEvent);
 
   /**
    * Fire accessible event of the given type for the given accessible.
    *
    * @param  aEventType   [in] the event type
    * @param  aAccessible  [in] the event target
    */
-  static void FireEvent(uint32_t aEventType, Accessible* aAccessible,
-                        EIsFromUserInput aIsFromUserInput = eAutoDetect);
+  static void FireEvent(uint32_t aEventType,
+                        mozilla::a11y::Accessible* aAccessible,
+                        mozilla::a11y::EIsFromUserInput aIsFromUserInput = mozilla::a11y::eAutoDetect);
 
   /**
    * Append 'event-from-input' object attribute if the accessible event has
    * been fired just now for the given node.
    *
    * @param  aNode        [in] the DOM node
    * @param  aAttributes  [in, out] the attributes
    */
--- a/accessible/src/base/nsTextEquivUtils.h
+++ b/accessible/src/base/nsTextEquivUtils.h
@@ -37,16 +37,17 @@ enum ETextEquivRule
 
 /**
  * The class provides utils methods to compute the accessible name and
  * description.
  */
 class nsTextEquivUtils
 {
 public:
+  typedef mozilla::a11y::Accessible Accessible;
 
   /**
    * Calculates the name from accessible subtree if allowed.
    *
    * @param aAccessible [in] the given accessible
    * @param aName       [out] accessible name
    */
   static nsresult GetNameFromSubtree(Accessible* aAccessible,
--- a/accessible/src/generic/ARIAGridAccessible-inl.h
+++ b/accessible/src/generic/ARIAGridAccessible-inl.h
@@ -6,18 +6,21 @@
 
 #ifndef mozilla_a11y_ARIAGridAccessible_inl_h__
 #define mozilla_a11y_ARIAGridAccessible_inl_h__
 
 #include "ARIAGridAccessible.h"
 
 #include "AccIterator.h"
 
+namespace mozilla {
+namespace a11y {
+
 inline Accessible*
-mozilla::a11y::ARIAGridCellAccessible::TableFor(Accessible* aRow) const
+ARIAGridCellAccessible::TableFor(Accessible* aRow) const
 {
   if (aRow) {
     Accessible* table = aRow->Parent();
     if (table) {
       roles::Role tableRole = table->Role();
       if (tableRole == roles::GROUPING) { // if there's a rowgroup.
         table = table->Parent();
         if (table)
@@ -28,26 +31,29 @@ mozilla::a11y::ARIAGridCellAccessible::T
         table : nullptr;
     }
   }
 
   return nullptr;
 }
 
 inline int32_t
-mozilla::a11y::ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
+ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
 {
   Accessible* table = TableFor(aRow);
   if (table) {
     int32_t rowIdx = 0;
     Accessible* row = nullptr;
     AccIterator rowIter(table, filters::GetRow);
     while ((row = rowIter.Next()) && row != aRow)
       rowIdx++;
 
     if (row)
       return rowIdx;
   }
 
   return -1;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/generic/Accessible-inl.h
+++ b/accessible/src/generic/Accessible-inl.h
@@ -5,16 +5,19 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_Accessible_inl_h_
 #define mozilla_a11y_Accessible_inl_h_
 
 #include "Accessible.h"
 #include "nsARIAMap.h"
 
+namespace mozilla {
+namespace a11y {
+
 inline mozilla::a11y::role
 Accessible::Role()
 {
   if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
     return ARIATransformRole(NativeRole());
 
   return ARIATransformRole(mRoleMapEntry->role);
 }
@@ -40,9 +43,12 @@ inline bool
 Accessible::HasNumericValue() const
 {
   if (mFlags & eHasNumericValue)
     return true;
 
   return mRoleMapEntry && mRoleMapEntry->valueRule != eNoValue;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/generic/Accessible.h
+++ b/accessible/src/generic/Accessible.h
@@ -16,30 +16,36 @@
 #include "nsIAccessibleValue.h"
 #include "nsIAccessibleStates.h"
 #include "nsIContent.h"
 
 #include "nsStringGlue.h"
 #include "nsTArray.h"
 #include "nsRefPtrHashtable.h"
 
-class AccEvent;
-class AccGroupInfo;
-class KeyBinding;
-class Accessible;
-class HyperTextAccessible;
 struct nsRoleMapEntry;
 
+struct nsRect;
+class nsIContent;
+class nsIFrame;
+class nsIAtom;
+class nsIView;
+
 namespace mozilla {
 namespace a11y {
 
+class Accessible;
+class AccEvent;
+class AccGroupInfo;
 class EmbeddedObjCollector;
 class HTMLImageMapAccessible;
 class HTMLLIAccessible;
+class HyperTextAccessible;
 class ImageAccessible;
+class KeyBinding;
 class Relation;
 class TableAccessible;
 class TableCellAccessible;
 class TextLeafAccessible;
 class XULTreeAccessible;
 
 /**
  * Name type flags.
@@ -76,25 +82,16 @@ struct GroupPos
 {
   GroupPos() : level(0), posInSet(0), setSize(0) { }
 
   int32_t level;
   int32_t posInSet;
   int32_t setSize;
 };
 
-} // namespace a11y
-} // namespace mozilla
-
-struct nsRect;
-class nsIContent;
-class nsIFrame;
-class nsIAtom;
-class nsIView;
-
 typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible>
   AccessibleHashtable;
 
 
 #define NS_ACCESSIBLE_IMPL_IID                          \
 {  /* 133c8bf4-4913-4355-bd50-426bd1d6e1ad */           \
   0x133c8bf4,                                           \
   0x4913,                                               \
@@ -145,17 +142,17 @@ public:
   virtual void Value(nsString& aValue);
 
   /**
    * Get the name of this accessible.
    *
    * Note: aName.IsVoid() when name was left empty by the author on purpose.
    * aName.IsEmpty() when the author missed name, AT can try to repair a name.
    */
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
+  virtual ENameValueFlag Name(nsString& aName);
 
   /**
    * Return DOM node associated with this accessible.
    */
   inline already_AddRefed<nsIDOMNode> DOMNode() const
   {
     nsIDOMNode *DOMNode = nullptr;
     if (GetNode())
@@ -906,17 +903,17 @@ protected:
   static const uint32_t kChildrenFlagsMask =
     eChildrenUninitialized | eMixedChildren | eEmbeddedChildren;
 
   uint32_t mFlags;
   friend class DocAccessible;
 
   nsAutoPtr<mozilla::a11y::EmbeddedObjCollector> mEmbeddedObjCollector;
   int32_t mIndexOfEmbeddedChild;
-  friend class mozilla::a11y::EmbeddedObjCollector;
+  friend class EmbeddedObjCollector;
 
   nsAutoPtr<AccGroupInfo> mGroupInfo;
   friend class AccGroupInfo;
 
   /**
    * Non-null indicates author-supplied role; possibly state & value as well
    */
   nsRoleMapEntry* mRoleMapEntry;
@@ -978,9 +975,12 @@ public:
 private:
   void ToPlatformFormat(nsAString& aValue) const;
   void ToAtkFormat(nsAString& aValue) const;
 
   uint32_t mKey;
   uint32_t mModifierMask;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/generic/DocAccessible-inl.h
+++ b/accessible/src/generic/DocAccessible-inl.h
@@ -7,16 +7,19 @@
 #ifndef mozilla_a11y_DocAccessible_inl_h_
 #define mozilla_a11y_DocAccessible_inl_h_
 
 #include "DocAccessible.h"
 #include "nsAccessibilityService.h"
 #include "NotificationController.h"
 #include "States.h"
 
+namespace mozilla {
+namespace a11y {
+
 inline void
 DocAccessible::BindChildDocument(DocAccessible* aDocument)
 {
   mNotificationController->ScheduleChildDocBinding(aDocument);
 }
 
 template<class Class, class Arg>
 inline void
@@ -45,27 +48,29 @@ DocAccessible::NotifyOfLoad(uint32_t aLo
 {
   mLoadState |= eDOMLoaded;
   mLoadEventType = aLoadEventType;
 
   // If the document is loaded completely then network activity was presumingly
   // caused by file loading. Fire busy state change event.
   if (HasLoadState(eCompletelyLoaded) && IsLoadEventTarget()) {
     nsRefPtr<AccEvent> stateEvent =
-      new AccStateChangeEvent(this, mozilla::a11y::states::BUSY, false);
+      new AccStateChangeEvent(this, states::BUSY, false);
     FireDelayedAccessibleEvent(stateEvent);
   }
 }
 
 inline void
 DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
 {
   mozilla::a11y::role role = aAccessible->Role();
-  if (role == mozilla::a11y::roles::ENTRY ||
-      role == mozilla::a11y::roles::COMBOBOX) {
+  if (role == roles::ENTRY || role == roles::COMBOBOX) {
     nsRefPtr<AccEvent> valueChangeEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
                    eAutoDetect, AccEvent::eRemoveDupes);
     FireDelayedAccessibleEvent(valueChangeEvent);
   }
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/generic/DocAccessible.h
+++ b/accessible/src/generic/DocAccessible.h
@@ -19,32 +19,30 @@
 #include "nsIDocumentObserver.h"
 #include "nsIEditor.h"
 #include "nsIObserver.h"
 #include "nsIScrollPositionListener.h"
 #include "nsITimer.h"
 #include "nsIWeakReference.h"
 #include "nsIDocShellTreeNode.h"
 
-template<class Class, class Arg>
-class TNotification;
-class NotificationController;
+class nsAccDocManager;
+class nsAccessiblePivot;
 
 class nsIScrollableView;
-class nsAccessiblePivot;
 
 const uint32_t kDefaultCacheSize = 256;
 
 namespace mozilla {
 namespace a11y {
 
+class NotificationController;
 class RelatedAccIterator;
-
-} // namespace a11y
-} // namespace mozilla
+template<class Class, class Arg>
+class TNotification;
 
 class DocAccessible : public HyperTextAccessibleWrap,
                       public nsIAccessibleDocument,
                       public nsIDocumentObserver,
                       public nsIObserver,
                       public nsIScrollPositionListener,
                       public nsSupportsWeakReference,
                       public nsIAccessibleCursorable,
@@ -328,17 +326,17 @@ protected:
   virtual nsresult RemoveEventListeners();
 
   /**
    * Marks this document as loaded or loading.
    */
   void NotifyOfLoad(uint32_t aLoadEventType);
   void NotifyOfLoading(bool aIsReloading);
 
-  friend class nsAccDocManager;
+  friend class ::nsAccDocManager;
 
   /**
    * Perform initial update (create accessible tree).
    * Can be overridden by wrappers to prepare initialization work.
    */
   virtual void DoInitialUpdate();
 
   /**
@@ -558,17 +556,17 @@ protected:
   };
 
   /**
    * The cache of IDs pointed by relation attributes.
    */
   typedef nsTArray<nsAutoPtr<AttrRelProvider> > AttrRelProviderArray;
   nsClassHashtable<nsStringHashKey, AttrRelProviderArray> mDependentIDsHash;
 
-  friend class mozilla::a11y::RelatedAccIterator;
+  friend class RelatedAccIterator;
 
   /**
    * Used for our caching algorithm. We store the list of nodes that should be
    * invalidated.
    *
    * @see ProcessInvalidationList
    */
   nsTArray<nsIContent*> mInvalidationList;
@@ -586,9 +584,12 @@ private:
 
 inline DocAccessible*
 Accessible::AsDoc()
 {
   return mFlags & eDocAccessible ?
     static_cast<DocAccessible*>(this) : nullptr;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/generic/HyperTextAccessible.h
+++ b/accessible/src/generic/HyperTextAccessible.h
@@ -12,22 +12,21 @@
 
 #include "AccessibleWrap.h"
 
 #include "nsFrameSelection.h"
 #include "nsISelectionController.h"
 
 namespace mozilla {
 namespace a11y {
+
 struct DOMPoint {
   nsINode* node;
   int32_t idx;
 };
-}
-}
 
 enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
 
 // This character marks where in the text returned via nsIAccessibleText(),
 // that embedded object characters exist
 const PRUnichar kEmbeddedObjectChar = 0xfffc;
 const PRUnichar kImaginaryEmbeddedObjectChar = ' ';
 const PRUnichar kForcedNewLineChar = '\n';
@@ -238,17 +237,17 @@ public:
 
   /**
    * Return the editor associated with the accessible.
    */
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
 protected:
   // Accessible
-  virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
+  virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
   // HyperTextAccessible
 
   /**
    * Transform magic offset into text offset.
    */
   int32_t ConvertMagicOffset(int32_t aOffset)
   {
@@ -400,10 +399,13 @@ private:
 
 inline HyperTextAccessible*
 Accessible::AsHyperText()
 {
   return mFlags & eHyperTextAccessible ?
     static_cast<HyperTextAccessible*>(this) : nullptr;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/generic/ImageAccessible.h
+++ b/accessible/src/generic/ImageAccessible.h
@@ -72,23 +72,22 @@ private:
    * @param aIndex  The 0-based index to be tested.
    *
    * @returns  true if index is valid for longdesc action.
    */
   inline bool IsLongDescIndex(uint8_t aIndex);
 
 };
 
-} // namespace a11y
-} // namespace mozilla
-
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
-inline mozilla::a11y::ImageAccessible*
+inline ImageAccessible*
 Accessible::AsImage()
 {
-  return IsImage() ?
-    static_cast<mozilla::a11y::ImageAccessible*>(this) : nullptr;
+  return IsImage() ? static_cast<ImageAccessible*>(this) : nullptr;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/generic/RootAccessible.h
+++ b/accessible/src/generic/RootAccessible.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_RootAccessible_h__
 #define mozilla_a11y_RootAccessible_h__
 
 #include "nsCaretAccessible.h"
 #include "DocAccessibleWrap.h"
 
-
 #include "nsHashtable.h"
 #include "nsCaretAccessible.h"
 #include "nsIDocument.h"
 #include "nsIDOMEventListener.h"
 
 namespace mozilla {
 namespace a11y {
 
@@ -78,19 +77,19 @@ protected:
                                     XULTreeAccessible* aAccessible);
 
     uint32_t GetChromeFlags();
 #endif
 
     nsRefPtr<nsCaretAccessible> mCaretAccessible;
 };
 
-} // namespace a11y
-} // namespace mozilla
-
-inline mozilla::a11y::RootAccessible*
+inline RootAccessible*
 Accessible::AsRoot()
 {
   return mFlags & eRootAccessible ?
     static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/generic/TableAccessible.h
+++ b/accessible/src/generic/TableAccessible.h
@@ -6,21 +6,21 @@
 
 #ifndef TABLE_ACCESSIBLE_H
 #define TABLE_ACCESSIBLE_H
 
 #include "nsString.h"
 #include "nsTArray.h"
 #include "prtypes.h"
 
-class Accessible;
-
 namespace mozilla {
 namespace a11y {
 
+class Accessible;
+
 /**
  * Accessible table interface.
  */
 class TableAccessible
 {
 public:
 
   /**
--- a/accessible/src/generic/TableCellAccessible.h
+++ b/accessible/src/generic/TableCellAccessible.h
@@ -5,21 +5,20 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_TableCellAccessible_h__
 #define mozilla_a11y_TableCellAccessible_h__
 
 #include "nsTArray.h"
 #include "mozilla/StandardInteger.h"
 
-class Accessible;
-
 namespace mozilla {
 namespace a11y {
 
+class Accessible;
 class TableAccessible;
 
 /**
  * Abstract interface implemented by table cell accessibles.
  */
 class TableCellAccessible
 {
 public:
--- a/accessible/src/generic/TextLeafAccessible.h
+++ b/accessible/src/generic/TextLeafAccessible.h
@@ -33,23 +33,24 @@ public:
 protected:
   // Accessible
   virtual void CacheChildren();
 
 protected:
   nsString mText;
 };
 
-} // namespace a11y
-} // namespace mozilla
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcast method
 
-inline mozilla::a11y::TextLeafAccessible*
+inline TextLeafAccessible*
 Accessible::AsTextLeaf()
 {
   return mFlags & eTextLeafAccessible ?
-    static_cast<mozilla::a11y::TextLeafAccessible*>(this) : nullptr;
+    static_cast<TextLeafAccessible*>(this) : nullptr;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/html/HTMLImageMapAccessible.h
+++ b/accessible/src/html/HTMLImageMapAccessible.h
@@ -64,22 +64,23 @@ public:
   virtual uint32_t EndOffset();
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
   virtual void CacheChildren();
 };
 
-} // namespace a11y
-} // namespace mozilla
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
-inline mozilla::a11y::HTMLImageMapAccessible*
+inline HTMLImageMapAccessible*
 Accessible::AsImageMap()
 {
   return IsImageMapAccessible() ?
-    static_cast<mozilla::a11y::HTMLImageMapAccessible*>(this) : nullptr;
+    static_cast<HTMLImageMapAccessible*>(this) : nullptr;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/html/HTMLListAccessible.h
+++ b/accessible/src/html/HTMLListAccessible.h
@@ -91,20 +91,20 @@ public:
   // HTMLListBulletAccessible
 
   /**
    * Return true if the bullet is inside of list item element boundaries.
    */
   bool IsInside() const;
 };
 
+
+inline HTMLLIAccessible*
+Accessible::AsHTMLListItem()
+{
+  return mFlags & eHTMLListItemAccessible ?
+    static_cast<HTMLLIAccessible*>(this) : nullptr;
+}
+
 } // namespace a11y
 } // namespace mozilla
 
-
-inline mozilla::a11y::HTMLLIAccessible*
-Accessible::AsHTMLListItem()
-{
-  return mFlags & eHTMLListItemAccessible ?
-    static_cast<mozilla::a11y::HTMLLIAccessible*>(this) : nullptr;
-}
-
 #endif
--- a/accessible/src/mac/AccessibleWrap.h
+++ b/accessible/src/mac/AccessibleWrap.h
@@ -20,16 +20,19 @@
 
 #include "nsTArray.h"
 #include "nsAutoPtr.h"
 
 #if defined(__OBJC__)
 @class mozAccessible;
 #endif
 
+namespace mozilla {
+namespace a11y {
+
 class AccessibleWrap : public Accessible
 {
 public: // construction, destruction
   AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~AccessibleWrap();
     
   /**
    * Get the native Obj-C object (mozAccessible).
@@ -103,9 +106,12 @@ private:
   /**
    * We have created our native. This does not mean there is one.
    * This can never go back to false.
    * We need it because checking whether we need a native object cost time.
    */
   bool mNativeInited;  
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/mac/DocAccessibleWrap.h
+++ b/accessible/src/mac/DocAccessibleWrap.h
@@ -3,18 +3,24 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_DocAccessibleWrap_h__
 #define mozilla_a11y_DocAccessibleWrap_h__
 
 #include "DocAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 class DocAccessibleWrap : public DocAccessible
 {
 public:
   DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
                     nsIPresShell* aPresShell);
   virtual ~DocAccessibleWrap();
 
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/mac/DocAccessibleWrap.mm
+++ b/accessible/src/mac/DocAccessibleWrap.mm
@@ -2,16 +2,18 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DocAccessibleWrap.h"
 
 #import "mozAccessible.h"
 
+using namespace mozilla::a11y;
+
 DocAccessibleWrap::
   DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
                     nsIPresShell* aPresShell) :
   DocAccessible(aDocument, aRootContent, aPresShell)
 {
 }
 
 DocAccessibleWrap::~DocAccessibleWrap()
--- a/accessible/src/mac/HyperTextAccessibleWrap.h
+++ b/accessible/src/mac/HyperTextAccessibleWrap.h
@@ -3,12 +3,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
 #define mozilla_a11y_HyperTextAccessibleWrap_h__
 
 #include "HyperTextAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 typedef class HyperTextAccessible HyperTextAccessibleWrap;
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/mac/mozAccessible.h
+++ b/accessible/src/mac/mozAccessible.h
@@ -31,17 +31,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
   return native;
 }
 
 @interface mozAccessible : NSObject <mozAccessible>
 {
   /**
    * Weak reference; it owns us.
    */
-  AccessibleWrap* mGeckoAccessible;
+  mozilla::a11y::AccessibleWrap* mGeckoAccessible;
   
   /**
    * Strong ref to array of children
    */
   NSMutableArray* mChildren;
   
   /** 
    * Weak reference to the parent
@@ -50,17 +50,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
 
   /**
    * The nsIAccessible role of our gecko accessible.
    */
   mozilla::a11y::role        mRole;
 }
 
 // inits with the gecko owner.
-- (id)initWithAccessible:(AccessibleWrap*)geckoParent;
+- (id)initWithAccessible:(mozilla::a11y::AccessibleWrap*)geckoParent;
 
 // our accessible parent (AXParent)
 - (id <mozAccessible>)parent;
 
 // a lazy cache of our accessible children (AXChildren). updated
 - (NSArray*)children;
 
 // returns the size of this accessible.
@@ -111,17 +111,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
 #pragma mark -
 
 // invalidates and removes all our children from our cached array.
 - (void)invalidateChildren;
 
 /** 
  * Append a child if they are already cached.
  */
-- (void)appendChild:(Accessible*)aAccessible;
+- (void)appendChild:(mozilla::a11y::Accessible*)aAccessible;
 
 // makes ourselves "expired". after this point, we might be around if someone
 // has retained us (e.g., a third-party), but we really contain no information.
 - (void)expire;
 - (BOOL)isExpired;
 
 #ifdef DEBUG
 - (void)printHierarchy;
--- a/accessible/src/mac/mozTextAccessible.h
+++ b/accessible/src/mac/mozTextAccessible.h
@@ -5,17 +5,17 @@
 #import "mozAccessible.h"
 
 #import "HyperTextAccessible.h"
 
 @interface mozTextAccessible : mozAccessible
 {
   // both of these are the same old mGeckoAccessible, but already
   // QI'd for us, to the right type, for convenience.
-  HyperTextAccessible *mGeckoTextAccessible; // strong
+  mozilla::a11y::HyperTextAccessible* mGeckoTextAccessible; // strong
   nsIAccessibleEditableText *mGeckoEditableTextAccessible; // strong
 }
 @end
 
 @interface mozTextLeafAccessible : mozAccessible
 {
 }
 @end
--- a/accessible/src/mac/nsAccessNodeWrap.h
+++ b/accessible/src/mac/nsAccessNodeWrap.h
@@ -7,20 +7,26 @@
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 #ifndef _nsAccessNodeWrap_H_
 #define _nsAccessNodeWrap_H_
 
 #include "nsAccessNode.h"
 
-class nsAccessNodeWrap :  public nsAccessNode
+namespace mozilla {
+namespace a11y {
+
+class nsAccessNodeWrap : public nsAccessNode
 {
 public:
   nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsAccessNodeWrap();
 
   static void InitAccessibility();
   static void ShutdownAccessibility();
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/mac/nsAccessNodeWrap.mm
+++ b/accessible/src/mac/nsAccessNodeWrap.mm
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAccessNodeWrap.h"
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
+using namespace mozilla::a11y;
 
 /*
  * Class nsAccessNodeWrap
  */
 
 //-----------------------------------------------------
 // construction 
 //-----------------------------------------------------
--- a/accessible/src/msaa/AccessibleWrap.h
+++ b/accessible/src/msaa/AccessibleWrap.h
@@ -111,16 +111,20 @@ Class::QueryInterface(REFIID aIID, void*
 
 #define IMPL_IUNKNOWN_INHERITED2(Class, Super0, Super1, Super2)                \
   IMPL_IUNKNOWN_QUERY_HEAD(Class)                                              \
   IMPL_IUNKNOWN_QUERY_CLASS(Super1);                                           \
   IMPL_IUNKNOWN_QUERY_CLASS(Super2);                                           \
   IMPL_IUNKNOWN_QUERY_CLASS(Super0)                                            \
   IMPL_IUNKNOWN_QUERY_TAIL
 
+
+namespace mozilla {
+namespace a11y {
+
 class AccessibleWrap : public Accessible,
                        public ia2AccessibleComponent,
                        public ia2AccessibleHyperlink,
                        public ia2AccessibleValue,
                        public IAccessible2
 {
 public: // construction, destruction
   AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
@@ -365,9 +369,12 @@ protected:
     NAVRELATION_POPUP_FOR = 0x100b,
     NAVRELATION_PARENT_WINDOW_OF = 0x100c,
     NAVRELATION_DEFAULT_BUTTON = 0x100d,
     NAVRELATION_DESCRIBED_BY = 0x100e,
     NAVRELATION_DESCRIPTION_FOR = 0x100f
   };
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/msaa/Compatibility.h
+++ b/accessible/src/msaa/Compatibility.h
@@ -4,21 +4,21 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef COMPATIBILITY_MANAGER_H
 #define COMPATIBILITY_MANAGER_H
 
 #include "mozilla/StandardInteger.h"
 
-class nsAccessNodeWrap;
-
 namespace mozilla {
 namespace a11y {
 
+class nsAccessNodeWrap;
+
 /**
  * Used to get compatibility modes. Note, modes are computed at accessibility
  * start up time and aren't changed during lifetime.
  */
 class Compatibility
 {
 public:
   /**
--- a/accessible/src/msaa/DocAccessibleWrap.h
+++ b/accessible/src/msaa/DocAccessibleWrap.h
@@ -10,16 +10,19 @@
 #ifndef mozilla_a11y_DocAccessibleWrap_h__
 #define mozilla_a11y_DocAccessibleWrap_h__
 
 #include "ISimpleDOMDocument.h"
 
 #include "DocAccessible.h"
 #include "nsIDocShellTreeItem.h"
 
+namespace mozilla {
+namespace a11y {
+
 class DocAccessibleWrap : public DocAccessible,
                           public ISimpleDOMDocument
 {
 public:
   DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
                     nsIPresShell* aPresShell);
   virtual ~DocAccessibleWrap();
 
@@ -64,9 +67,12 @@ public:
 protected:
   // DocAccessible
   virtual void DoInitialUpdate();
 
 protected:
   void* mHWND;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/msaa/HyperTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/HyperTextAccessibleWrap.cpp
@@ -4,16 +4,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "HyperTextAccessibleWrap.h"
 
 #include "nsEventShell.h"
 
+using namespace mozilla;
+using namespace mozilla::a11y;
+
 NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap,
                              HyperTextAccessible)
 
 STDMETHODIMP
 HyperTextAccessibleWrap::QueryInterface(REFIID aIID, void** aInstancePtr)
 {
   if (!aInstancePtr)
     return E_FAIL;
--- a/accessible/src/msaa/HyperTextAccessibleWrap.h
+++ b/accessible/src/msaa/HyperTextAccessibleWrap.h
@@ -7,16 +7,19 @@
 
 #ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
 #define mozilla_a11y_HyperTextAccessibleWrap_h__
 
 #include "HyperTextAccessible.h"
 #include "ia2AccessibleEditableText.h"
 #include "ia2AccessibleHyperText.h"
 
+namespace mozilla {
+namespace a11y {
+
 class HyperTextAccessibleWrap : public HyperTextAccessible,
                                 public ia2AccessibleHypertext,
                                 public ia2AccessibleEditableText
 {
 public:
   HyperTextAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
     HyperTextAccessible(aContent, aDoc) {}
 
@@ -30,10 +33,12 @@ public:
   virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
 protected:
   virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
                                    uint32_t *aStartOffset,
                                    uint32_t *aEndOffset);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
-
--- a/accessible/src/msaa/nsAccessNodeWrap.h
+++ b/accessible/src/msaa/nsAccessNodeWrap.h
@@ -38,22 +38,25 @@
   __try {
 
 #define A11Y_TRYBLOCK_END                                                      \
   } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),      \
                                                     GetExceptionInformation()))\
   { }                                                                          \
   return E_FAIL;
 
+namespace mozilla {
+namespace a11y {
+
 class AccTextChangeEvent;
 
-class nsAccessNodeWrap :  public nsAccessNode,
-                          public nsIWinAccessNode,
-                          public ISimpleDOMNode,
-                          public IServiceProvider
+class nsAccessNodeWrap : public nsAccessNode,
+                         public nsIWinAccessNode,
+                         public ISimpleDOMNode,
+                         public IServiceProvider
 {
   public:
     NS_DECL_ISUPPORTS_INHERITED
     NS_DECL_NSIWINACCESSNODE
 
 public: // construction, destruction
   nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsAccessNodeWrap();
@@ -143,15 +146,18 @@ protected:
 
     /**
      * It is used in HyperTextAccessibleWrap for IA2::newText/oldText
      * implementation.
      */
     static AccTextChangeEvent* gTextEvent;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 /**
  * Converts nsresult to HRESULT.
  */
 HRESULT GetHRESULT(nsresult aResult);
 
 #endif
 
--- a/accessible/src/other/AccessibleWrap.cpp
+++ b/accessible/src/other/AccessibleWrap.cpp
@@ -1,15 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AccessibleWrap.h"
 
+using namespace mozilla::a11y;
+
 //-----------------------------------------------------
 // construction 
 //-----------------------------------------------------
 AccessibleWrap::
   AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
   Accessible(aContent, aDoc)
 {
 }
--- a/accessible/src/other/AccessibleWrap.h
+++ b/accessible/src/other/AccessibleWrap.h
@@ -2,28 +2,34 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
-#ifndef _AccessibleWrap_H_
-#define _AccessibleWrap_H_
+#ifndef mozilla_a11y_AccessibleWrap_h_
+#define mozilla_a11y_AccessibleWrap_h_
 
 #include "nsCOMPtr.h"
 #include "Accessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 class AccessibleWrap : public Accessible
 {
 public: // construction, destruction
   AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~AccessibleWrap();
 
   protected:
     virtual nsresult FirePlatformEvent(AccEvent* aEvent)
     {
       return NS_OK;
     }
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/other/DocAccessibleWrap.h
+++ b/accessible/src/other/DocAccessibleWrap.h
@@ -7,11 +7,17 @@
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 #ifndef mozilla_a11y_DocAccessibleWrap_h__
 #define mozilla_a11y_DocAccessibleWrap_h__
 
 #include "DocAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 typedef DocAccessible DocAccessibleWrap;
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/other/HyperTextAccessibleWrap.h
+++ b/accessible/src/other/HyperTextAccessibleWrap.h
@@ -3,12 +3,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
 #define mozilla_a11y_HyperTextAccessibleWrap_h__
 
 #include "HyperTextAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 typedef class HyperTextAccessible HyperTextAccessibleWrap;
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/other/nsAccessNodeWrap.cpp
+++ b/accessible/src/other/nsAccessNodeWrap.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAccessNodeWrap.h"
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
+using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Class nsAccessNodeWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 //-----------------------------------------------------
 // construction 
 //-----------------------------------------------------
--- a/accessible/src/other/nsAccessNodeWrap.h
+++ b/accessible/src/other/nsAccessNodeWrap.h
@@ -7,20 +7,26 @@
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 #ifndef _nsAccessNodeWrap_H_
 #define _nsAccessNodeWrap_H_
 
 #include "nsAccessNode.h"
 
+namespace mozilla {
+namespace a11y {
+
 class nsAccessNodeWrap :  public nsAccessNode
 {
 public: // construction, destruction
   nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsAccessNodeWrap();
 
     static void InitAccessibility();
     static void ShutdownAccessibility();
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/windows/ia2/ia2AccessibleAction.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleAction.cpp
@@ -6,16 +6,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ia2AccessibleAction.h"
 
 #include "AccessibleAction_i.c"
 
 #include "AccessibleWrap.h"
 
+using namespace mozilla::a11y;
+
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleAction::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
 
   if (IID_IAccessibleAction == iid) {
--- a/accessible/src/windows/ia2/ia2AccessibleEditableText.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleEditableText.cpp
@@ -8,16 +8,18 @@
 #include "ia2AccessibleEditableText.h"
 
 #include "AccessibleEditableText_i.c"
 #include "HyperTextAccessibleWrap.h"
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 
+using namespace mozilla::a11y;
+
 // IAccessibleEditableText
 
 STDMETHODIMP
 ia2AccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
 {
 __try {
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
--- a/accessible/src/windows/ia2/ia2AccessibleHyperlink.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleHyperlink.cpp
@@ -7,16 +7,18 @@
 
 #include "Accessible2.h"
 #include "AccessibleHyperlink.h"
 #include "AccessibleHyperlink_i.c"
 
 #include "AccessibleWrap.h"
 #include "nsIWinAccessNode.h"
 
+using namespace mozilla::a11y;
+
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
 
   if (IID_IAccessibleHyperlink == iid) {
--- a/accessible/src/windows/ia2/ia2AccessibleHypertext.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleHypertext.cpp
@@ -6,16 +6,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ia2AccessibleHypertext.h"
 
 #include "AccessibleHypertext_i.c"
 
 #include "HyperTextAccessibleWrap.h"
 
+using namespace mozilla::a11y;
+
 // IAccessibleHypertext
 
 STDMETHODIMP
 ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
 {
 __try {
   *aHyperlinkCount = 0;
 
--- a/accessible/src/windows/ia2/ia2AccessibleTableCell.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleTableCell.cpp
@@ -15,16 +15,18 @@
 #include "nsIAccessibleTable.h"
 #include "nsIWinAccessNode.h"
 #include "nsAccessNodeWrap.h"
 #include "nsWinUtils.h"
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 
+using namespace mozilla::a11y;
+
 #define TABLECELL_INTERFACE_UNSUPPORTED_MSG \
 "Subclass of ia2AccessibleTableCell doesn't implement nsIAccessibleTableCell"\
 
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleTableCell::QueryInterface(REFIID iid, void** ppv)
 {
--- a/accessible/src/windows/ia2/ia2AccessibleText.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleText.cpp
@@ -9,16 +9,18 @@
 
 #include "Accessible2.h"
 #include "AccessibleText_i.c"
 
 #include "HyperTextAccessibleWrap.h"
 
 #include "nsIPersistentProperties2.h"
 
+using namespace mozilla::a11y;
+
 // IAccessibleText
 
 STDMETHODIMP
 ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
 {
 __try {
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
--- a/accessible/src/windows/ia2/ia2AccessibleValue.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleValue.cpp
@@ -6,16 +6,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ia2AccessibleValue.h"
 
 #include "AccessibleValue_i.c"
 
 #include "AccessibleWrap.h"
 
+using namespace mozilla::a11y;
+
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleValue::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
 
   if (IID_IAccessibleValue == iid) {
--- a/accessible/src/windows/uia/uiaRawElmProvider.h
+++ b/accessible/src/windows/uia/uiaRawElmProvider.h
@@ -6,21 +6,21 @@
 
 #ifndef mozilla_a11y_uiaRawElmProvider_h__
 #define mozilla_a11y_uiaRawElmProvider_h__
 
 #include "objbase.h"
 #include "AccessibleWrap.h"
 #include "UIAutomation.h"
 
-class AccessibleWrap;
-
 namespace mozilla {
 namespace a11y {
 
+class AccessibleWrap;
+
 /**
  * IRawElementProviderSimple implementation (maintains IAccessibleEx approach).
  */
 class uiaRawElmProvider MOZ_FINAL : public IAccessibleEx,
                                     public IRawElementProviderSimple
 {
 public:
   uiaRawElmProvider(AccessibleWrap* aAcc) : mAcc(aAcc), mRefCnt(0) { }
--- a/accessible/src/xpcom/nsAccEvent.cpp
+++ b/accessible/src/xpcom/nsAccEvent.cpp
@@ -2,16 +2,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAccEvent.h"
 #include "nsAccUtils.h"
 #include "DocAccessible.h"
 
+using namespace mozilla::a11y;
+
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
 
 NS_IMETHODIMP
 nsAccEvent::GetIsFromUserInput(bool* aIsFromUserInput)
--- a/accessible/src/xpcom/nsAccEvent.h
+++ b/accessible/src/xpcom/nsAccEvent.h
@@ -5,16 +5,19 @@
 
 #ifndef _nsAccEvent_H_
 #define _nsAccEvent_H_
 
 #include "nsIAccessibleEvent.h"
 
 #include "AccEvent.h"
 
+namespace mozilla {
+namespace a11y {
+
 /**
  * Generic accessible event.
  */
 class nsAccEvent: public nsIAccessibleEvent
 {
 public:
   nsAccEvent(AccEvent* aEvent) : mEvent(aEvent) { }
   virtual ~nsAccEvent() { }
@@ -146,10 +149,13 @@ public:
   NS_DECL_NSIACCESSIBLEVIRTUALCURSORCHANGEEVENT
 
 private:
   nsAccVirtualCursorChangeEvent() MOZ_DELETE;
   nsAccVirtualCursorChangeEvent(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
   nsAccVirtualCursorChangeEvent& operator =(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/xpcom/xpcAccessibleTable.cpp
+++ b/accessible/src/xpcom/xpcAccessibleTable.cpp
@@ -7,16 +7,18 @@
 #include "xpcAccessibleTable.h"
 
 #include "Accessible.h"
 #include "TableAccessible.h"
 
 #include "nsIMutableArray.h"
 #include "nsComponentManagerUtils.h"
 
+using namespace mozilla::a11y;
+
 static const uint32_t XPC_TABLE_DEFAULT_SIZE = 40;
 
 nsresult
 xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
 {
   NS_ENSURE_ARG_POINTER(aCaption);
   *aCaption = nullptr;
   if (!mTable)
--- a/accessible/src/xpcom/xpcAccessibleTable.h
+++ b/accessible/src/xpcom/xpcAccessibleTable.h
@@ -5,24 +5,23 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
 #define MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
 
 #include "nsAString.h"
 #include "nscore.h"
 
-
 class nsIAccessible;
 class nsIArray;
+
 namespace mozilla {
 namespace a11y {
+
 class TableAccessible;
-}
-}
 
 class xpcAccessibleTable
 {
 public:
   xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
 
   nsresult GetCaption(nsIAccessible** aCaption);
   nsresult GetSummary(nsAString& aSummary);
@@ -60,9 +59,12 @@ public:
   nsresult UnselectColumn(int32_t aColIdx);
   nsresult UnselectRow(int32_t aRowIdx);
   nsresult IsProbablyForLayout(bool* aIsForLayout);
 
 protected:
   mozilla::a11y::TableAccessible* mTable;
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif // MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
--- a/accessible/src/xpcom/xpcAccessibleTableCell.h
+++ b/accessible/src/xpcom/xpcAccessibleTableCell.h
@@ -35,12 +35,13 @@ public:
   nsresult GetRowExtent(int32_t* aExtent);
   nsresult GetColumnHeaderCells(nsIArray** aHeaderCells);
   nsresult GetRowHeaderCells(nsIArray** aHeaderCells);
   nsresult IsSelected(bool* aSelected);
 
 protected:
   mozilla::a11y::TableCellAccessible* mTableCell;
 };
+
 } // namespace a11y
 } // namespace mozilla
 
 #endif // mozilla_a11y_xpcom_xpcAccessibletableCell_h_
--- a/accessible/src/xul/XULTreeAccessible.h
+++ b/accessible/src/xul/XULTreeAccessible.h
@@ -264,22 +264,22 @@ public:
 
 protected:
 
   // Accessible
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
                                          nsresult *aError = nullptr) const;
 };
 
-} // namespace a11y
-} // namespace mozilla
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
-inline mozilla::a11y::XULTreeAccessible*
+inline XULTreeAccessible*
 Accessible::AsXULTree()
 {
-  return IsXULTree() ?
-    static_cast<mozilla::a11y::XULTreeAccessible*>(this) : nullptr;
+  return IsXULTree() ? static_cast<XULTreeAccessible*>(this) : nullptr;
 }
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -71,17 +71,21 @@ class nsPIDOMWindow;
 struct nsPoint;
 struct nsIntPoint;
 struct nsIntRect;
 class nsRegion;
 class nsRefreshDriver;
 class nsARefreshObserver;
 #ifdef ACCESSIBILITY
 class nsAccessibilityService;
+namespace mozilla {
+namespace a11y {
 class DocAccessible;
+} // namespace a11y
+} // namespace mozilla
 #endif
 class nsIWidget;
 struct nsArenaMemoryStats;
 
 typedef short SelectionType;
 typedef uint64_t nsFrameState;
 
 namespace mozilla {
@@ -269,25 +273,25 @@ public:
   nsPresContext* GetPresContext() const { return mPresContext; }
 
   nsIViewManager* GetViewManager() const { return mViewManager; }
 
 #ifdef ACCESSIBILITY
   /**
    * Return the document accessible for this pres shell if there is one.
    */
-  DocAccessible* GetDocAccessible() const
+  mozilla::a11y::DocAccessible* GetDocAccessible() const
   {
     return mDocAccessible;
   }
 
   /**
    * Set the document accessible for this pres shell.
    */
-  void SetDocAccessible(DocAccessible* aDocAccessible)
+  void SetDocAccessible(mozilla::a11y::DocAccessible* aDocAccessible)
   {
     mDocAccessible = aDocAccessible;
   }
 #endif
 
 #ifdef _IMPL_NS_LAYOUT
   nsStyleSet* StyleSet() const { return mStyleSet; }
 
@@ -1372,17 +1376,17 @@ protected:
   nsPresArena               mFrameArena;
   nsFrameSelection*         mSelection;
   // Pointer into mFrameConstructor - this is purely so that FrameManager() and
   // GetRootFrame() can be inlined:
   nsFrameManagerBase*       mFrameManager;
   nsWeakPtr                 mForwardingContainer;
   nsRefreshDriver*          mHiddenInvalidationObserverRefreshDriver;
 #ifdef ACCESSIBILITY
-  DocAccessible* mDocAccessible;
+  mozilla::a11y::DocAccessible* mDocAccessible;
 #endif
 
 #ifdef DEBUG
   nsIFrame*                 mDrawEventTargetFrame;
   // Ensure that every allocation from the PresArena is eventually freed.
   uint32_t                  mPresArenaAllocCount;
 #endif
 
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -468,17 +468,17 @@ public:
 
   // Mac specific methods
   
   virtual bool      DispatchWindowEvent(nsGUIEvent& event);
 
   bool PaintWindow(nsIntRegion aRegion, bool aIsAlternate);
 
 #ifdef ACCESSIBILITY
-  already_AddRefed<Accessible> GetDocumentAccessible();
+  already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible();
 #endif
 
   virtual void CreateCompositor();
   virtual gfxASurface* GetThebesSurface();
   virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect);
 
   virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries);
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1849,31 +1849,31 @@ nsChildView::EndSecureKeyboardInput()
     ::DisableSecureEventInput();
   }
   return rv;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 #ifdef ACCESSIBILITY
-already_AddRefed<Accessible>
+already_AddRefed<a11y::Accessible>
 nsChildView::GetDocumentAccessible()
 {
   if (!mozilla::a11y::ShouldA11yBeEnabled())
     return nullptr;
 
-  Accessible *docAccessible = nullptr;
+  a11y::Accessible* docAccessible = nullptr;
   if (mAccessible) {
     CallQueryReferent(mAccessible.get(), &docAccessible);
     return docAccessible;
   }
 
   // need to fetch the accessible anew, because it has gone away.
   // cache the accessible in our weak ptr
-  Accessible* acc = GetAccessible();
+  a11y::Accessible* acc = GetAccessible();
   mAccessible = do_GetWeakReference(static_cast<nsIAccessible *>(acc));
 
   NS_IF_ADDREF(acc);
   return acc;
 }
 #endif
 
 #pragma mark -
@@ -4592,17 +4592,17 @@ static int32_t RoundUp(double aDouble)
 {
   if (!mGeckoChild)
     return nil;
 
   id<mozAccessible> nativeAccessible = nil;
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
   nsCOMPtr<nsIWidget> kungFuDeathGrip2(mGeckoChild);
-  nsRefPtr<Accessible> accessible = mGeckoChild->GetDocumentAccessible();
+  nsRefPtr<a11y::Accessible> accessible = mGeckoChild->GetDocumentAccessible();
   if (!accessible)
     return nil;
 
   accessible->GetNativeInterface((void**)&nativeAccessible);
 
 #ifdef DEBUG_hakan
   NSAssert(![nativeAccessible isExpired], @"native acc is expired!!!");
 #endif
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -5817,17 +5817,17 @@ nsWindow::DispatchEventToRootAccessible(
 
     nsCOMPtr<nsIAccessibilityService> accService =
         do_GetService("@mozilla.org/accessibilityService;1");
     if (!accService) {
         return;
     }
 
     // Get the root document accessible and fire event to it.
-    Accessible *acc = GetAccessible();
+    a11y::Accessible* acc = GetAccessible();
     if (acc) {
         accService->FireAccessibleEvent(aEventType, acc);
     }
 }
 
 void
 nsWindow::DispatchActivateEventAccessible(void)
 {
--- a/widget/gtk2/nsWindow.h
+++ b/widget/gtk2/nsWindow.h
@@ -361,17 +361,17 @@ private:
 
 #ifdef MOZ_HAVE_SHMIMAGE
     // If we're using xshm rendering, mThebesSurface wraps mShmImage
     nsRefPtr<nsShmImage>  mShmImage;
 #endif
     nsRefPtr<gfxASurface> mThebesSurface;
 
 #ifdef ACCESSIBILITY
-    nsRefPtr<Accessible> mRootAccessible;
+    nsRefPtr<mozilla::a11y::Accessible> mRootAccessible;
 
     /**
      * Request to create the accessible for this window if it is top level.
      */
     void                CreateRootAccessible();
 
     /**
      * Dispatch accessible event for the top level window accessible.
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5133,17 +5133,17 @@ bool nsWindow::ProcessMessage(UINT msg, 
 #ifdef ACCESSIBILITY
     case WM_GETOBJECT:
     {
       *aRetValue = 0;
       // Do explicit casting to make it working on 64bit systems (see bug 649236
       // for details).
       DWORD objId = static_cast<DWORD>(lParam);
       if (objId == OBJID_CLIENT) { // oleacc.dll will be loaded dynamically
-        Accessible* rootAccessible = GetRootAccessible(); // Held by a11y cache
+        a11y::Accessible* rootAccessible = GetRootAccessible(); // Held by a11y cache
         if (rootAccessible) {
           IAccessible *msaaAccessible = NULL;
           rootAccessible->GetNativeInterface((void**)&msaaAccessible); // does an addref
           if (msaaAccessible) {
             *aRetValue = LresultFromObject(IID_IAccessible, wParam, msaaAccessible); // does an addref
             msaaAccessible->Release(); // release extra addref
             result = true;  // We handled the WM_GETOBJECT message
           }
@@ -7462,17 +7462,17 @@ bool nsWindow::AssociateDefaultIMC(bool 
   NS_ASSERTION(ret, "ImmAssociateContextEx failed to disassociate the IMC");
   return ret != FALSE;
 }
 
 #ifdef ACCESSIBILITY
 
 #ifdef DEBUG_WMGETOBJECT
 #define NS_LOG_WMGETOBJECT_WNDACC(aWnd)                                        \
-  Accessible* acc = aWnd ? aWind->GetAccessible() : nullptr;                   \
+  a11y::Accessible* acc = aWnd ? aWind->GetAccessible() : nullptr;             \
   PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("     acc: %p", acc));                   \
   if (acc) {                                                                   \
     nsAutoString name;                                                         \
     acc->GetName(name);                                                        \
     PR_LOG(gWindowsLog, PR_LOG_ALWAYS,                                         \
            (", accname: %s", NS_ConvertUTF16toUTF8(name).get()));              \
     nsCOMPtr<nsIAccessibleDocument> doc = do_QueryObject(acc);                 \
     void *hwnd = nullptr;                                                      \
@@ -7500,17 +7500,17 @@ bool nsWindow::AssociateDefaultIMC(bool 
   NS_LOG_WMGETOBJECT_WNDACC(wnd);                                              \
   PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("\n }\n"));                              \
 }
 #else
 #define NS_LOG_WMGETOBJECT_THISWND
 #define NS_LOG_WMGETOBJECT_WND(aMsg, aHwnd)
 #endif // DEBUG_WMGETOBJECT
 
-Accessible*
+a11y::Accessible*
 nsWindow::GetRootAccessible()
 {
   // If the pref was ePlatformIsDisabled, return null here, disabling a11y.
   if (a11y::PlatformDisabledState() == a11y::ePlatformIsDisabled)
     return nullptr;
 
   if (mInDtor || mOnDestroyCalled || mWindowType == eWindowType_invisible) {
     return nullptr;
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -202,17 +202,17 @@ public:
   bool                    DispatchPluginEvent(UINT aMessage,
                                               WPARAM aWParam,
                                               LPARAM aLParam,
                                               bool aDispatchPendingEvents);
 
   void                    SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker
   bool                    BlurEventsSuppressed();
 #ifdef ACCESSIBILITY
-  Accessible* GetRootAccessible();
+  mozilla::a11y::Accessible* GetRootAccessible();
 #endif // ACCESSIBILITY
 
   /**
    * Window utilities
    */
   nsWindow*               GetTopLevelWindow(bool aStopOnDialogOrPopup);
   HWND                    GetWindowHandle() { return mWnd; }
   WNDPROC                 GetPrevWindowProc() { return mPrevWndProc; }
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -1391,17 +1391,17 @@ nsBaseWidget::NotifyUIStateChanged(UISta
     if (win) {
       win->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
     }
   }
 }
 
 #ifdef ACCESSIBILITY
 
-Accessible*
+a11y::Accessible*
 nsBaseWidget::GetAccessible()
 {
   NS_ENSURE_TRUE(mWidgetListener, nullptr);
 
   nsIPresShell* presShell = mWidgetListener->GetPresShell();
   NS_ENSURE_TRUE(presShell, nullptr);
 
   // If container is null then the presshell is not active. This often happens
--- a/widget/xpwidgets/nsBaseWidget.h
+++ b/widget/xpwidgets/nsBaseWidget.h
@@ -14,21 +14,23 @@
 #include "nsCOMPtr.h"
 #include "nsGUIEvent.h"
 #include "nsAutoPtr.h"
 #include "nsIRollupListener.h"
 class nsIContent;
 class nsAutoRollup;
 class gfxContext;
 
+namespace mozilla {
 #ifdef ACCESSIBILITY
+namespace a11y {
 class Accessible;
+}
 #endif
 
-namespace mozilla {
 namespace layers {
 class BasicLayerManager;
 class CompositorChild;
 class CompositorParent;
 }
 }
 
 namespace base {
@@ -167,17 +169,17 @@ public:
   // theme changes.
   void NotifySysColorChanged();
   void NotifyThemeChanged();
   void NotifyUIStateChanged(UIStateChangeType aShowAccelerators,
                             UIStateChangeType aShowFocusRings);
 
 #ifdef ACCESSIBILITY
   // Get the accessible for the window.
-  Accessible* GetAccessible();
+  mozilla::a11y::Accessible* GetAccessible();
 #endif
 
   nsPopupLevel PopupLevel() { return mPopupLevel; }
 
   virtual nsIntSize       ClientToWindowSize(const nsIntSize& aClientSize)
   {
     return aClientSize;
   }