Bug 748724 - De-ns-ify nsRootAccessible, r=surkov, f=tbsaunde
authorMark Capella <markcapella@twcny.rr.com>
Fri, 04 May 2012 15:09:22 +0900
changeset 93475 eedb454e7db23a66fad580eb6ac7811adf95df05
parent 93474 4c6759dcecd3ba2d92258e45d497af29613a4dde
child 93476 ba39b0822992dec1a16ed00647ee14a334cd5791
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssurkov
bugs748724
milestone15.0a1
Bug 748724 - De-ns-ify nsRootAccessible, r=surkov, f=tbsaunde
accessible/accessible-docs.html
accessible/src/atk/Makefile.in
accessible/src/atk/RootAccessibleWrap.cpp
accessible/src/atk/RootAccessibleWrap.h
accessible/src/atk/nsAccessibleWrap.cpp
accessible/src/atk/nsRootAccessibleWrap.cpp
accessible/src/atk/nsRootAccessibleWrap.h
accessible/src/base/FocusManager.cpp
accessible/src/base/Makefile.in
accessible/src/base/nsAccDocManager.cpp
accessible/src/base/nsAccessNode.cpp
accessible/src/base/nsAccessNode.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsCaretAccessible.cpp
accessible/src/base/nsCaretAccessible.h
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsRootAccessible.cpp
accessible/src/base/nsRootAccessible.h
accessible/src/generic/Makefile.in
accessible/src/generic/RootAccessible.cpp
accessible/src/generic/RootAccessible.h
accessible/src/mac/Makefile.in
accessible/src/mac/RootAccessibleWrap.h
accessible/src/mac/RootAccessibleWrap.mm
accessible/src/mac/mozAccessible.mm
accessible/src/mac/mozDocAccessible.h
accessible/src/mac/mozDocAccessible.mm
accessible/src/mac/nsRootAccessibleWrap.h
accessible/src/mac/nsRootAccessibleWrap.mm
accessible/src/msaa/Makefile.in
accessible/src/msaa/RootAccessibleWrap.cpp
accessible/src/msaa/RootAccessibleWrap.h
accessible/src/msaa/nsAccessNodeWrap.cpp
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsDocAccessibleWrap.cpp
accessible/src/msaa/nsRootAccessibleWrap.cpp
accessible/src/msaa/nsRootAccessibleWrap.h
accessible/src/msaa/nsWinUtils.cpp
accessible/src/other/Makefile.in
accessible/src/other/RootAccessibleWrap.h
accessible/src/other/nsRootAccessibleWrap.cpp
accessible/src/other/nsRootAccessibleWrap.h
--- a/accessible/accessible-docs.html
+++ b/accessible/accessible-docs.html
@@ -832,21 +832,21 @@ the <a
  href="http://lxr.mozilla.org/seamonkey/search?string=WM_GETOBJECT">WM_GETOBJECT</a>
 message in, nsWindow.cpp first generates an internal event called <a
  href="http://lxr.mozilla.org/seamonkey/search?string=NS_GETACCESSIBLE">NS_GETACCESSIBLE</a>,
 which is handled in <a
  href="http://lxr.mozilla.org/seamonkey/source/layout/html/base/src/nsPresShell.cpp#6345">PresShell::HandleEventInternal()</a>
 via the creation of an <a
  href="http://lxr.mozilla.org/seamonkey/find?string=msaa/nsDocAccessibleWrap">nsDocAccessibleWrap</a>
 for an inner window or <a
- href="http://lxr.mozilla.org/seamonkey/find?string=msaa/nsRootAccessibleWrap">nsRootAccessibleWrap</a>
+ href="http://lxr.mozilla.org/seamonkey/find?string=msaa/RootAccessibleWrap">RootAccessibleWrap</a>
 for a top level window. These classes implement both nsIAccessible, our
 cross platform API, as well as IAccessible, which is specific to
 Windows/MSAA/COM. The cross-platform nsDocAccessible and
-nsRootAccessible classes they inherit from are then told to start
+RootAccessible classes they inherit from are then told to start
 listening for DOM, page load and scroll events.&nbsp; These events cause
 MSAA-specific events, such as EVENT_OBJECT_FOCUS or
 EVENT_OBJECT_STATECHANGE, to fire on UI and document objects within the
 applicable window. We'll explain more about events later in this section.<br>
   </p>
   <p>Until the WM_GETOBJECT message is processed, the Gecko
 accessibility service is not used, and thus the accessibility.dll is not
 loaded, so there is almost zero overhead for accessibility API support
@@ -965,17 +965,17 @@ MSAA Events</h3>
 accessibility aids. Therefore we implement only the handful that matter.
 See the <a
  href="file:///c%7C/moz/mozdocs/mozilla-org/html/projects/ui/accessibility/accessible-architecture.html#events">Events</a>
 cheat sheet above for the list of events we implement. By far the most
 important one is EVENT_OBJECT_FOCUS.<br>
   </p>
   <p>When a potential accessibility-related event occurs within
 Mozilla, it is typically listened for by nsDocAccessible or
-nsRootAccessible. The event listeners on these classes call
+RootAccessible. The event listeners on these classes call
 FireToolkitEvent(), which is implemented for every accessible.
 Eventually, the event ends up at nsDocAccessibleWrap::FireToolkitEvent()
 which calls NotifyWinEvent from the Win32 API. NotifyWinEvent is passed
 arguments for the window the event occurred in, and the ID of the child
 within that window. Accessibility aids use the Win32 call
 SetWinEventHook() to register as a listener for these events. Creating
 a unique child ID for every object within a window can be difficult,
 see the problem and solution for <a
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -47,39 +47,38 @@ EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   AtkSocketAccessible.cpp \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
   nsDocAccessibleWrap.cpp \
-  nsRootAccessibleWrap.cpp \
   ApplicationAccessibleWrap.cpp \
   nsMaiInterfaceComponent.cpp \
   nsMaiInterfaceAction.cpp \
   nsMaiInterfaceText.cpp \
   nsMaiInterfaceEditableText.cpp \
   nsMaiInterfaceSelection.cpp \
   nsMaiInterfaceValue.cpp \
   nsMaiHyperlink.cpp \
   nsMaiInterfaceHypertext.cpp \
   nsMaiInterfaceHyperlinkImpl.cpp \
   nsMaiInterfaceTable.cpp \
   nsMaiInterfaceDocument.cpp \
   nsMaiInterfaceImage.cpp \
+  RootAccessibleWrap.cpp \
   $(NULL)
 
 EXPORTS = \
   ARIAGridAccessibleWrap.h \
   AtkSocketAccessible.h \
   nsAccessNodeWrap.h \
   nsAccessibleWrap.h \
   nsDocAccessibleWrap.h \
-  nsRootAccessibleWrap.h \
   nsTextAccessibleWrap.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   $(NULL)
rename from accessible/src/atk/nsRootAccessibleWrap.cpp
rename to accessible/src/atk/RootAccessibleWrap.cpp
--- a/accessible/src/atk/nsRootAccessibleWrap.cpp
+++ b/accessible/src/atk/RootAccessibleWrap.cpp
@@ -33,27 +33,30 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "RootAccessibleWrap.h"
+
 #include "nsMai.h"
-#include "nsRootAccessibleWrap.h"
 
