bug 1261144 - rename AccCollector.{h,cpp} to EmbeddedObjCollector.{h,cpp} r=lsocks
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Wed, 30 Mar 2016 17:55:56 -0400
changeset 316466 4d94046fc040f334f54f3e47ccefde23db51a7d6
parent 316465 9d674ccbdee1ffbf65c97c97a78cd2658b2d307d
child 316467 7068b471499ffb99ebcb88d6ab1c0c55caf881a9
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsocks
bugs1261144
milestone48.0a1
bug 1261144 - rename AccCollector.{h,cpp} to EmbeddedObjCollector.{h,cpp} r=lsocks
accessible/base/AccCollector.cpp
accessible/base/AccCollector.h
accessible/base/EmbeddedObjCollector.cpp
accessible/base/EmbeddedObjCollector.h
accessible/base/moz.build
accessible/generic/Accessible.cpp
deleted file mode 100644
--- a/accessible/base/AccCollector.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 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 "AccCollector.h"
-
-#include "Accessible.h"
-
-using namespace mozilla::a11y;
-
-uint32_t
-EmbeddedObjCollector::Count()
-{
-  EnsureNGetIndex(nullptr);
-  return mObjects.Length();
-}
-
-Accessible*
-EmbeddedObjCollector::GetAccessibleAt(uint32_t aIndex)
-{
-  Accessible* accessible = mObjects.SafeElementAt(aIndex, nullptr);
-  if (accessible)
-    return accessible;
-
-  return EnsureNGetObject(aIndex);
-}
-
-Accessible*
-EmbeddedObjCollector::EnsureNGetObject(uint32_t aIndex)
-{
-  uint32_t childCount = mRoot->ChildCount();
-  while (mRootChildIdx < childCount) {
-    Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
-    if (!(mFilterFunc(child) & filters::eMatch))
-      continue;
-
-    AppendObject(child);
-    if (mObjects.Length() - 1 == aIndex)
-      return mObjects[aIndex];
-  }
-
-  return nullptr;
-}
-
-int32_t
-EmbeddedObjCollector::EnsureNGetIndex(Accessible* aAccessible)
-{
-  uint32_t childCount = mRoot->ChildCount();
-  while (mRootChildIdx < childCount) {
-    Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
-    if (!(mFilterFunc(child) & filters::eMatch))
-      continue;
-
-    AppendObject(child);
-    if (child == aAccessible)
-      return mObjects.Length() - 1;
-  }
-
-  return -1;
-}
-
-int32_t
-EmbeddedObjCollector::GetIndexAt(Accessible* aAccessible)
-{
-  if (aAccessible->mParent != mRoot)
-    return -1;
-
-  MOZ_ASSERT(!aAccessible->IsProxy());
-  if (aAccessible->mInt.mIndexOfEmbeddedChild != -1)
-    return aAccessible->mInt.mIndexOfEmbeddedChild;
-
-  return mFilterFunc(aAccessible) & filters::eMatch ?
-    EnsureNGetIndex(aAccessible) : -1;
-}
-
-void
-EmbeddedObjCollector::AppendObject(Accessible* aAccessible)
-{
-  MOZ_ASSERT(!aAccessible->IsProxy());
-  aAccessible->mInt.mIndexOfEmbeddedChild = mObjects.Length();
-  mObjects.AppendElement(aAccessible);
-}
deleted file mode 100644
--- a/accessible/base/AccCollector.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 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 mozilla_a11y_AccCollector_h__
-#define mozilla_a11y_AccCollector_h__
-
-#include "Filters.h"
-
-#include "nsTArray.h"
-
-namespace mozilla {
-namespace a11y {
-
-class Accessible;
-
-/**
- * Collect embedded objects. Provide quick access to accessible by index and
- * vice versa.
- */
-class EmbeddedObjCollector final
-{
-public:
-  virtual ~EmbeddedObjCollector() { }
-
-public:
-  /**
-   * Return index of the given accessible within the collection.
-   */
-  int32_t GetIndexAt(Accessible* aAccessible);
-
-  /**
-   * Return accessible count within the collection.
-   */
-  uint32_t Count();
-
-  /**
-   * Return an accessible from the collection at the given index.
-   */
-  Accessible* GetAccessibleAt(uint32_t aIndex);
-
-protected:
-  /**
-   * Ensure accessible at the given index is stored and return it.
-   */
-  Accessible* EnsureNGetObject(uint32_t aIndex);
-
-  /**
-   * Ensure index for the given accessible is stored and return it.
-   */
-  int32_t EnsureNGetIndex(Accessible* aAccessible);
-
-  // Make sure it's used by Accessible class only.
-  explicit EmbeddedObjCollector(Accessible* aRoot) :
-    mFilterFunc(filters::GetEmbeddedObject), mRoot(aRoot), mRootChildIdx(0) {}
-
-  /**
-   * Append the object to collection.
-   */
-  void AppendObject(Accessible* aAccessible);
-
-  friend class Accessible;
-
-  filters::FilterFuncPtr mFilterFunc;
-  Accessible* mRoot;
-  uint32_t mRootChildIdx;
-  nsTArray<Accessible*> mObjects;
-};
-
-} // namespace a11y
-} // namespace mozilla
-
-#endif
new file mode 100644
--- /dev/null
+++ b/accessible/base/EmbeddedObjCollector.cpp
@@ -0,0 +1,82 @@
+/* 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 "EmbeddedObjCollector.h"
+
+#include "Accessible.h"
+
+using namespace mozilla::a11y;
+
+uint32_t
+EmbeddedObjCollector::Count()
+{
+  EnsureNGetIndex(nullptr);
+  return mObjects.Length();
+}
+
+Accessible*
+EmbeddedObjCollector::GetAccessibleAt(uint32_t aIndex)
+{
+  Accessible* accessible = mObjects.SafeElementAt(aIndex, nullptr);
+  if (accessible)
+    return accessible;
+
+  return EnsureNGetObject(aIndex);
+}
+
+Accessible*
+EmbeddedObjCollector::EnsureNGetObject(uint32_t aIndex)
+{
+  uint32_t childCount = mRoot->ChildCount();
+  while (mRootChildIdx < childCount) {
+    Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
+    if (!(mFilterFunc(child) & filters::eMatch))
+      continue;
+
+    AppendObject(child);
+    if (mObjects.Length() - 1 == aIndex)
+      return mObjects[aIndex];
+  }
+
+  return nullptr;
+}
+
+int32_t
+EmbeddedObjCollector::EnsureNGetIndex(Accessible* aAccessible)
+{
+  uint32_t childCount = mRoot->ChildCount();
+  while (mRootChildIdx < childCount) {
+    Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
+    if (!(mFilterFunc(child) & filters::eMatch))
+      continue;
+
+    AppendObject(child);
+    if (child == aAccessible)
+      return mObjects.Length() - 1;
+  }
+
+  return -1;
+}
+
+int32_t
+EmbeddedObjCollector::GetIndexAt(Accessible* aAccessible)
+{
+  if (aAccessible->mParent != mRoot)
+    return -1;
+
+  MOZ_ASSERT(!aAccessible->IsProxy());
+  if (aAccessible->mInt.mIndexOfEmbeddedChild != -1)
+    return aAccessible->mInt.mIndexOfEmbeddedChild;
+
+  return mFilterFunc(aAccessible) & filters::eMatch ?
+    EnsureNGetIndex(aAccessible) : -1;
+}
+
+void
+EmbeddedObjCollector::AppendObject(Accessible* aAccessible)
+{
+  MOZ_ASSERT(!aAccessible->IsProxy());
+  aAccessible->mInt.mIndexOfEmbeddedChild = mObjects.Length();
+  mObjects.AppendElement(aAccessible);
+}
new file mode 100644
--- /dev/null
+++ b/accessible/base/EmbeddedObjCollector.h
@@ -0,0 +1,73 @@
+/* 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 mozilla_a11y_EmbeddedObjCollector_h__
+#define mozilla_a11y_EmbeddedObjCollector_h__
+
+#include "Filters.h"
+
+#include "nsTArray.h"
+
+namespace mozilla {
+namespace a11y {
+
+class Accessible;
+
+/**
+ * Collect embedded objects. Provide quick access to accessible by index and
+ * vice versa.
+ */
+class EmbeddedObjCollector final
+{
+public:
+  virtual ~EmbeddedObjCollector() { }
+
+public:
+  /**
+   * Return index of the given accessible within the collection.
+   */
+  int32_t GetIndexAt(Accessible* aAccessible);
+
+  /**
+   * Return accessible count within the collection.
+   */
+  uint32_t Count();
+
+  /**
+   * Return an accessible from the collection at the given index.
+   */
+  Accessible* GetAccessibleAt(uint32_t aIndex);
+
+protected:
+  /**
+   * Ensure accessible at the given index is stored and return it.
+   */
+  Accessible* EnsureNGetObject(uint32_t aIndex);
+
+  /**
+   * Ensure index for the given accessible is stored and return it.
+   */
+  int32_t EnsureNGetIndex(Accessible* aAccessible);
+
+  // Make sure it's used by Accessible class only.
+  explicit EmbeddedObjCollector(Accessible* aRoot) :
+    mFilterFunc(filters::GetEmbeddedObject), mRoot(aRoot), mRootChildIdx(0) {}
+
+  /**
+   * Append the object to collection.
+   */
+  void AppendObject(Accessible* aAccessible);
+
+  friend class Accessible;
+
+  filters::FilterFuncPtr mFilterFunc;
+  Accessible* mRoot;
+  uint32_t mRootChildIdx;
+  nsTArray<Accessible*> mObjects;
+};
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif
--- a/accessible/base/moz.build
+++ b/accessible/base/moz.build
@@ -21,24 +21,24 @@ EXPORTS.mozilla.a11y += [
 ]
 
 if CONFIG['MOZ_DEBUG']:
     EXPORTS.mozilla.a11y += [
         'Logging.h',
     ]
 
 UNIFIED_SOURCES += [
-    'AccCollector.cpp',
     'AccEvent.cpp',
     'AccGroupInfo.cpp',
     'AccIterator.cpp',
     'ARIAMap.cpp',
     'ARIAStateMap.cpp',
     'Asserts.cpp',
     'DocManager.cpp',
+    'EmbeddedObjCollector.cpp',
     'EventQueue.cpp',
     'EventTree.cpp',
     'Filters.cpp',
     'FocusManager.cpp',
     'NotificationController.cpp',
     'nsAccessibilityService.cpp',
     'nsAccessiblePivot.cpp',
     'nsAccUtils.cpp',
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -2,17 +2,17 @@
 /* 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 "Accessible-inl.h"
 
 #include "nsIXBLAccessible.h"
 
-#include "AccCollector.h"
+#include "EmbeddedObjCollector.h"
 #include "AccGroupInfo.h"
 #include "AccIterator.h"
 #include "nsAccUtils.h"
 #include "nsAccessibilityService.h"
 #include "ApplicationAccessible.h"
 #include "NotificationController.h"
 #include "nsEventShell.h"
 #include "nsTextEquivUtils.h"