Bug 745428 - densify nsTextAccessible, r=surkov, f=tbsaunde
authorMark Capella <markcapella@twcny.rr.com>
Wed, 23 May 2012 14:05:57 -0400
changeset 98841 ac38f99528e0298b892c9575bbbadc2aa440cc3c
parent 98840 85f66ce3ebb85ee5a9c22445a1b7779632acdc6c
child 98842 2908fe12eb8fbbf43e6beaeb9301eb7481b47c8e
push id1116
push userlsblakk@mozilla.com
push dateMon, 16 Jul 2012 19:38:18 +0000
treeherdermozilla-beta@95f959a8b4dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs745428
milestone15.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 745428 - densify nsTextAccessible, r=surkov, f=tbsaunde
accessible/src/atk/TextLeafAccessibleWrap.h
accessible/src/atk/nsTextAccessibleWrap.h
accessible/src/base/Makefile.in
accessible/src/base/NotificationController.cpp
accessible/src/base/TextUpdater.cpp
accessible/src/base/TextUpdater.h
accessible/src/base/nsAccUtils.cpp
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessibilityService.h
accessible/src/base/nsAccessible.h
accessible/src/base/nsTextAccessible.cpp
accessible/src/base/nsTextAccessible.h
accessible/src/generic/Makefile.in
accessible/src/generic/TextLeafAccessible.cpp
accessible/src/generic/TextLeafAccessible.h
accessible/src/html/nsHTMLTextAccessible.cpp
accessible/src/html/nsHTMLTextAccessible.h
accessible/src/mac/TextLeafAccessibleWrap.h
accessible/src/mac/nsTextAccessibleWrap.h
accessible/src/msaa/Makefile.in
accessible/src/msaa/TextLeafAccessibleWrap.cpp
accessible/src/msaa/TextLeafAccessibleWrap.h
accessible/src/msaa/nsTextAccessibleWrap.cpp
accessible/src/msaa/nsTextAccessibleWrap.h
accessible/src/other/TextLeafAccessibleWrap.h
accessible/src/other/nsTextAccessibleWrap.h
layout/generic/nsTextFrameThebes.cpp
rename from accessible/src/atk/nsTextAccessibleWrap.h
rename to accessible/src/atk/TextLeafAccessibleWrap.h
--- a/accessible/src/atk/nsTextAccessibleWrap.h
+++ b/accessible/src/atk/TextLeafAccessibleWrap.h
@@ -1,14 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#ifndef _nsTextAccessibleWrap_H_
-#define _nsTextAccessibleWrap_H_
+#ifndef mozilla_a11y_TextLeafAccessibleWrap_h__
+#define mozilla_a11y_TextLeafAccessibleWrap_h__
+
+#include "TextLeafAccessible.h"
 
-#include "nsTextAccessible.h"
+namespace mozilla {
+namespace a11y {
+ 
+typedef class TextLeafAccessible TextLeafAccessibleWrap;
 
-typedef class nsTextAccessible nsTextAccessibleWrap;
+} // namespace a11y
+} // namespace mozilla
 
 #endif
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -31,17 +31,16 @@ CPPSRCS = \
   nsAccUtils.cpp \
   nsAccessibilityService.cpp \
   nsAccessible.cpp \
   nsAccessiblePivot.cpp \
   nsAccTreeWalker.cpp \
   nsBaseWidgetAccessible.cpp \
   nsEventShell.cpp \
   nsCaretAccessible.cpp \
-  nsTextAccessible.cpp \
   nsTextEquivUtils.cpp \
   RoleAsserts.cpp \
   StyleInfo.cpp \
   TextAttrs.cpp \
   TextUpdater.cpp \
   $(NULL)
 
 ifdef MOZ_DEBUG
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -6,19 +6,19 @@
 #include "NotificationController.h"
 
 #include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "nsEventShell.h"
-#include "nsTextAccessible.h"
 #include "FocusManager.h"
 #include "Role.h"
+#include "TextLeafAccessible.h"
 #include "TextUpdater.h"
 
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla::a11y;
 
 // Defines the number of selection add/remove events in the queue when they
 // aren't packed into single selection within event.