-nsNativeRootAccessibleWrap::nsNativeRootAccessibleWrap(AtkObject *aAccessible):
-    nsRootAccessible(nsnull, nsnull, nsnull)
+using namespace mozilla::a11y;
+
+NativeRootAccessibleWrap::NativeRootAccessibleWrap(AtkObject* aAccessible):
+  RootAccessible(nsnull, nsnull, nsnull)
 {
   // XXX: mark the object as defunct to ensure no single internal method is
   // running on it.
   mFlags |= eIsDefunct;
 
   g_object_ref(aAccessible);
   mAtkObject = aAccessible;
 }
 
-nsNativeRootAccessibleWrap::~nsNativeRootAccessibleWrap()
+NativeRootAccessibleWrap::~NativeRootAccessibleWrap()
 {
-    g_object_unref(mAtkObject);
-    mAtkObject = nsnull;
+  g_object_unref(mAtkObject);
+  mAtkObject = nsnull;
 }
rename from accessible/src/atk/nsRootAccessibleWrap.h
rename to accessible/src/atk/RootAccessibleWrap.h
--- a/accessible/src/atk/nsRootAccessibleWrap.h
+++ b/accessible/src/atk/RootAccessibleWrap.h
@@ -33,28 +33,35 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef __NS_ROOT_ACCESSIBLE_WRAP_H__
-#define __NS_ROOT_ACCESSIBLE_WRAP_H__
+#ifndef mozilla_a11y_RootAccessibleWrap_h__
+#define mozilla_a11y_RootAccessibleWrap_h__
 
-#include "nsRootAccessible.h"
+#include "RootAccessible.h"
 
-typedef nsRootAccessible nsRootAccessibleWrap;
+namespace mozilla {
+namespace a11y {
 
-/* nsNativeRootAccessibleWrap is the accessible class for gtk+ native window.
- * The instance of nsNativeRootAccessibleWrap is a child of MaiAppRoot instance.
+typedef RootAccessible RootAccessibleWrap;
+
+/* NativeRootAccessibleWrap is the accessible class for gtk+ native window.
+ * The instance of NativeRootAccessibleWrap is a child of MaiAppRoot instance.
  * It is added into root when the toplevel window is created, and removed
  * from root when the toplevel window is destroyed.
  */
-class nsNativeRootAccessibleWrap: public nsRootAccessible
+class NativeRootAccessibleWrap : public RootAccessible
 {
 public:
-    nsNativeRootAccessibleWrap(AtkObject *aAccessible);
-    ~nsNativeRootAccessibleWrap();
+  NativeRootAccessibleWrap(AtkObject* aAccessible);
+  virtual ~NativeRootAccessibleWrap();
 };
 
-#endif   /* __NS_ROOT_ACCESSIBLE_WRAP_H__ */
+} // namespace a11y
+} // namespace mozilla
+
+#endif   /* mozilla_a11y_Root_Accessible_Wrap_h__ */
+
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -40,26 +40,26 @@
 
 #include "nsAccessibleWrap.h"
 
 #include "Accessible-inl.h"
 #include "ApplicationAccessibleWrap.h"
 #include "InterfaceInitFuncs.h"
 #include "nsAccUtils.h"
 #include "nsIAccessibleRelation.h"
-#include "nsRootAccessible.h"
-#include "nsDocAccessibleWrap.h"
+#include "RootAccessible.h"
 #include "nsIAccessibleValue.h"
 #include "nsMai.h"
 #include "nsMaiHyperlink.h"
 #include "nsString.h"
 #include "nsAutoPtr.h"
 #include "prprf.h"
 #include "nsStateMap.h"
 #include "Relation.h"
+#include "RootAccessible.h"
 #include "States.h"
 
 #include "mozilla/Util.h"
 #include "nsXPCOMStrings.h"
 #include "nsComponentManagerUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
@@ -1035,17 +1035,17 @@ nsAccessibleWrap::FirePlatformEvent(AccE
 
     case nsIAccessibleEvent::EVENT_TEXT_REMOVED:
     case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
         return FireAtkTextChangedEvent(aEvent, atkObj);
 
     case nsIAccessibleEvent::EVENT_FOCUS:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
-        nsRootAccessible* rootAccWrap = accWrap->RootAccessible();
+        a11y::RootAccessible* rootAccWrap = accWrap->RootAccessible();
         if (rootAccWrap && rootAccWrap->mActivated) {
             atk_focus_tracker_notify(atkObj);
             // Fire state change event for focus
             nsRefPtr<AccEvent> stateChangeEvent =
               new AccStateChangeEvent(accessible, states::FOCUSED, true);
             return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
         }
       } break;
@@ -1228,32 +1228,28 @@ nsAccessibleWrap::FirePlatformEvent(AccE
 
     case nsIAccessibleEvent::EVENT_MENU_END:
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_END\n"));
         break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
-        nsRootAccessible *rootAcc =
-          static_cast<nsRootAccessible *>(accessible);
-        rootAcc->mActivated = true;
+        accessible->AsRoot()->mActivated = true;
         guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
         g_signal_emit(atkObj, id, 0);
 
         // Always fire a current focus event after activation.
         FocusMgr()->ForceFocusEvent();
       } break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
-        nsRootAccessible *rootAcc =
-          static_cast<nsRootAccessible *>(accessible);
-        rootAcc->mActivated = false;
+        accessible->AsRoot()->mActivated = false;
         guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
         g_signal_emit(atkObj, id, 0);
       } break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_MAXIMIZE:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_MAXIMIZE\n"));
         guint id = g_signal_lookup ("maximize", MAI_TYPE_ATK_OBJECT);
--- a/accessible/src/base/FocusManager.cpp
+++ b/accessible/src/base/FocusManager.cpp
@@ -35,18 +35,18 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "FocusManager.h"
 
 #include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
-#include "nsRootAccessible.h"
 #include "Role.h"
+#include "RootAccessible.h"
 
 #include "nsEventStateManager.h"
 #include "nsFocusManager.h"
 
 namespace dom = mozilla::dom;
 using namespace mozilla::a11y;
 
 FocusManager::FocusManager()
@@ -152,17 +152,17 @@ FocusManager::NotifyOfDOMFocus(nsISuppor
 
   nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
   if (targetNode) {
     nsDocAccessible* document =
       GetAccService()->GetDocAccessible(targetNode->OwnerDoc());
     if (document) {
       // Set selection listener for focused element.
       if (targetNode->IsElement()) {
-        nsRootAccessible* root = document->RootAccessible();
+        RootAccessible* root = document->RootAccessible();
         nsCaretAccessible* caretAcc = root->GetCaretAccessible();
         caretAcc->SetControlSelectionListener(targetNode->AsElement());
       }
 
       document->HandleNotification<FocusManager, nsINode>
         (this, &FocusManager::ProcessDOMFocus, targetNode);
     }
   }
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -63,17 +63,16 @@ CPPSRCS = \
   nsCoreUtils.cpp \
   nsAccUtils.cpp \
   nsAccessibilityService.cpp \
   nsAccessible.cpp \
   nsAccessiblePivot.cpp \
   nsAccTreeWalker.cpp \
   nsBaseWidgetAccessible.cpp \
   nsEventShell.cpp \
-  nsRootAccessible.cpp \
   nsCaretAccessible.cpp \
   nsTextAccessible.cpp \
   nsTextEquivUtils.cpp \
   StyleInfo.cpp \
   TextAttrs.cpp \
   TextUpdater.cpp \
   $(NULL)
 
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -37,17 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAccDocManager.h"
 
 #include "ApplicationAccessible.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsARIAMap.h"
-#include "nsRootAccessibleWrap.h"
+#include "RootAccessibleWrap.h"
 #include "States.h"
 
 #include "nsCURILoader.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIContentViewer.h"
 #include "nsIDOMDocument.h"
 #include "nsEventListenerManager.h"
@@ -351,17 +351,17 @@ nsAccDocManager::AddListeners(nsIDocumen
   if (aAddDOMContentLoadedListener) {
     elm->AddEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
                                 NS_EVENT_FLAG_CAPTURE);
     NS_LOG_ACCDOCCREATE_TEXT("  added 'DOMContentLoaded' listener")
   }
 }
 
 nsDocAccessible*
-nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
+nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
 {
   // Ignore temporary, hiding, resource documents and documents without
   // docshell.
   if (aDocument->IsInitialDocument() || !aDocument->IsVisible() ||
       aDocument->IsResourceDoc() || !aDocument->IsActive())
     return nsnull;
 
   // Ignore documents without presshell and not having root frame.
@@ -386,17 +386,17 @@ nsAccDocManager::CreateDocOrRootAccessib
                  "Can't create an accessible for the document!");
     if (!parentDocAcc)
       return nsnull;
   }
 
   // We only create root accessibles for the true root, otherwise create a
   // doc accessible.
   nsRefPtr<nsDocAccessible> docAcc = isRootDoc ?
-    new nsRootAccessibleWrap(aDocument, rootElm, presShell) :
+    new RootAccessibleWrap(aDocument, rootElm, presShell) :
     new nsDocAccessibleWrap(aDocument, rootElm, presShell);
 
   // Cache the document accessible into document cache.
   if (!docAcc || !mDocAccessibleCache.Put(aDocument, docAcc))
     return nsnull;
 
   // Initialize the document accessible.
   if (!docAcc->Init()) {
--- a/accessible/src/base/nsAccessNode.cpp
+++ b/accessible/src/base/nsAccessNode.cpp
@@ -37,33 +37,35 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAccessNode.h"
 
 #include "ApplicationAccessibleWrap.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
-#include "nsRootAccessible.h"
+#include "RootAccessible.h"
 
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDOMWindow.h"
 #include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIObserverService.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsFocusManager.h"
 #include "nsPresContext.h"
 #include "mozilla/Services.h"
 
+using namespace mozilla::a11y;
+
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 nsIStringBundle *nsAccessNode::gStringBundle = 0;
 
 bool nsAccessNode::gIsFormFillEnabled = false;
 
@@ -199,17 +201,17 @@ void nsAccessNode::ShutdownXPAccessibili
   if (gApplicationAccessible) {
     gApplicationAccessible->Shutdown();
     NS_RELEASE(gApplicationAccessible);
   }
 
   NotifyA11yInitOrShutdown(false);
 }
 
-nsRootAccessible*
+RootAccessible*
 nsAccessNode::RootAccessible() const
 {
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mContent);
   NS_ASSERTION(docShellTreeItem, "No docshell tree item for mContent");
   if (!docShellTreeItem) {
     return nsnull;
   }
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -52,17 +52,22 @@
 #include "nsINameSpaceManager.h"
 #include "nsIStringBundle.h"
 #include "nsWeakReference.h"
 
 class ApplicationAccessible;
 class nsAccessNode;
 class nsDocAccessible;
 class nsIAccessibleDocument;
-class nsRootAccessible;
+
+namespace mozilla {
+namespace a11y {
+class RootAccessible;
+}
+}
 
 class nsIPresShell;
 class nsPresContext;
 class nsIFrame;
 class nsIDocShellTreeItem;
 
 #define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
 #define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
@@ -88,17 +93,17 @@ public:
   /**
    * Return the document accessible for this access node.
    */
   nsDocAccessible* Document() const { return mDoc; }
 
   /**
    * Return the root document accessible for this accessnode.
    */