--- a/accessible/src/base/TextUpdater.cpp
+++ b/accessible/src/base/TextUpdater.cpp
@@ -2,20 +2,22 @@
 /* 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 "TextUpdater.h"
 
 #include "Accessible-inl.h"
 #include "nsDocAccessible.h"
-#include "nsTextAccessible.h"
+#include "TextLeafAccessible.h"
+
+using namespace mozilla::a11y;
 
 void
-TextUpdater::Run(nsDocAccessible* aDocument, nsTextAccessible* aTextLeaf,
+TextUpdater::Run(nsDocAccessible* aDocument, TextLeafAccessible* aTextLeaf,
                  const nsAString& aNewText)
 {
   NS_ASSERTION(aTextLeaf, "No text leaf accessible?");
 
   const nsString& oldText = aTextLeaf->Text();
   PRUint32 oldLen = oldText.Length(), newLen = aNewText.Length();
   PRUint32 minLen = NS_MIN(oldLen, newLen);
 
--- a/accessible/src/base/TextUpdater.h
+++ b/accessible/src/base/TextUpdater.h
@@ -14,21 +14,23 @@
  * events.
  */
 class TextUpdater
 {
 public:
   /**
    * Start text of the text leaf update.
    */
-  static void Run(nsDocAccessible* aDocument, nsTextAccessible* aTextLeaf,
+  static void Run(nsDocAccessible* aDocument,
+                  mozilla::a11y::TextLeafAccessible* aTextLeaf,
                   const nsAString& aNewText);
 
 private:
-  TextUpdater(nsDocAccessible* aDocument, nsTextAccessible* aTextLeaf) :
+  TextUpdater(nsDocAccessible* aDocument,
+              mozilla::a11y::TextLeafAccessible* aTextLeaf) :
     mDocument(aDocument), mTextLeaf(aTextLeaf), mHyperText(nsnull),
     mTextOffset(-1) { }
 
   ~TextUpdater()
     { mDocument = nsnull; mTextLeaf = nsnull; mHyperText = nsnull; }
 
   /**
    * Update text of the text leaf accessible, fire text change and value change
@@ -77,14 +79,14 @@ private:
   /**
    * The constant used to skip string difference calculation in case of long
    * strings.
    */
   const static PRUint32 kMaxStrLen = 1 << 6;
 
 private:
   nsDocAccessible* mDocument;
-  nsTextAccessible* mTextLeaf;
+  mozilla::a11y::TextLeafAccessible* mTextLeaf;
   nsHyperTextAccessible* mHyperText;
   PRInt32 mTextOffset;
 };
 
 #endif
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -7,19 +7,19 @@
 
 #include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsARIAMap.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "nsHyperTextAccessible.h"
 #include "nsIAccessibleTypes.h"
-#include "nsTextAccessible.h"
 #include "Role.h"
 #include "States.h"
+#include "TextLeafAccessible.h"
 
 #include "nsIDOMXULContainerElement.h"
 #include "nsIDOMXULSelectCntrlEl.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsWhitespaceTokenizer.h"
 #include "nsComponentManagerUtils.h"
 
 namespace dom = mozilla::dom;
@@ -442,17 +442,17 @@ nsAccUtils::IsTextInterfaceSupportCorrec
 #endif
 
 PRUint32
 nsAccUtils::TextLength(nsAccessible *aAccessible)
 {
   if (!IsText(aAccessible))
     return 1;
 
-  nsTextAccessible* textLeaf = aAccessible->AsTextLeaf();
+  TextLeafAccessible* textLeaf = aAccessible->AsTextLeaf();
   if (textLeaf)
     return textLeaf->Text().Length();
 
   // For list bullets (or anything other accessible which would compute its own
   // text. They don't have their own frame.
   // XXX In the future, list bullets may have frame and anon content, so 
   // we should be able to remove this at that point
   nsAutoString text;
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -30,16 +30,17 @@
 #include "OuterDocAccessible.h"
 #include "Role.h"
 #include "RootAccessibleWrap.h"
 #include "States.h"
 #include "Statistics.h"
 #ifdef XP_WIN
 #include "nsHTMLWin32ObjectAccessible.h"
 #endif
+#include "TextLeafAccessible.h"
 
 #ifdef DEBUG
 #include "Logging.h"
 #endif
 
 #include "nsCURILoader.h"
 #include "nsEventStates.h"
 #include "nsIContentViewer.h"
@@ -404,21 +405,21 @@ nsAccessibilityService::CreateHTMLTableR
 {
   nsAccessible* accessible =
     new nsEnumRoleAccessible(aContent, GetDocAccessible(aPresShell), roles::ROW);
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
-nsAccessibilityService::CreateHTMLTextAccessible(nsIContent* aContent,
+nsAccessibilityService::CreateTextLeafAccessible(nsIContent* aContent,
                                                  nsIPresShell* aPresShell)
 {
   nsAccessible* accessible = 
-    new nsHTMLTextAccessible(aContent, GetDocAccessible(aPresShell));
+    new TextLeafAccessible(aContent, GetDocAccessible(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIContent* aContent,
                                                       nsIPresShell* aPresShell)
 {
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -96,17 +96,17 @@ public:
     CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<nsAccessible>
     CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<nsAccessible>
     CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<nsAccessible>
     CreateHTMLTableRowAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<nsAccessible>
-    CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
+    CreateTextLeafAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<nsAccessible>
     CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<nsAccessible>
     CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   already_AddRefed<nsAccessible>
     CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
 
   virtual nsAccessible* AddNativeRootAccessible(void* aAtkAccessible);
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -32,16 +32,17 @@ class nsHTMLImageMapAccessible;
 struct nsRoleMapEntry;
 class Relation;
 
 namespace mozilla {
 namespace a11y {
 
 class HTMLLIAccessible;
 class TableAccessible;
+class TextLeafAccessible;
 
 /**
  * Name type flags.
  */
 enum ENameValueFlag {
   /**
    * Name either
    *  a) present (not empty): !name.IsEmpty()
@@ -49,17 +50,17 @@ enum ENameValueFlag {
    *  c) was left empty by the author on demand: name.IsEmpty() && !name.IsVoid()
    */
  eNameOK,
  eNameFromTooltip // Tooltip was used as a name
 };
 
 }
 }
-class nsTextAccessible;
+
 class nsXULTreeAccessible;
 
 struct nsRect;
 class nsIContent;
 class nsIFrame;
 class nsIAtom;
 class nsIView;
 
@@ -477,17 +478,17 @@ public:
   inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
 
   inline bool IsRoot() const { return mFlags & eRootAccessible; }
   mozilla::a11y::RootAccessible* AsRoot();
 
   virtual mozilla::a11y::TableAccessible* AsTable() { return nsnull; }
 
   inline bool IsTextLeaf() const { return mFlags & eTextLeafAccessible; }
-  nsTextAccessible* AsTextLeaf();
+  mozilla::a11y::TextLeafAccessible* AsTextLeaf();
 
   //////////////////////////////////////////////////////////////////////////////
   // ActionAccessible
 
   /**
    * Return the number of actions that can be performed on this accessible.
    */
   virtual PRUint8 ActionCount();
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -15,16 +15,17 @@ LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   ApplicationAccessible.cpp \
   ARIAGridAccessible.cpp \
   FormControlAccessible.cpp \
   OuterDocAccessible.cpp \
   RootAccessible.cpp \
+  TextLeafAccessible.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 = \
rename from accessible/src/base/nsTextAccessible.cpp
rename to accessible/src/generic/TextLeafAccessible.cpp
--- a/accessible/src/base/nsTextAccessible.cpp
+++ b/accessible/src/generic/TextLeafAccessible.cpp
@@ -1,40 +1,70 @@
 /* -*- 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 "nsTextAccessible.h"
+#include "TextLeafAccessible.h"
 
+#include "nsAccUtils.h"
+#include "nsDocAccessible.h"
 #include "Role.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsTextAccessible
+// TextLeafAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsTextAccessible::
-  nsTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+TextLeafAccessible::
+  TextLeafAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsLinkableAccessible(aContent, aDoc)
 {
   mFlags |= eTextLeafAccessible;
 }
 
+TextLeafAccessible::~TextLeafAccessible()
+{
+}
+
 role
-nsTextAccessible::NativeRole()
+TextLeafAccessible::NativeRole()
 {
+  nsIFrame* frame = GetFrame();
+  if (frame && frame->IsGeneratedContentFrame()) 
+    return roles::STATICTEXT;
+
   return roles::TEXT_LEAF;
 }
 
 void
-nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
-                               PRUint32 aLength)
+TextLeafAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
+                                 PRUint32 aLength)
 {
   aText.Append(Substring(mText, aStartOffset, aLength));
 }
 
+ENameValueFlag
+TextLeafAccessible::Name(nsString& aName)
+{
+  // Text node, ARIA can't be used.
+  aName = mText;
+  return eNameOK;
+}
+
+nsresult
+TextLeafAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
+{
+  if (NativeRole() == roles::STATICTEXT) {
+    nsAutoString oldValueUnused;
+    aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"),
+                                  NS_LITERAL_STRING("true"), oldValueUnused);
+  }
+
+  return NS_OK;
+}
+
 void
-nsTextAccessible::CacheChildren()
+TextLeafAccessible::CacheChildren()
 {
   // No children for text accessible.
 }
rename from accessible/src/base/nsTextAccessible.h
rename to accessible/src/generic/TextLeafAccessible.h
--- a/accessible/src/base/nsTextAccessible.h
+++ b/accessible/src/generic/TextLeafAccessible.h
@@ -1,48 +1,56 @@
 /* -*- 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/. */
 
-#ifndef _nsTextAccessible_H_
-#define _nsTextAccessible_H_
+#ifndef mozilla_a11y_TextLeafAccessible_h__
+#define mozilla_a11y_TextLeafAccessible_h__
 
 #include "nsBaseWidgetAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+ 
 /**
  * Generic class used for text nodes.
  */
-class nsTextAccessible : public nsLinkableAccessible
+class TextLeafAccessible : public nsLinkableAccessible
 {
 public:
-  nsTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  TextLeafAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  virtual ~TextLeafAccessible();
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
                             PRUint32 aLength = PR_UINT32_MAX);
+  virtual ENameValueFlag Name(nsString& aName);
+  virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
 
-  // nsTextAccessible
+  // TextLeafAccessible
   void SetText(const nsAString& aText) { mText = aText; }
   const nsString& Text() const { return mText; }
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 
 protected:
   nsString mText;
 };
 
+} // namespace a11y
+} // namespace mozilla
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible downcast method
 
-inline nsTextAccessible*
+inline mozilla::a11y::TextLeafAccessible*
 nsAccessible::AsTextLeaf()
 {
   return mFlags & eTextLeafAccessible ?
-    static_cast<nsTextAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::TextLeafAccessible*>(this) : nsnull;
 }
 
 #endif
 
--- a/accessible/src/html/nsHTMLTextAccessible.cpp
+++ b/accessible/src/html/nsHTMLTextAccessible.cpp
@@ -11,61 +11,16 @@
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLTextAccessible
-////////////////////////////////////////////////////////////////////////////////
-
-nsHTMLTextAccessible::
-  nsHTMLTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsTextAccessibleWrap(aContent, aDoc)
-{
-}
-
-NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextAccessible, nsTextAccessible)
-
-ENameValueFlag
-nsHTMLTextAccessible::Name(nsString& aName)
-{
-  // Text node, ARIA can't be used.
-  aName = mText;
-  return eNameOK;
-}
-
-role
-nsHTMLTextAccessible::NativeRole()
-{
-  nsIFrame *frame = GetFrame();
-  // Don't return on null frame -- we still return a role
-  // after accessible is shutdown/DEFUNCT
-  if (frame && frame->IsGeneratedContentFrame()) 
-    return roles::STATICTEXT;
-
-  return nsTextAccessible::NativeRole();
-}
-
-nsresult
-nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
-{
-  if (NativeRole() == roles::STATICTEXT) {
-    nsAutoString oldValueUnused;
-    aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"),
-                                  NS_LITERAL_STRING("true"), oldValueUnused);
-  }
-
-  return NS_OK;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
 // nsHTMLHRAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLHRAccessible::
   nsHTMLHRAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsLeafAccessible(aContent, aDoc)
 {
 }
--- a/accessible/src/html/nsHTMLTextAccessible.h
+++ b/accessible/src/html/nsHTMLTextAccessible.h
@@ -1,38 +1,20 @@
 /* -*- 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/. */
 
 #ifndef _nsHTMLTextAccessible_H_
 #define _nsHTMLTextAccessible_H_
 
-#include "nsTextAccessibleWrap.h"
 #include "nsAutoPtr.h"
 #include "nsBaseWidgetAccessible.h"
 
 /**
- * Used for text nodes within HTML document.
- */
-class nsHTMLTextAccessible : public nsTextAccessibleWrap
-{
-public:
-  nsHTMLTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsAccessible
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
-  virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
-  virtual mozilla::a11y::role NativeRole();
-};
-
-/**
  * Used for HTML hr element.
  */
 class nsHTMLHRAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLHRAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
rename from accessible/src/mac/nsTextAccessibleWrap.h
rename to accessible/src/mac/TextLeafAccessibleWrap.h
--- a/accessible/src/mac/nsTextAccessibleWrap.h
+++ b/accessible/src/mac/TextLeafAccessibleWrap.h
@@ -1,13 +1,19 @@
 /* -*- 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/. */
 
-#ifndef _nsTextAccessibleWrap_H_
-#define _nsTextAccessibleWrap_H_
+#ifndef mozilla_a11y_TextLeafAccessibleWrap_h__
+#define mozilla_a11y_TextLeafAccessibleWrap_h__
+
+#include "TextLeafAccessible.h"
 
-#include "nsTextAccessible.h"
+namespace mozilla {
+namespace a11y {
+ 
+typedef class TextLeafAccessible TextLeafAccessibleWrap;
 
-typedef class nsTextAccessible nsTextAccessibleWrap;
+} // namespace a11y
+} // namespace mozilla
 
 #endif
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -15,17 +15,16 @@ EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   ApplicationAccessibleWrap.cpp \
   ARIAGridAccessibleWrap.cpp \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
-  nsTextAccessibleWrap.cpp \
   nsDocAccessibleWrap.cpp \
   nsHTMLWin32ObjectAccessible.cpp \
   nsXULMenuAccessibleWrap.cpp \
   nsXULListboxAccessibleWrap.cpp \
   nsXULTreeGridAccessibleWrap.cpp \
   nsHyperTextAccessibleWrap.cpp \
   nsHTMLImageAccessibleWrap.cpp \
   nsHTMLTableAccessibleWrap.cpp \
@@ -38,16 +37,17 @@ CPPSRCS = \
   CAccessibleHyperlink.cpp \
   ia2AccessibleHypertext.cpp \
   ia2AccessibleRelation.cpp \
   CAccessibleTable.cpp \
   CAccessibleTableCell.cpp \
   CAccessibleValue.cpp \
   Compatibility.cpp \
   RootAccessibleWrap.cpp \
+  TextLeafAccessibleWrap.cpp \
   $(NULL)
 
 EXPORTS = \
   nsAccessNodeWrap.h \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
rename from accessible/src/msaa/nsTextAccessibleWrap.cpp
rename to accessible/src/msaa/TextLeafAccessibleWrap.cpp
--- a/accessible/src/msaa/nsTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/TextLeafAccessibleWrap.cpp
@@ -1,66 +1,70 @@
 /* -*- 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 "nsTextAccessibleWrap.h"
+#include "TextLeafAccessibleWrap.h"
 #include "ISimpleDOMText_i.c"
 
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "Statistics.h"
 #include "nsIFrame.h"
 #include "nsFontMetrics.h"
 #include "nsPresContext.h"
 #include "nsLayoutUtils.h"
 
 #include "gfxFont.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsTextAccessibleWrap Accessible
+// TextLeafAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
-nsTextAccessibleWrap::
-  nsTextAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsTextAccessible(aContent, aDoc)
+TextLeafAccessibleWrap::
+  TextLeafAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
+  TextLeafAccessible(aContent, aDoc)
 {
 }
 
-STDMETHODIMP_(ULONG) nsTextAccessibleWrap::AddRef()
+STDMETHODIMP_(ULONG)
+TextLeafAccessibleWrap::AddRef()
 {
   return nsAccessNode::AddRef();
 }
 
-STDMETHODIMP_(ULONG) nsTextAccessibleWrap::Release()
+STDMETHODIMP_(ULONG)
+TextLeafAccessibleWrap::Release()
 {
   return nsAccessNode::Release();
 }
 
-STDMETHODIMP nsTextAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
+STDMETHODIMP
+TextLeafAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = nsnull;
 
   if (IID_IUnknown == iid) {
     *ppv = static_cast<ISimpleDOMText*>(this);
   } else if (IID_ISimpleDOMText == iid) {
     statistics::ISimpleDOMUsed();
     *ppv = static_cast<ISimpleDOMText*>(this);
   } else {
     return nsAccessibleWrap::QueryInterface(iid, ppv);
   }
    
   (reinterpret_cast<IUnknown*>(*ppv))->AddRef(); 
   return S_OK;
 }
 
-STDMETHODIMP nsTextAccessibleWrap::get_domText( 
+STDMETHODIMP
+TextLeafAccessibleWrap::get_domText( 
     /* [retval][out] */ BSTR __RPC_FAR *aDomText)
 {
 __try {
   *aDomText = NULL;
 
   if (IsDefunct())
     return E_FAIL;
 
@@ -75,17 +79,18 @@ STDMETHODIMP nsTextAccessibleWrap::get_d
   if (!*aDomText)
     return E_OUTOFMEMORY;
 
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return S_OK;
 }
 
-STDMETHODIMP nsTextAccessibleWrap::get_clippedSubstringBounds( 
+STDMETHODIMP
+TextLeafAccessibleWrap::get_clippedSubstringBounds( 
     /* [in] */ unsigned int aStartIndex,
     /* [in] */ unsigned int aEndIndex,
     /* [out] */ int __RPC_FAR *aX,
     /* [out] */ int __RPC_FAR *aY,
     /* [out] */ int __RPC_FAR *aWidth,
     /* [out] */ int __RPC_FAR *aHeight)
 {
 __try {
@@ -112,17 +117,18 @@ STDMETHODIMP nsTextAccessibleWrap::get_c
   *aY = clippedRect.y;
   *aWidth = clippedRect.width;
   *aHeight = clippedRect.height;
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return S_OK;
 }
 
-STDMETHODIMP nsTextAccessibleWrap::get_unclippedSubstringBounds( 
+STDMETHODIMP
+TextLeafAccessibleWrap::get_unclippedSubstringBounds( 
     /* [in] */ unsigned int aStartIndex,
     /* [in] */ unsigned int aEndIndex,
     /* [out] */ int __RPC_FAR *aX,
     /* [out] */ int __RPC_FAR *aY,
     /* [out] */ int __RPC_FAR *aWidth,
     /* [out] */ int __RPC_FAR *aHeight)
 {
 __try {
@@ -135,18 +141,18 @@ STDMETHODIMP nsTextAccessibleWrap::get_u
                                     aX, aY, aWidth, aHeight))) {
     return NS_ERROR_FAILURE;
   }
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return S_OK;
 }
 
-
-STDMETHODIMP nsTextAccessibleWrap::scrollToSubstring(
+STDMETHODIMP
+TextLeafAccessibleWrap::scrollToSubstring(
     /* [in] */ unsigned int aStartIndex,
     /* [in] */ unsigned int aEndIndex)
 {
 __try {
   if (IsDefunct())
     return E_FAIL;
 
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
@@ -155,38 +161,43 @@ STDMETHODIMP nsTextAccessibleWrap::scrol
                                    DOMNode, aEndIndex,
                                    nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
   if (NS_FAILED(rv))
     return E_FAIL;
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return S_OK;
 }
 
-nsIFrame* nsTextAccessibleWrap::GetPointFromOffset(nsIFrame *aContainingFrame, 
-                                                   PRInt32 aOffset, 
-                                                   bool aPreferNext, 
-                                                   nsPoint& aOutPoint)
+nsIFrame*
+TextLeafAccessibleWrap::GetPointFromOffset(nsIFrame* aContainingFrame, 
+                                           PRInt32 aOffset, 
+                                           bool aPreferNext, 
+                                           nsPoint& aOutPoint)
 {
   nsIFrame *textFrame = nsnull;
   PRInt32 outOffset;
   aContainingFrame->GetChildFrameContainingOffset(aOffset, aPreferNext, &outOffset, &textFrame);
   if (!textFrame) {
     return nsnull;
   }
 
   textFrame->GetPointFromOffset(aOffset, &aOutPoint);
   return textFrame;
 }
 
 /*
  * Given an offset, the x, y, width, and height values are filled appropriately.
  */
-nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
-                                                   PRInt32* aX, PRInt32* aY, 
-                                                   PRInt32* aWidth, PRInt32* aHeight) 
+nsresult
+TextLeafAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset,
+                                            PRInt32 aEndOffset,
+                                            PRInt32* aX,
+                                            PRInt32* aY,
+                                            PRInt32* aWidth,
+                                            PRInt32* aHeight)
 {
   *aX = *aY = *aWidth = *aHeight = 0;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsPresContext* presContext = mDoc->PresContext();
 
@@ -216,17 +227,18 @@ nsresult nsTextAccessibleWrap::GetCharac
   *aX      = sum.x;
   *aY      = sum.y;
   *aWidth  = sum.width;
   *aHeight = sum.height;
 
   return NS_OK;
 }
 
-STDMETHODIMP nsTextAccessibleWrap::get_fontFamily(
+STDMETHODIMP
+TextLeafAccessibleWrap::get_fontFamily(
     /* [retval][out] */ BSTR __RPC_FAR *aFontFamily)
 {
 __try {
   *aFontFamily = NULL;
 
   nsIFrame* frame = GetFrame();
   if (!frame) {
     return E_FAIL;
rename from accessible/src/msaa/nsTextAccessibleWrap.h
rename to accessible/src/msaa/TextLeafAccessibleWrap.h
--- a/accessible/src/msaa/nsTextAccessibleWrap.h
+++ b/accessible/src/msaa/TextLeafAccessibleWrap.h
@@ -1,29 +1,32 @@
 /* -*- 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/. */
 
-#ifndef _nsTextAccessibleWrap_H_
-#define _nsTextAccessibleWrap_H_
+#ifndef mozilla_a11y_TextLeafAccessibleWrap_h__
+#define mozilla_a11y_TextLeafAccessibleWrap_h__
 
-#include "nsTextAccessible.h"
+#include "TextLeafAccessible.h"
 #include "ISimpleDOMText.h"
 #include "nsRect.h"
 
 class nsIFrame;
 class nsRenderingContext;
 
-class nsTextAccessibleWrap : public nsTextAccessible, 
-                             public ISimpleDOMText
+namespace mozilla {
+namespace a11y {
+ 
+class TextLeafAccessibleWrap : public TextLeafAccessible, 
+                               public ISimpleDOMText
 {
 public:
-  nsTextAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc);
-  virtual ~nsTextAccessibleWrap() {}
+  TextLeafAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc);
+  virtual ~TextLeafAccessibleWrap() {}
 
     // IUnknown methods - see iunknown.h for documentation
     STDMETHODIMP_(ULONG) AddRef();
     STDMETHODIMP_(ULONG) Release();
     STDMETHODIMP QueryInterface(REFIID, void**);
 
     virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_domText( 
         /* [retval][out] */ BSTR __RPC_FAR *domText);
@@ -56,10 +59,13 @@ public:
                                  PRInt32* aX, PRInt32* aY, 
                                  PRInt32* aWidth, PRInt32* aHeight);
 
     // Return child frame containing offset on success
     nsIFrame* GetPointFromOffset(nsIFrame *aContainingFrame,
                                  PRInt32 aOffset, bool aPreferNext, nsPoint& aOutPoint);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
rename from accessible/src/other/nsTextAccessibleWrap.h
rename to accessible/src/other/TextLeafAccessibleWrap.h
--- a/accessible/src/other/nsTextAccessibleWrap.h
+++ b/accessible/src/other/TextLeafAccessibleWrap.h
@@ -1,13 +1,19 @@
 /* -*- 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/. */
 
-#ifndef _nsTextAccessibleWrap_H_
-#define _nsTextAccessibleWrap_H_
+#ifndef mozilla_a11y_TextLeafAccessibleWrap_h__
+#define mozilla_a11y_TextLeafAccessibleWrap_h__
+
+#include "TextLeafAccessible.h"
 
-#include "nsTextAccessible.h"
+namespace mozilla {
+namespace a11y {
+ 
+typedef class TextLeafAccessible TextLeafAccessibleWrap;
 
-typedef class nsTextAccessible nsTextAccessibleWrap;
+} // namespace a11y
+} // namespace mozilla
 
 #endif
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -3749,17 +3749,17 @@ nsTextFrame::CreateAccessible()
     GetRenderedText(&renderedWhitespace, nsnull, nsnull, 0, 1);
     if (renderedWhitespace.IsEmpty()) {
       return nsnull;
     }
   }
 
   nsAccessibilityService* accService = nsIPresShell::AccService();
   if (accService) {
-    return accService->CreateHTMLTextAccessible(mContent,
+    return accService->CreateTextLeafAccessible(mContent,
                                                 PresContext()->PresShell());
   }
   return nsnull;
 }
 #endif
 
 
 //-----------------------------------------------------------------------------