-  nsRootAccessible* RootAccessible() const;
+  mozilla::a11y::RootAccessible* RootAccessible() const;
 
   /**
    * Initialize the access node object, add it to the cache.
    */
   virtual bool Init();
 
   /**
    * Shutdown the access node object.
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -52,21 +52,21 @@
 #include "nsIAccessibleProvider.h"
 #include "nsHTMLCanvasAccessible.h"
 #include "nsHTMLImageMapAccessible.h"
 #include "nsHTMLLinkAccessible.h"
 #include "nsHTMLSelectAccessible.h"
 #include "nsHTMLTableAccessibleWrap.h"
 #include "nsHTMLTextAccessible.h"
 #include "nsHyperTextAccessibleWrap.h"
-#include "nsRootAccessibleWrap.h"
 #include "nsXFormsFormControlsAccessible.h"
 #include "nsXFormsWidgetsAccessible.h"
 #include "OuterDocAccessible.h"
 #include "Role.h"
+#include "RootAccessibleWrap.h"
 #include "States.h"
 #include "Statistics.h"
 #ifdef XP_WIN
 #include "nsHTMLWin32ObjectAccessible.h"
 #endif
 
 #include "nsCURILoader.h"
 #include "nsEventStates.h"
@@ -652,17 +652,17 @@ nsAccessibilityService::PresShellDestroy
 
 void
 nsAccessibilityService::PresShellActivated(nsIPresShell* aPresShell)
 {
   nsIDocument* DOMDoc = aPresShell->GetDocument();
   if (DOMDoc) {
     nsDocAccessible* document = GetDocAccessibleFromCache(DOMDoc);
     if (document) {
-      nsRootAccessible* rootDocument = document->RootAccessible();
+      RootAccessible* rootDocument = document->RootAccessible();
       NS_ASSERTION(rootDocument, "Entirely broken tree: no root document!");
       if (rootDocument)
         rootDocument->DocumentActivated(document);
     }
   }
 }
 
 void
@@ -1723,34 +1723,34 @@ nsAccessibilityService::CreateHTMLAccess
   return nsnull;
  }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibilityService (DON'T put methods here)
 
 nsAccessible*
 nsAccessibilityService::AddNativeRootAccessible(void* aAtkAccessible)
- {
+{
 #ifdef MOZ_ACCESSIBILITY_ATK
   ApplicationAccessible* applicationAcc =
     nsAccessNode::GetApplicationAccessible();
   if (!applicationAcc)
     return nsnull;
 
-  nsRefPtr<nsNativeRootAccessibleWrap> nativeRootAcc =
-     new nsNativeRootAccessibleWrap((AtkObject*)aAtkAccessible);
+  nsRefPtr<NativeRootAccessibleWrap> nativeRootAcc =
+    new NativeRootAccessibleWrap(static_cast<AtkObject*>(aAtkAccessible));
   if (!nativeRootAcc)
     return nsnull;
 
   if (applicationAcc->AppendChild(nativeRootAcc))
     return nativeRootAcc;
 #endif
 
   return nsnull;
- }
+}
 
 void
 nsAccessibilityService::RemoveNativeRootAccessible(nsAccessible* aAccessible)
 {
 #ifdef MOZ_ACCESSIBILITY_ATK
   ApplicationAccessible* applicationAcc =
     nsAccessNode::GetApplicationAccessible();
 
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -45,20 +45,20 @@
 #include "AccIterator.h"
 #include "nsAccUtils.h"
 #include "nsAccEvent.h"
 #include "nsAccessibleRelation.h"
 #include "nsAccessibilityService.h"
 #include "nsAccTreeWalker.h"
 #include "nsIAccessibleRelation.h"
 #include "nsEventShell.h"
-#include "nsRootAccessible.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
+#include "RootAccessible.h"
 #include "States.h"
 #include "StyleInfo.h"
 
 #include "nsIDOMCSSValue.h"
 #include "nsIDOMCSSPrimitiveValue.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentXBL.h"
@@ -252,18 +252,17 @@ nsAccessible::GetDOMNode(nsIDOMNode **aD
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessible::GetRootDocument(nsIAccessibleDocument **aRootDocument)
 {
   NS_ENSURE_ARG_POINTER(aRootDocument);
 
-  nsRootAccessible* rootDocument = RootAccessible();
-  NS_IF_ADDREF(*aRootDocument = rootDocument);
+  NS_IF_ADDREF(*aRootDocument = RootAccessible());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessible::GetLanguage(nsAString& aLanguage)
 {
   Language(aLanguage);
   return NS_OK;
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -484,17 +484,17 @@ public:
 
   inline bool IsListControl() const { return mFlags & eListControlAccessible; }
 
   inline bool IsMenuButton() const { return mFlags & eMenuButtonAccessible; }
 
   inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
 
   inline bool IsRoot() const { return mFlags & eRootAccessible; }
-  nsRootAccessible* AsRoot();
+  mozilla::a11y::RootAccessible* AsRoot();
 
   virtual mozilla::a11y::TableAccessible* AsTable() { return nsnull; }
 
   inline bool IsTextLeaf() const { return mFlags & eTextLeafAccessible; }
   nsTextAccessible* AsTextLeaf();
 
   //////////////////////////////////////////////////////////////////////////////
   // ActionAccessible
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -36,45 +36,47 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCaretAccessible.h"
 
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsIAccessibleEvent.h"
+#include "RootAccessible.h"
 
 #include "nsCaret.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
-#include "nsRootAccessible.h"
 #include "nsISelectionPrivate.h"
 #include "nsServiceManagerUtils.h"
 
 class nsIWidget;
 
+using namespace mozilla::a11y;
+
 NS_IMPL_ISUPPORTS1(nsCaretAccessible, nsISelectionListener)
   
-nsCaretAccessible::nsCaretAccessible( nsRootAccessible *aRootAccessible):
+nsCaretAccessible::nsCaretAccessible(RootAccessible* aRootAccessible) :
 mLastCaretOffset(-1), mRootAccessible(aRootAccessible)
 {
 }
 
 nsCaretAccessible::~nsCaretAccessible()
 {
 }
 
 void nsCaretAccessible::Shutdown()
 {
-  // The caret accessible isn't shut down until the nsRootAccessible owning it is shut down
-  // Each nsDocAccessible, including the nsRootAccessible, is responsible for clearing the
+  // The caret accessible isn't shut down until the RootAccessible owning it is shut down
+  // Each nsDocAccessible, including the RootAccessible, is responsible for clearing the
   // doc selection listeners they registered in this nsCaretAccessible
 
   ClearControlSelectionListener(); // Clear the selection listener for the currently focused control
   mLastTextAccessible = nsnull;
   mLastUsedSelection = nsnull;
   mRootAccessible = nsnull;
 }
 
--- a/accessible/src/base/nsCaretAccessible.h
+++ b/accessible/src/base/nsCaretAccessible.h
@@ -38,46 +38,44 @@
 #ifndef __nsCaretAccessible_h__
 #define __nsCaretAccessible_h__
 
 #include "NotificationController.h"
 #include "nsHyperTextAccessible.h"
 
 #include "nsISelectionListener.h"
 
-class nsRootAccessible;
-
 /*
  * This special accessibility class is for the caret, which is really the currently focused selection.
- * There is only 1 visible caret per top level window (nsRootAccessible),
+ * There is only 1 visible caret per top level window (RootAccessible),
  * However, there may be several visible selections.
  *
  * The important selections are the one owned by each document, and the one in the currently focused control.
  *
  * The caret accessible is no longer an accessible object in its own right.
  * On Windows it is used to move an invisible system caret that shadows the Mozilla caret. Windows will
  * also automatically map this to the MSAA caret accessible object (via OBJID_CARET).
  * (as opposed to the root accessible tree for a window which is retrieved with OBJID_CLIENT)
  * For ATK and Iaccessible2, the caret accessible is used to fire
  * caret move and selection change events.
  *
- * The caret accessible is owned by the nsRootAccessible for the top level window that it's in.
- * The nsRootAccessible needs to tell the nsCaretAccessible about focus changes via
+ * The caret accessible is owned by the RootAccessible for the top level window that it's in.
+ * The RootAccessible needs to tell the nsCaretAccessible about focus changes via
  * setControlSelectionListener().
  * Each nsDocAccessible needs to tell the nsCaretAccessible owned by the root to
  * listen for selection events via addDocSelectionListener() and then needs to remove the 
  * selection listener when the doc goes away via removeDocSelectionListener().
  */
 
 class nsCaretAccessible : public nsISelectionListener
 {
 public:
   NS_DECL_ISUPPORTS
 
-  nsCaretAccessible(nsRootAccessible *aRootAccessible);
+  nsCaretAccessible(mozilla::a11y::RootAccessible* aRootAccessible);
   virtual ~nsCaretAccessible();
   void Shutdown();
 
   /* ----- nsISelectionListener ---- */
   NS_DECL_NSISELECTIONLISTENER
 
   /**
    * Listen to selection events on the focused control.
@@ -150,12 +148,12 @@ private:
 
   // 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<nsHyperTextAccessible> mLastTextAccessible;
   PRInt32 mLastCaretOffset;
 
-  nsRootAccessible *mRootAccessible;
+  mozilla::a11y::RootAccessible* mRootAccessible;
 };
 
 #endif
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -38,19 +38,19 @@
 
 #include "Accessible-inl.h"
 #include "AccIterator.h"
 #include "nsAccCache.h"
 #include "nsAccessibilityService.h"
 #include "nsAccessiblePivot.h"
 #include "nsAccTreeWalker.h"
 #include "nsAccUtils.h"
-#include "nsRootAccessible.h"
 #include "nsTextEquivUtils.h"
 #include "Role.h"
+#include "RootAccessible.h"
 #include "States.h"
 
 #include "nsIMutableArray.h"
 #include "nsICommandManager.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocument.h"
 #include "nsIDOMAttr.h"
@@ -759,17 +759,17 @@ nsresult nsDocAccessible::AddEventListen
     if (commandManager) {
       commandManager->AddCommandObserver(this, "obs_documentCreated");
     }
   }
 
   nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
   docShellTreeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
   if (rootTreeItem) {
-    nsRootAccessible* rootAccessible = RootAccessible();
+    a11y::RootAccessible* rootAccessible = RootAccessible();
     NS_ENSURE_TRUE(rootAccessible, NS_ERROR_FAILURE);
     nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
     if (caretAccessible) {
       caretAccessible->AddDocSelectionListener(mPresShell);
     }
   }
 
   // add document observer
@@ -806,17 +806,17 @@ nsresult nsDocAccessible::RemoveEventLis
   }
 
   if (mScrollWatchTimer) {
     mScrollWatchTimer->Cancel();
     mScrollWatchTimer = nsnull;
     NS_RELEASE_THIS(); // Kung fu death grip
   }
 
-  nsRootAccessible* rootAccessible = RootAccessible();
+  a11y::RootAccessible* rootAccessible = RootAccessible();
   if (rootAccessible) {
     nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
     if (caretAccessible)
       caretAccessible->RemoveDocSelectionListener(mPresShell);
   }
 
   return NS_OK;
 }
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -14,21 +14,24 @@ LIBRARY_NAME = accessibility_generic_s
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   ApplicationAccessible.cpp \
   ARIAGridAccessible.cpp \
   FormControlAccessible.cpp \
   OuterDocAccessible.cpp \
+  RootAccessible.cpp \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES = \
   -I$(srcdir)/../xpcom \
   -I$(srcdir)/../base \
+  -I$(srcdir)/../html \
+  -I$(srcdir)/../xul \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/xul/base/src \
   $(NULL)
rename from accessible/src/base/nsRootAccessible.cpp
rename to accessible/src/generic/RootAccessible.cpp
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -30,16 +30,18 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "RootAccessible.h"
+
 #include "mozilla/Util.h"
 
 #define CreateEvent CreateEventA
 #include "nsIDOMDocument.h"
 
 #include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
@@ -71,70 +73,69 @@
 #include "nsIFrame.h"
 #include "nsIHTMLDocument.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionPrivate.h"
 #include "nsIServiceManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsReadableUtils.h"
-#include "nsRootAccessible.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsFocusManager.h"
 
 #ifdef MOZ_XUL
 #include "nsXULTreeAccessible.h"
 #include "nsIXULDocument.h"
 #include "nsIXULWindow.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsRootAccessible, nsDocAccessible, nsIAccessibleDocument)
+NS_IMPL_ISUPPORTS_INHERITED1(RootAccessible, nsDocAccessible, nsIAccessibleDocument)
 
 ////////////////////////////////////////////////////////////////////////////////
-// Constructor/desctructor
+// Constructor/destructor
 
-nsRootAccessible::
-  nsRootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
-                   nsIPresShell* aPresShell) :
+RootAccessible::
+  RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
+                 nsIPresShell* aPresShell) :
   nsDocAccessibleWrap(aDocument, aRootContent, aPresShell)
 {
   mFlags |= eRootAccessible;
 }
 
-nsRootAccessible::~nsRootAccessible()
+RootAccessible::~RootAccessible()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible
 
 ENameValueFlag
-nsRootAccessible::Name(nsString& aName)
+RootAccessible::Name(nsString& aName)
 {
   aName.Truncate();
 
   if (mRoleMapEntry) {
     nsAccessible::Name(aName);
     if (!aName.IsEmpty())
       return eNameOK;
   }
 
   nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocument);
   document->GetTitle(aName);
   return eNameOK;
 }
 
 role
-nsRootAccessible::NativeRole()
+RootAccessible::NativeRole()
 {
   // If it's a <dialog> or <wizard>, use roles::DIALOG instead
   dom::Element *root = mDocument->GetRootElement();
   if (root) {
     nsCOMPtr<nsIDOMElement> rootElement(do_QueryInterface(root));
     if (rootElement) {
       nsAutoString name;
       rootElement->GetLocalName(name);
@@ -142,19 +143,20 @@ nsRootAccessible::NativeRole()
         return roles::DIALOG; // Always at the root
       }
     }
   }
 
   return nsDocAccessibleWrap::NativeRole();
 }
 
-// nsRootAccessible protected member
+// RootAccessible protected member
 #ifdef MOZ_XUL
-PRUint32 nsRootAccessible::GetChromeFlags()
+PRUint32
+RootAccessible::GetChromeFlags()
 {
   // Return the flag set for the top level window as defined 
   // by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
   // Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
   nsCOMPtr<nsIDocShellTreeItem> treeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mDocument);
   NS_ENSURE_TRUE(treeItem, 0);
   nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
@@ -166,17 +168,17 @@ PRUint32 nsRootAccessible::GetChromeFlag
   }
   PRUint32 chromeFlags;
   xulWin->GetChromeFlags(&chromeFlags);
   return chromeFlags;
 }
 #endif
 
 PRUint64
-nsRootAccessible::NativeState()
+RootAccessible::NativeState()
 {
   PRUint64 states = nsDocAccessibleWrap::NativeState();
 
 #ifdef MOZ_XUL
   PRUint32 chromeFlags = GetChromeFlags();
   if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
     states |= states::SIZEABLE;
     // If it has a titlebar it's movable
@@ -226,17 +228,18 @@ const char* const docEvents[] = {
   "popuphiding",
   "DOMMenuInactive",
   "DOMMenuItemActive",
   "DOMMenuItemInactive",
   "DOMMenuBarActive",
   "DOMMenuBarInactive"
 };
 
-nsresult nsRootAccessible::AddEventListeners()
+nsresult
+RootAccessible::AddEventListeners()
 {
   // nsIDOMEventTarget interface allows to register event listeners to
   // receive untrusted events (synthetic events generated by untrusted code).
   // For example, XBL bindings implementations for elements that are hosted in
   // non chrome document fire untrusted events.
   nsCOMPtr<nsIDOMEventTarget> nstarget(do_QueryInterface(mDocument));
 
   if (nstarget) {
@@ -251,17 +254,18 @@ nsresult nsRootAccessible::AddEventListe
 
   if (!mCaretAccessible) {
     mCaretAccessible = new nsCaretAccessible(this);
   }
 
   return nsDocAccessible::AddEventListeners();
 }
 
-nsresult nsRootAccessible::RemoveEventListeners()
+nsresult
+RootAccessible::RemoveEventListeners()
 {
   nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
   if (target) { 
     for (const char* const* e = docEvents,
                    * const* e_end = ArrayEnd(docEvents);
          e < e_end; ++e) {
       nsresult rv = target->RemoveEventListener(NS_ConvertASCIItoUTF16(*e), this, true);
       NS_ENSURE_SUCCESS(rv, rv);
@@ -279,31 +283,31 @@ nsresult nsRootAccessible::RemoveEventLi
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // public
 
 nsCaretAccessible*
-nsRootAccessible::GetCaretAccessible()
+RootAccessible::GetCaretAccessible()
 {
   return mCaretAccessible;
 }
 
 void
-nsRootAccessible::DocumentActivated(nsDocAccessible* aDocument)
+RootAccessible::DocumentActivated(nsDocAccessible* aDocument)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIDOMEventListener
 
 NS_IMETHODIMP
-nsRootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
+RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
 {
   nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
   nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
   DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
   nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
   if (!origTargetNode)
     return NS_OK;
 
@@ -330,26 +334,26 @@ nsRootAccessible::HandleEvent(nsIDOMEven
              NS_ConvertUTF16toUTF8(tag).get(), id.get(),
              NS_ConvertUTF16toUTF8(eventType).get());
     }
 #endif
 
     // Root accessible exists longer than any of its descendant documents so
     // that we are guaranteed notification is processed before root accessible
     // is destroyed.
-    document->HandleNotification<nsRootAccessible, nsIDOMEvent>
-      (this, &nsRootAccessible::ProcessDOMEvent, aDOMEvent);
+    document->HandleNotification<RootAccessible, nsIDOMEvent>
+      (this, &RootAccessible::ProcessDOMEvent, aDOMEvent);
   }
 
   return NS_OK;
 }
 
-// nsRootAccessible protected
+// RootAccessible protected
 void
-nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
+RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
 {
   nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
   nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
   DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
   nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
 
   nsAutoString eventType;
   aDOMEvent->GetType(eventType);
@@ -529,28 +533,28 @@ nsRootAccessible::ProcessDOMEvent(nsIDOM
 #endif
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNode
 
 void
-nsRootAccessible::Shutdown()
+RootAccessible::Shutdown()
 {
   // Called manually or by nsAccessNode::LastRelease()
   if (!PresShell())
     return;  // Already shutdown
 
   nsDocAccessibleWrap::Shutdown();
 }
 
 // nsIAccessible method
 Relation
-nsRootAccessible::RelationByType(PRUint32 aType)
+RootAccessible::RelationByType(PRUint32 aType)
 {
   if (!mDocument || aType != nsIAccessibleRelation::RELATION_EMBEDS)
     return nsDocAccessibleWrap::RelationByType(aType);
 
   nsIDOMWindow* rootWindow = mDocument->GetWindow();
   if (rootWindow) {
     nsCOMPtr<nsIDOMWindow> contentWindow;
     rootWindow->GetContent(getter_AddRefs(contentWindow));
@@ -570,17 +574,17 @@ nsRootAccessible::RelationByType(PRUint3
 
   return Relation();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected members
 
 void
-nsRootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
+RootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
 {
   roles::Role role = aAccessible->Role();
 
   if (role == roles::MENUPOPUP) {
     // Don't fire menupopup events for combobox and autocomplete lists.
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
                             aAccessible);
     return;
@@ -608,17 +612,17 @@ nsRootAccessible::HandlePopupShownEvent(
         new AccStateChangeEvent(combobox, states::EXPANDED, true);
       if (event)
         nsEventShell::FireEvent(event);
     }
   }
 }
 
 void
-nsRootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
+RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
 {
   // Get popup accessible. There are cases when popup element isn't accessible
   // but an underlying widget is and behaves like popup, an example is
   // autocomplete popups.
   nsDocAccessible* document = nsAccUtils::GetDocAccessibleFor(aPopupNode);
   if (!document)
     return;
 
@@ -713,18 +717,18 @@ nsRootAccessible::HandlePopupHidingEvent
     nsRefPtr<AccEvent> event =
       new AccStateChangeEvent(widget, states::EXPANDED, false);
     document->FireDelayedAccessibleEvent(event);
   }
 }
 
 #ifdef MOZ_XUL
 void
-nsRootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
-                                                 nsXULTreeAccessible* aAccessible)
+RootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
+                                               nsXULTreeAccessible* aAccessible)
 {
   nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent));
   if (!dataEvent)
     return;
 
   nsCOMPtr<nsIVariant> indexVariant;
   dataEvent->GetData(NS_LITERAL_STRING("index"),
                      getter_AddRefs(indexVariant));
@@ -740,18 +744,18 @@ nsRootAccessible::HandleTreeRowCountChan
   PRInt32 index, count;
   indexVariant->GetAsInt32(&index);
   countVariant->GetAsInt32(&count);
 
   aAccessible->InvalidateCache(index, count);
 }
 
 void
-nsRootAccessible::HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
-                                             nsXULTreeAccessible* aAccessible)
+RootAccessible::HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
+                                           nsXULTreeAccessible* aAccessible)
 {
   nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent));
   if (!dataEvent)
     return;
 
   PRInt32 startRow = 0, endRow = -1, startCol = 0, endCol = -1;
 
   nsCOMPtr<nsIVariant> startRowVariant;
rename from accessible/src/base/nsRootAccessible.h
rename to accessible/src/generic/RootAccessible.h
--- a/accessible/src/base/nsRootAccessible.h
+++ b/accessible/src/generic/RootAccessible.h
@@ -30,56 +30,57 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef _nsRootAccessible_H_
-#define _nsRootAccessible_H_
+#ifndef mozilla_a11y_RootAccessible_h__
+#define mozilla_a11y_RootAccessible_h__
 
 #include "nsCaretAccessible.h"
 #include "nsDocAccessibleWrap.h"
 
 
 #include "nsHashtable.h"
 #include "nsCaretAccessible.h"
 #include "nsIDocument.h"
 #include "nsIDOMEventListener.h"
 
 class nsXULTreeAccessible;
 class Relation;
 
-const PRInt32 SCROLL_HASH_START_SIZE = 6;
+namespace mozilla {
+namespace a11y {
 
-class nsRootAccessible : public nsDocAccessibleWrap,
-                         public nsIDOMEventListener
+class RootAccessible : public nsDocAccessibleWrap,
+                       public nsIDOMEventListener
 {
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
-  nsRootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
-                   nsIPresShell* aPresShell);
-  virtual ~nsRootAccessible();
+  RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
+                 nsIPresShell* aPresShell);
+  virtual ~RootAccessible();
 
   // nsIDOMEventListener
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
   virtual Relation RelationByType(PRUint32 aType);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
-  // nsRootAccessible
+  // RootAccessible
   nsCaretAccessible* GetCaretAccessible();
 
   /**
    * Notify that the sub document presshell was activated.
    */
   virtual void DocumentActivated(nsDocAccessible* aDocument);
 
 protected:
@@ -112,16 +113,19 @@ protected:
                                     nsXULTreeAccessible* aAccessible);
 
     PRUint32 GetChromeFlags();
 #endif
 
     nsRefPtr<nsCaretAccessible> mCaretAccessible;
 };
 
-inline nsRootAccessible*
+} // namespace a11y
+} // namespace mozilla
+
+inline mozilla::a11y::RootAccessible*
 nsAccessible::AsRoot()
 {
   return mFlags & eRootAccessible ?
-    static_cast<nsRootAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::RootAccessible*>(this) : nsnull;
 }
 
 #endif
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -45,34 +45,33 @@ MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
 EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
   
   
 CMMSRCS = nsAccessNodeWrap.mm \
           nsDocAccessibleWrap.mm \
-          nsRootAccessibleWrap.mm \
           nsAccessibleWrap.mm \
           mozAccessible.mm \
           mozDocAccessible.mm \
           mozActionElements.mm \
           mozTextAccessible.mm \
           mozHTMLAccessible.mm \
           MacUtils.mm \
+          RootAccessibleWrap.mm \
           $(NULL)
 
 
 EXPORTS = \
   ARIAGridAccessibleWrap.h \
   nsAccessNodeWrap.h \
   nsTextAccessibleWrap.h \
   nsAccessibleWrap.h \
   nsDocAccessibleWrap.h \
-  nsRootAccessibleWrap.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   mozDocAccessible.h \
   mozAccessible.h \
rename from accessible/src/mac/nsRootAccessibleWrap.h
rename to accessible/src/mac/RootAccessibleWrap.h
--- a/accessible/src/mac/nsRootAccessibleWrap.h
+++ b/accessible/src/mac/RootAccessibleWrap.h
@@ -35,31 +35,36 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
-#ifndef _nsRootAccessibleWrap_H_
-#define _nsRootAccessibleWrap_H_
+#ifndef mozilla_a11y_RootAccessibleWrap_h__
+#define mozilla_a11y_RootAccessibleWrap_h__
 
-#include "nsRootAccessible.h"
+#include "RootAccessible.h"
+
+namespace mozilla {
+namespace a11y {
 
 struct objc_class;
 
-class nsRootAccessibleWrap : public nsRootAccessible
+class RootAccessibleWrap : public RootAccessible
 {
 public:
-  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIPresShell* aPresShell);
-  virtual ~nsRootAccessibleWrap();
+  RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                     nsIPresShell* aPresShell);
+  virtual ~RootAccessibleWrap();
 
     Class GetNativeType ();
     
     // let's our native accessible get in touch with the
     // native cocoa view that is our accessible parent.
     void GetNativeWidget (void **aOutView);
 };
 
+} // namespace a11y
+} // namespace mozilla
 
 #endif
rename from accessible/src/mac/nsRootAccessibleWrap.mm
rename to accessible/src/mac/RootAccessibleWrap.mm
--- a/accessible/src/mac/nsRootAccessibleWrap.mm
+++ b/accessible/src/mac/RootAccessibleWrap.mm
@@ -31,48 +31,50 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsRootAccessibleWrap.h"
+#include "RootAccessibleWrap.h"
 
 #include "mozDocAccessible.h"
 
 #include "nsCOMPtr.h"
 #include "nsObjCExceptions.h"
 #include "nsIWidget.h"
 #include "nsIViewManager.h"
 
-nsRootAccessibleWrap::
-  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIPresShell* aPresShell) :
-  nsRootAccessible(aDocument, aRootContent, aPresShell)
+using namespace mozilla::a11y;
+
+RootAccessibleWrap::
+  RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                     nsIPresShell* aPresShell) :
+  RootAccessible(aDocument, aRootContent, aPresShell)
 {
 }
 
-nsRootAccessibleWrap::~nsRootAccessibleWrap()
+RootAccessibleWrap::~RootAccessibleWrap()
 {
 }
 
 Class
-nsRootAccessibleWrap::GetNativeType ()
+RootAccessibleWrap::GetNativeType()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   return [mozRootAccessible class];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 void
-nsRootAccessibleWrap::GetNativeWidget (void **aOutView)
+RootAccessibleWrap::GetNativeWidget(void** aOutView)
 {
   nsIFrame *frame = GetFrame();
   if (frame) {
     nsIView *view = frame->GetViewExternal();
     if (view) {
       nsIWidget *widget = view->GetWidget();
       if (widget) {
         *aOutView = (void**)widget->GetNativeData (NS_NATIVE_WIDGET);
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -40,19 +40,19 @@
 
 #import "MacUtils.h"
 #import "mozView.h"
 
 #include "Accessible-inl.h"
 #include "nsIAccessibleRelation.h"
 #include "nsIAccessibleText.h"
 #include "nsIAccessibleEditableText.h"
-#include "nsRootAccessible.h"
 #include "Relation.h"
 #include "Role.h"
+#include "RootAccessible.h"
 
 #include "mozilla/Services.h"
 #include "nsRect.h"
 #include "nsCocoaUtils.h"
 #include "nsCoord.h"
 #include "nsObjCExceptions.h"
 
 using namespace mozilla;
@@ -348,17 +348,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
       return GetClosestInterestingAccessible(nativeParent);
   }
   
   // GetUnignoredParent() returns null when there is no unignored accessible all the way up to
   // the root accessible. so we'll have to return whatever native accessible is above our root accessible 
   // (which might be the owning NSWindow in the application, for example).
   //
   // get the native root accessible, and tell it to return its first parent unignored accessible.
-  nsRootAccessible* root = mGeckoAccessible->RootAccessible();
+  RootAccessible* root = mGeckoAccessible->RootAccessible();
   id nativeParent = GetNativeFromGeckoAccessible(static_cast<nsIAccessible*>(root));
   NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
   
   return GetClosestInterestingAccessible(nativeParent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
--- a/accessible/src/mac/mozDocAccessible.h
+++ b/accessible/src/mac/mozDocAccessible.h
@@ -39,17 +39,17 @@
 #import <Cocoa/Cocoa.h>
 #import "mozAccessible.h"
 
 // our protocol that we implement (so cocoa widgets can talk to us)
 #import "mozAccessibleProtocol.h"
 
 /* 
   The root accessible. There is one per window.
-  Created by the nsRootAccessibleWrap.
+  Created by the RootAccessibleWrap.
 */
 @interface mozRootAccessible : mozAccessible
 {
   // the mozView that we're representing.
   // all outside communication goes through the mozView.
   // in reality, it's just piping all calls to us, and we're
   // doing its dirty work!
   //
--- a/accessible/src/mac/mozDocAccessible.mm
+++ b/accessible/src/mac/mozDocAccessible.mm
@@ -31,26 +31,30 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsRootAccessibleWrap.h"
 #include "nsObjCExceptions.h"
+#include "RootAccessibleWrap.h"
 
 #import "mozDocAccessible.h"
 
 #import "mozView.h"
 
-static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible *accessible)
+using namespace mozilla::a11y;
+
+static id <mozAccessible, mozView> 
+getNativeViewFromRootAccessible(nsAccessible* aAccessible)
 {
-  nsRootAccessibleWrap *root = static_cast<nsRootAccessibleWrap*>(accessible);
+  RootAccessibleWrap* root =
+    static_cast<RootAccessibleWrap*>(aAccessible->AsRoot());
   id <mozAccessible, mozView> nativeView = nil;
   root->GetNativeWidget ((void**)&nativeView);
   return nativeView;
 }
 
 #pragma mark -
 
 @implementation mozRootAccessible
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -50,17 +50,16 @@ LIBXUL_LIBRARY = 1
 CPPSRCS = \
   ApplicationAccessibleWrap.cpp \
   ARIAGridAccessibleWrap.cpp \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
   nsTextAccessibleWrap.cpp \
   nsDocAccessibleWrap.cpp \
   nsHTMLWin32ObjectAccessible.cpp \
-  nsRootAccessibleWrap.cpp \
   nsXULMenuAccessibleWrap.cpp \
   nsXULListboxAccessibleWrap.cpp \
   nsXULTreeGridAccessibleWrap.cpp \
   nsHyperTextAccessibleWrap.cpp \
   nsHTMLImageAccessibleWrap.cpp \
   nsHTMLTableAccessibleWrap.cpp \
   nsWinUtils.cpp \
   ia2AccessibleAction.cpp \
@@ -70,25 +69,25 @@ CPPSRCS = \
   CAccessibleEditableText.cpp \
   CAccessibleHyperlink.cpp \
   ia2AccessibleHypertext.cpp \
   ia2AccessibleRelation.cpp \
   CAccessibleTable.cpp \
   CAccessibleTableCell.cpp \
   CAccessibleValue.cpp \
   Compatibility.cpp \
+  RootAccessibleWrap.cpp \
   $(NULL)
 
 EXPORTS = \
   ARIAGridAccessibleWrap.h \
   nsAccessNodeWrap.h \
   nsAccessibleWrap.h \
   nsTextAccessibleWrap.h \
   nsDocAccessibleWrap.h \
-  nsRootAccessibleWrap.h \
   nsHTMLWin32ObjectAccessible.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   ia2AccessibleAction.h \
rename from accessible/src/msaa/nsRootAccessibleWrap.cpp
rename to accessible/src/msaa/RootAccessibleWrap.cpp
--- a/accessible/src/msaa/nsRootAccessibleWrap.cpp
+++ b/accessible/src/msaa/RootAccessibleWrap.cpp
@@ -31,45 +31,45 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsRootAccessibleWrap.h"
+#include "RootAccessibleWrap.h"
 
 #include "Compatibility.h"
 #include "nsWinUtils.h"
 
 #include "nsIDOMEventTarget.h"
 #include "nsEventListenerManager.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
-nsRootAccessibleWrap::
-  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIPresShell* aPresShell) :
-  nsRootAccessible(aDocument, aRootContent, aPresShell)
+RootAccessibleWrap::
+  RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                     nsIPresShell* aPresShell) :
+  RootAccessible(aDocument, aRootContent, aPresShell)
 {
 }
 
-nsRootAccessibleWrap::~nsRootAccessibleWrap()
+RootAccessibleWrap::~RootAccessibleWrap()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsRootAccessible
+// RootAccessible
 
 void
-nsRootAccessibleWrap::DocumentActivated(nsDocAccessible* aDocument)
+RootAccessibleWrap::DocumentActivated(nsDocAccessible* aDocument)
 {
   if (Compatibility::IsDolphin() &&
       nsCoreUtils::IsTabDocument(aDocument->GetDocumentNode())) {
     PRUint32 count = mChildDocuments.Length();
     for (PRUint32 idx = 0; idx < count; idx++) {
       nsDocAccessible* childDoc = mChildDocuments[idx];
       HWND childDocHWND = static_cast<HWND>(childDoc->GetNativeWindow());
       if (childDoc != aDocument)
rename from accessible/src/msaa/nsRootAccessibleWrap.h
rename to accessible/src/msaa/RootAccessibleWrap.h
--- a/accessible/src/msaa/nsRootAccessibleWrap.h
+++ b/accessible/src/msaa/RootAccessibleWrap.h
@@ -32,25 +32,31 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef _nsRootAccessibleWrap_H_
-#define _nsRootAccessibleWrap_H_
+#ifndef mozilla_a11y_RootAccessibleWrap_h__
+#define mozilla_a11y_RootAccessibleWrap_h__
+
+#include "RootAccessible.h"
 
-#include "nsRootAccessible.h"
+namespace mozilla {
+namespace a11y {
 
-class nsRootAccessibleWrap : public nsRootAccessible
+class RootAccessibleWrap : public RootAccessible
 {
 public:
-  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIPresShell* aPresShell);
-  virtual ~nsRootAccessibleWrap();
+  RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                     nsIPresShell* aPresShell);
+  virtual ~RootAccessibleWrap();
 
-  // nsRootAccessible
+  // RootAccessible
   virtual void DocumentActivated(nsDocAccessible* aDocument);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -40,18 +40,18 @@
 
 #include "AccessibleApplication.h"
 #include "ApplicationAccessibleWrap.h"
 #include "ISimpleDOMNode_i.c"
 
 #include "Compatibility.h"
 #include "nsAccessibilityService.h"
 #include "nsCoreUtils.h"
-#include "nsRootAccessible.h"
 #include "nsWinUtils.h"
+#include "RootAccessible.h"
 #include "Statistics.h"
 
 #include "nsAttrName.h"
 #include "nsIDocument.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -49,24 +49,24 @@
 #include "ia2AccessibleRelation.h"
 
 #include "nsIAccessibleEvent.h"
 #include "nsIAccessibleRelation.h"
 
 #include "Accessible2_i.c"
 #include "AccessibleRole.h"
 #include "AccessibleStates.h"
+#include "RootAccessible.h"
 
 #include "nsIMutableArray.h"
 #include "nsIDOMDocument.h"
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
-#include "nsRootAccessible.h"
 #include "nsIServiceManager.h"
 #include "nsTextFormatter.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
 #include "nsEventMap.h"
 #include "nsArrayUtils.h"
 
 #include "OLEACC.H"
@@ -1875,17 +1875,17 @@ nsAccessibleWrap::GetXPAccessibleFor(con
 }
 
 void nsAccessibleWrap::UpdateSystemCaret()
 {
   // Move the system caret so that Windows Tablet Edition and tradional ATs with 
   // off-screen model can follow the caret
   ::DestroyCaret();
 
-  nsRootAccessible* rootAccessible = RootAccessible();
+  a11y::RootAccessible* rootAccessible = RootAccessible();
   if (!rootAccessible) {
     return;
   }
 
   nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
   if (!caretAccessible) {
     return;
   }
--- a/accessible/src/msaa/nsDocAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsDocAccessibleWrap.cpp
@@ -37,31 +37,32 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/dom/TabChild.h"
 
 #include "Compatibility.h"
 #include "nsDocAccessibleWrap.h"
 #include "ISimpleDOMDocument_i.c"
 #include "nsIAccessibilityService.h"
-#include "nsRootAccessible.h"
 #include "nsWinUtils.h"
 #include "Role.h"
+#include "RootAccessible.h"
 #include "Statistics.h"
 
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionController.h"
 #include "nsIServiceManager.h"
 #include "nsIURI.h"
 #include "nsIViewManager.h"
 #include "nsIWebNavigation.h"
 
+using namespace mozilla;
 using namespace mozilla::a11y;
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsDocAccessibleWrap
@@ -275,17 +276,17 @@ nsDocAccessibleWrap::DoInitialUpdate()
   nsDocAccessible::DoInitialUpdate();
 
   if (nsWinUtils::IsWindowEmulationStarted()) {
     // Create window for tab document.
     if (nsCoreUtils::IsTabDocument(mDocument)) {
       mozilla::dom::TabChild* tabChild =
         mozilla::dom::GetTabChildFrom(mDocument->GetShell());
 
-      nsRootAccessible* rootDocument = RootAccessible();
+      a11y::RootAccessible* rootDocument = RootAccessible();
 
       mozilla::WindowsHandle nativeData = nsnull;
       if (tabChild)
         tabChild->SendGetWidgetNativeData(&nativeData);
       else
         nativeData = reinterpret_cast<mozilla::WindowsHandle>(
           rootDocument->GetNativeWindow());
 
--- a/accessible/src/msaa/nsWinUtils.cpp
+++ b/accessible/src/msaa/nsWinUtils.cpp
@@ -36,18 +36,18 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsWinUtils.h"
 
 #include "Compatibility.h"
-#include "nsIWinAccessNode.h"
-#include "nsRootAccessible.h"
+#include "nsDocAccessible.h"
+#include "nsCoreUtils.h"
 
 #include "mozilla/Preferences.h"
 #include "nsArrayUtils.h"
 #include "nsIDocShellTreeItem.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
--- a/accessible/src/other/Makefile.in
+++ b/accessible/src/other/Makefile.in
@@ -45,26 +45,24 @@ MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
 EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
-  nsRootAccessibleWrap.cpp \
   $(NULL)
 
 EXPORTS = \
   ARIAGridAccessibleWrap.h \
   nsAccessNodeWrap.h \
   nsTextAccessibleWrap.h \
   nsAccessibleWrap.h \
   nsDocAccessibleWrap.h \
-  nsRootAccessibleWrap.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   $(NULL)
 
rename from accessible/src/other/nsRootAccessibleWrap.h
rename to accessible/src/other/RootAccessibleWrap.h
--- a/accessible/src/other/nsRootAccessibleWrap.h
+++ b/accessible/src/other/RootAccessibleWrap.h
@@ -35,23 +35,22 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
-#ifndef _nsRootAccessibleWrap_H_
-#define _nsRootAccessibleWrap_H_
+#ifndef mozilla_a11y_RootAccessibleWrap_h__
+#define mozilla_a11y_RootAccessibleWrap_h__
 
-#include "nsRootAccessible.h"
+#include "RootAccessible.h"
 
-class nsRootAccessibleWrap: public nsRootAccessible
-{
-public:
-  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIPresShell* aPresShell);
-  virtual ~nsRootAccessibleWrap();
-};
+namespace mozilla {
+namespace a11y {
 
+typedef RootAccessible RootAccessibleWrap;
+
+} // namespace a11y
+} // namespace mozilla
 
 #endif
deleted file mode 100644
--- a/accessible/src/other/nsRootAccessibleWrap.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2003
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Original Author: Aaron Leventhal (aaronl@netscape.com)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsCOMPtr.h"
-#include "nsRootAccessibleWrap.h"
-#include "nsIServiceManager.h"
-#include "nsIAccessibilityService.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// nsRootAccessibleWrap
-////////////////////////////////////////////////////////////////////////////////
-
-nsRootAccessibleWrap::
-  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIPresShell* aPresShell) :
-  nsRootAccessible(aDocument, aRootContent, aPresShell)
-{
-}
-
-nsRootAccessibleWrap::~nsRootAccessibleWrap()
-{
-}
-