Bug 756087 - nsAccessible::GetChildCount should return unsigned int, r=tbsaunde
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 25 May 2012 19:53:45 +0900
changeset 97222 8da4ff25a24a16a52d624a1b7f3586babef6bd81
parent 97221 f15f13527d494b9d6c977838865e8b543b953244
child 97223 5a903d496ab0a4096001dfc8cf30b11e97f739b6
push idunknown
push userunknown
push dateunknown
reviewerstbsaunde
bugs756087
milestone15.0a1
Bug 756087 - nsAccessible::GetChildCount should return unsigned int, r=tbsaunde
accessible/src/atk/nsAccessibleWrap.cpp
accessible/src/base/AccCollector.cpp
accessible/src/base/AccCollector.h
accessible/src/base/AccGroupInfo.cpp
accessible/src/base/TextAttrs.cpp
accessible/src/base/nsAccUtils.cpp
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsTextEquivUtils.cpp
accessible/src/generic/ARIAGridAccessible.cpp
accessible/src/generic/RootAccessible.cpp
accessible/src/html/nsHTMLImageMapAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/html/nsHyperTextAccessible.cpp
accessible/src/html/nsHyperTextAccessible.h
accessible/src/mac/nsAccessibleWrap.mm
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/xforms/nsXFormsAccessible.cpp
accessible/src/xul/XULFormControlAccessible.cpp
accessible/src/xul/nsXULListboxAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.h
accessible/src/xul/nsXULTreeGridAccessible.cpp
accessible/src/xul/nsXULTreeGridAccessible.h
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -787,17 +787,17 @@ getParentCB(AtkObject *aAtkObj)
 gint
 getChildCountCB(AtkObject *aAtkObj)
 {
     nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
     if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
         return 0;
     }
 
-    return accWrap->GetEmbeddedChildCount();
+    return static_cast<gint>(accWrap->EmbeddedChildCount());
 }
 
 AtkObject *
 refChildCB(AtkObject *aAtkObj, gint aChildIndex)
 {
     // aChildIndex should not be less than zero
     if (aChildIndex < 0) {
       return nsnull;
--- a/accessible/src/base/AccCollector.cpp
+++ b/accessible/src/base/AccCollector.cpp
@@ -48,34 +48,34 @@ AccCollector::GetIndexAt(nsAccessible *a
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccCollector protected
 
 nsAccessible*
 AccCollector::EnsureNGetObject(PRUint32 aIndex)
 {
-  PRInt32 childCount = mRoot->GetChildCount();
+  PRUint32 childCount = mRoot->ChildCount();
   while (mRootChildIdx < childCount) {
     nsAccessible* child = mRoot->GetChildAt(mRootChildIdx++);
     if (!mFilterFunc(child))
       continue;
 
     AppendObject(child);
     if (mObjects.Length() - 1 == aIndex)
       return mObjects[aIndex];
   }
 
   return nsnull;
 }
 
 PRInt32
 AccCollector::EnsureNGetIndex(nsAccessible* aAccessible)
 {
-  PRInt32 childCount = mRoot->GetChildCount();
+  PRUint32 childCount = mRoot->ChildCount();
   while (mRootChildIdx < childCount) {
     nsAccessible* child = mRoot->GetChildAt(mRootChildIdx++);
     if (!mFilterFunc(child))
       continue;
 
     AppendObject(child);
     if (child == aAccessible)
       return mObjects.Length() - 1;
--- a/accessible/src/base/AccCollector.h
+++ b/accessible/src/base/AccCollector.h
@@ -48,17 +48,17 @@ protected:
 
   /**
    * Append the object to collection.
    */
   virtual void AppendObject(nsAccessible* aAccessible);
 
   filters::FilterFuncPtr mFilterFunc;
   nsAccessible* mRoot;
-  PRInt32 mRootChildIdx;
+  PRUint32 mRootChildIdx;
 
   nsTArray<nsAccessible*> mObjects;
 
 private:
   AccCollector();
   AccCollector(const AccCollector&);
   AccCollector& operator =(const AccCollector&);
 };
--- a/accessible/src/base/AccGroupInfo.cpp
+++ b/accessible/src/base/AccGroupInfo.cpp
@@ -13,27 +13,28 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
   mPosInSet(0), mSetSize(0), mParent(nsnull)
 {
   MOZ_COUNT_CTOR(AccGroupInfo);
   nsAccessible* parent = aItem->Parent();
   if (!parent)
     return;
 
   PRInt32 indexInParent = aItem->IndexInParent();
-  PRInt32 siblingCount = parent->GetChildCount();
-  if (siblingCount < indexInParent) {
+  PRUint32 siblingCount = parent->ChildCount();
+  if (indexInParent == -1 ||
+      indexInParent >= static_cast<PRInt32>(siblingCount)) {
     NS_ERROR("Wrong index in parent! Tree invalidation problem.");
     return;
   }
 
   PRInt32 level = nsAccUtils::GetARIAOrDefaultLevel(aItem);
 
   // Compute position in set.
   mPosInSet = 1;
-  for (PRInt32 idx = indexInParent - 1; idx >=0 ; idx--) {
+  for (PRInt32 idx = indexInParent - 1; idx >= 0 ; idx--) {
     nsAccessible* sibling = parent->GetChildAt(idx);
     roles::Role siblingRole = sibling->Role();
 
     // If the sibling is separator then the group is ended.
     if (siblingRole == roles::SEPARATOR)
       break;
 
     // If sibling is not visible and hasn't the same base role.
@@ -64,17 +65,17 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
     }
 
     mPosInSet++;
   }
 
   // Compute set size.
   mSetSize = mPosInSet;
 
-  for (PRInt32 idx = indexInParent + 1; idx < siblingCount; idx++) {
+  for (PRUint32 idx = indexInParent + 1; idx < siblingCount; idx++) {
     nsAccessible* sibling = parent->GetChildAt(idx);
 
     roles::Role siblingRole = sibling->Role();
 
     // If the sibling is separator then the group is ended.
     if (siblingRole == roles::SEPARATOR)
       break;
 
--- a/accessible/src/base/TextAttrs.cpp
+++ b/accessible/src/base/TextAttrs.cpp
@@ -46,18 +46,18 @@ TextAttrsMgr::GetAttributes(nsIPersisten
     for (PRInt32 childIdx = mOffsetAccIdx - 1; childIdx >= 0; childIdx--) {
       nsAccessible *currAcc = mHyperTextAcc->GetChildAt(childIdx);
       if (!nsAccUtils::IsEmbeddedObject(currAcc))
         break;
 
       (*aStartHTOffset)--;
     }
 
-    PRInt32 childCount = mHyperTextAcc->GetChildCount();
-    for (PRInt32 childIdx = mOffsetAccIdx + 1; childIdx < childCount;
+    PRUint32 childCount = mHyperTextAcc->ChildCount();
+    for (PRUint32 childIdx = mOffsetAccIdx + 1; childIdx < childCount;
          childIdx++) {
       nsAccessible *currAcc = mHyperTextAcc->GetChildAt(childIdx);
       if (!nsAccUtils::IsEmbeddedObject(currAcc))
         break;
 
       (*aEndHTOffset)++;
     }
 
@@ -159,18 +159,18 @@ TextAttrsMgr::GetRange(TextAttr* aAttrAr
 
     if (offsetFound)
       break;
 
     *(aStartHTOffset) -= nsAccUtils::TextLength(currAcc);
   }
 
   // Navigate forward from anchor accessible to find end offset.
-  PRInt32 childLen = mHyperTextAcc->GetChildCount();
-  for (PRInt32 childIdx = mOffsetAccIdx + 1; childIdx < childLen; childIdx++) {
+  PRUint32 childLen = mHyperTextAcc->ChildCount();
+  for (PRUint32 childIdx = mOffsetAccIdx + 1; childIdx < childLen; childIdx++) {
     nsAccessible *currAcc = mHyperTextAcc->GetChildAt(childIdx);
     if (nsAccUtils::IsEmbeddedObject(currAcc))
       break;
 
     nsIContent* currElm = nsCoreUtils::GetDOMElementFor(currAcc->GetContent());
     if (!currElm)
       return;
 
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -416,18 +416,18 @@ bool
 nsAccUtils::IsTextInterfaceSupportCorrect(nsAccessible* aAccessible)
 {
   // Don't test for accessible docs, it makes us create accessibles too
   // early and fire mutation events before we need to
   if (aAccessible->IsDoc())
     return true;
 
   bool foundText = false;
-  PRInt32 childCount = aAccessible->GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = aAccessible->ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible* child = aAccessible->GetChildAt(childIdx);
     if (IsText(child)) {
       foundText = true;
       break;
     }
   }
 
   if (foundText) {
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -481,58 +481,47 @@ NS_IMETHODIMP
 nsAccessible::GetFirstChild(nsIAccessible **aFirstChild) 
 {
   NS_ENSURE_ARG_POINTER(aFirstChild);
   *aFirstChild = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  PRInt32 childCount = GetChildCount();
-  NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
-
-  if (childCount > 0)
-    NS_ADDREF(*aFirstChild = GetChildAt(0));
-
+  NS_IF_ADDREF(*aFirstChild = FirstChild());
   return NS_OK;
 }
 
   /* readonly attribute nsIAccessible lastChild; */
 NS_IMETHODIMP
 nsAccessible::GetLastChild(nsIAccessible **aLastChild)
 {
   NS_ENSURE_ARG_POINTER(aLastChild);
   *aLastChild = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  PRInt32 childCount = GetChildCount();
-  NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
-
-  NS_IF_ADDREF(*aLastChild = GetChildAt(childCount - 1));
+  NS_IF_ADDREF(*aLastChild = LastChild());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessible::GetChildAt(PRInt32 aChildIndex, nsIAccessible **aChild)
 {
   NS_ENSURE_ARG_POINTER(aChild);
   *aChild = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  PRInt32 childCount = GetChildCount();
-  NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
-
   // If child index is negative, then return last child.
   // XXX: do we really need this?
   if (aChildIndex < 0)
-    aChildIndex = childCount - 1;
+    aChildIndex = ChildCount() - 1;
 
   nsAccessible* child = GetChildAt(aChildIndex);
   if (!child)
     return NS_ERROR_INVALID_ARG;
 
   NS_ADDREF(*aChild = child);
   return NS_OK;
 }
@@ -542,25 +531,23 @@ NS_IMETHODIMP
 nsAccessible::GetChildren(nsIArray **aOutChildren)
 {
   NS_ENSURE_ARG_POINTER(aOutChildren);
   *aOutChildren = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  PRInt32 childCount = GetChildCount();
-  NS_ENSURE_TRUE(childCount != -1, NS_ERROR_FAILURE);
-
   nsresult rv = NS_OK;
   nsCOMPtr<nsIMutableArray> children =
     do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsIAccessible* child = GetChildAt(childIdx);
     children->AppendElement(child, false);
   }
 
   NS_ADDREF(*aOutChildren = children);
   return NS_OK;
 }
 
@@ -574,18 +561,18 @@ nsAccessible::CanHaveAnonChildren()
 NS_IMETHODIMP
 nsAccessible::GetChildCount(PRInt32 *aChildCount) 
 {
   NS_ENSURE_ARG_POINTER(aChildCount);
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  *aChildCount = GetChildCount();
-  return *aChildCount != -1 ? NS_OK : NS_ERROR_FAILURE;  
+  *aChildCount = ChildCount();
+  return NS_OK;
 }
 
 /* readonly attribute long indexInParent; */
 NS_IMETHODIMP
 nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
 {
   NS_ENSURE_ARG_POINTER(aIndexInParent);
 
@@ -810,19 +797,19 @@ nsAccessible::ChildAtPoint(PRInt32 aX, P
     return fallbackAnswer;
 
   if (accessible == this) {
     // Manually walk through accessible children and see if the are within this
     // point. Skip offscreen or invisible accessibles. This takes care of cases
     // where layout won't walk into things for us, such as image map areas and
     // sub documents (XXX: subdocuments should be handled by methods of
     // OuterDocAccessibles).
-    PRInt32 childCount = GetChildCount();
-    for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
-      nsAccessible *child = GetChildAt(childIdx);
+    PRUint32 childCount = ChildCount();
+    for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
+      nsAccessible* child = GetChildAt(childIdx);
 
       PRInt32 childX, childY, childWidth, childHeight;
       child->GetBounds(&childX, &childY, &childWidth, &childHeight);
       if (aX >= childX && aX < childX + childWidth &&
           aY >= childY && aY < childY + childHeight &&
           (child->State() & states::INVISIBLE) == 0) {
 
         if (aWhichChild == eDeepestChild)
@@ -2665,44 +2652,44 @@ nsAccessible::GetChildAt(PRUint32 aIndex
   nsAccessible* realParent = child->mParent;
   NS_ASSERTION(!realParent || realParent == this,
                "Two accessibles have the same first child accessible!");
 #endif
 
   return child;
 }
 
-PRInt32
-nsAccessible::GetChildCount()
+PRUint32
+nsAccessible::ChildCount() const
 {
   return mChildren.Length();
 }
 
 PRInt32
 nsAccessible::GetIndexOf(nsAccessible* aChild)
 {
   return (aChild->mParent != this) ? -1 : aChild->IndexInParent();
 }
 
 PRInt32
 nsAccessible::IndexInParent() const
 {
   return mIndexInParent;
 }
 
-PRInt32
-nsAccessible::GetEmbeddedChildCount()
+PRUint32
+nsAccessible::EmbeddedChildCount()
 {
   if (IsChildrenFlag(eMixedChildren)) {
     if (!mEmbeddedObjCollector)
       mEmbeddedObjCollector = new EmbeddedObjCollector(this);
-    return mEmbeddedObjCollector ? mEmbeddedObjCollector->Count() : -1;
+    return mEmbeddedObjCollector->Count();
   }
 
-  return GetChildCount();
+  return ChildCount();
 }
 
 nsAccessible*
 nsAccessible::GetEmbeddedChildAt(PRUint32 aIndex)
 {
   if (IsChildrenFlag(eMixedChildren)) {
     if (!mEmbeddedObjCollector)
       mEmbeddedObjCollector = new EmbeddedObjCollector(this);
@@ -3069,17 +3056,18 @@ nsAccessible::GetSiblingAtOffset(PRInt32
 {
   if (!mParent || mIndexInParent == -1) {
     if (aError)
       *aError = NS_ERROR_UNEXPECTED;
 
     return nsnull;
   }
 
-  if (aError && mIndexInParent + aOffset >= mParent->GetChildCount()) {
+  if (aError &&
+      mIndexInParent + aOffset >= static_cast<PRInt32>(mParent->ChildCount())) {
     *aError = NS_OK; // fail peacefully
     return nsnull;
   }
 
   nsAccessible* child = mParent->GetChildAt(mIndexInParent + aOffset);
   if (aError && !child)
     *aError = NS_ERROR_UNEXPECTED;
 
@@ -3244,18 +3232,18 @@ nsAccessible::GetLevelInternal()
         break;
 
     }
 
     if (level == 0) {
       // If this listitem is on top of nested lists then expose 'level'
       // attribute.
       parent = Parent();
-      PRInt32 siblingCount = parent->GetChildCount();
-      for (PRInt32 siblingIdx = 0; siblingIdx < siblingCount; siblingIdx++) {
+      PRUint32 siblingCount = parent->ChildCount();
+      for (PRUint32 siblingIdx = 0; siblingIdx < siblingCount; siblingIdx++) {
         nsAccessible* sibling = parent->GetChildAt(siblingIdx);
 
         nsAccessible* siblingChild = sibling->LastChild();
         if (siblingChild && siblingChild->Role() == roles::LIST)
           return 1;
       }
     } else {
       ++ level; // level is 1-index based
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -323,17 +323,17 @@ public:
   /**
    * Return child accessible at the given index.
    */
   virtual nsAccessible* GetChildAt(PRUint32 aIndex);
 
   /**
    * Return child accessible count.
    */
-  virtual PRInt32 GetChildCount();
+  virtual PRUint32 ChildCount() const;
 
   /**
    * Return index of the given child accessible.
    */
   virtual PRInt32 GetIndexOf(nsAccessible* aChild);
 
   /**
    * Return index in parent accessible.
@@ -348,28 +348,28 @@ public:
   /**
    * Return first/last/next/previous sibling of the accessible.
    */
   inline nsAccessible* NextSibling() const
     {  return GetSiblingAtOffset(1); }
   inline nsAccessible* PrevSibling() const
     { return GetSiblingAtOffset(-1); }
   inline nsAccessible* FirstChild()
-    { return GetChildCount() != 0 ? GetChildAt(0) : nsnull; }
+    { return GetChildAt(0); }
   inline nsAccessible* LastChild()
   {
-    PRUint32 childCount = GetChildCount();
+    PRUint32 childCount = ChildCount();
     return childCount != 0 ? GetChildAt(childCount - 1) : nsnull;
   }
 
 
   /**
    * Return embedded accessible children count.
    */
-  PRInt32 GetEmbeddedChildCount();
+  PRUint32 EmbeddedChildCount();
 
   /**
    * Return embedded accessible child at the given index.
    */
   nsAccessible* GetEmbeddedChildAt(PRUint32 aIndex);
 
   /**
    * Return index of the given embedded accessible child.
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -170,19 +170,19 @@ nsTextEquivUtils::AppendTextEquivFromTex
 nsRefPtr<nsAccessible> nsTextEquivUtils::gInitiatorAcc;
 
 nsresult
 nsTextEquivUtils::AppendFromAccessibleChildren(nsAccessible *aAccessible,
                                                nsAString *aString)
 {
   nsresult rv = NS_OK_NO_NAME_CLAUSE_HANDLED;
 
-  PRInt32 childCount = aAccessible->GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
-    nsAccessible *child = aAccessible->GetChildAt(childIdx);
+  PRUint32 childCount = aAccessible->ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
+    nsAccessible* child = aAccessible->GetChildAt(childIdx);
     rv = AppendFromAccessible(child, aString);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return rv;
 }
 
 nsresult
--- a/accessible/src/generic/ARIAGridAccessible.cpp
+++ b/accessible/src/generic/ARIAGridAccessible.cpp
@@ -1035,19 +1035,19 @@ ARIAGridCellAccessible::GetAttributesInt
 
   // Expose "table-cell-index" attribute.
 
   nsAccessible* thisRow = Parent();
   if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
   PRInt32 colIdx = 0, colCount = 0;
-  PRInt32 childCount = thisRow->GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
-    nsAccessible *child = thisRow->GetChildAt(childIdx);
+  PRUint32 childCount = thisRow->ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
+    nsAccessible* child = thisRow->GetChildAt(childIdx);
     if (child == this)
       colIdx = colCount;
 
     roles::Role role = child->Role();
     if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
         role == roles::COLUMNHEADER)
       colCount++;
   }
@@ -1056,19 +1056,19 @@ ARIAGridCellAccessible::GetAttributesInt
   if (!table)
     return NS_OK;
 
   roles::Role tableRole = table->Role();
   if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
     return NS_OK;
 
   PRInt32 rowIdx = 0;
-  childCount = table->GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
-    nsAccessible *child = table->GetChildAt(childIdx);
+  childCount = table->ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
+    nsAccessible* child = table->GetChildAt(childIdx);
     if (child == thisRow)
       break;
 
     if (child->Role() == roles::ROW)
       rowIdx++;
   }
 
   PRInt32 idx = rowIdx * colCount + colIdx;
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -584,18 +584,18 @@ RootAccessible::HandlePopupHidingEvent(n
     return;
 
   nsAccessible* popup = document->GetAccessible(aPopupNode);
   if (!popup) {
     nsAccessible* popupContainer = document->GetContainerAccessible(aPopupNode);
     if (!popupContainer)
       return;
 
-    PRInt32 childCount = popupContainer->GetChildCount();
-    for (PRInt32 idx = 0; idx < childCount; idx++) {
+    PRUint32 childCount = popupContainer->ChildCount();
+    for (PRUint32 idx = 0; idx < childCount; idx++) {
       nsAccessible* child = popupContainer->GetChildAt(idx);
       if (child->IsAutoCompletePopup()) {
         popup = child;
         break;
       }
     }
 
     // No popup no events. Focus is managed by DOM. This is a case for
--- a/accessible/src/html/nsHTMLImageMapAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageMapAccessible.cpp
@@ -46,17 +46,17 @@ nsHTMLImageMapAccessible::NativeRole()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: HyperLinkAccessible
 
 PRUint32
 nsHTMLImageMapAccessible::AnchorCount()
 {
-  return GetChildCount();
+  return ChildCount();
 }
 
 nsAccessible*
 nsHTMLImageMapAccessible::AnchorAt(PRUint32 aAnchorIndex)
 {
   return GetChildAt(aAnchorIndex);
 }
 
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -107,17 +107,17 @@ nsHTMLTableCellAccessible::GetAttributes
   stringIdx.AppendInt(idx);
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex, stringIdx);
 
   // abbr attribute
 
   // Pick up object attribute from abbr DOM element (a child of the cell) or
   // from abbr DOM attribute.
   nsAutoString abbrText;
-  if (GetChildCount() == 1) {
+  if (ChildCount() == 1) {
     nsAccessible* abbr = FirstChild();
     if (abbr->IsAbbreviation()) {
       nsTextEquivUtils::
         AppendTextEquivFromTextContent(abbr->GetContent()->GetFirstChild(),
                                        &abbrText);
     }
   }
   if (abbrText.IsEmpty())
@@ -1392,17 +1392,17 @@ nsHTMLTableAccessible::IsProbablyLayoutT
               if (cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::headers) ||
                   cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::scope) ||
                   cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::abbr)) {
                 RETURN_LAYOUT_ANSWER(false,
                                      "Has headers, scope, or abbr attribute -- legitimate table structures");
               }
 
               nsAccessible* cell = mDoc->GetAccessible(cellElm);
-              if (cell && cell->GetChildCount() == 1 &&
+              if (cell && cell->ChildCount() == 1 &&
                   cell->FirstChild()->IsAbbreviation()) {
                 RETURN_LAYOUT_ANSWER(false,
                                      "has abbr -- legitimate table structures");
               }
             }
           }
         }
       }
@@ -1449,17 +1449,17 @@ nsHTMLTableAccessible::IsProbablyLayoutT
   }
 
   /**
    * Rules for non-bordered tables with 2-4 columns and 2+ rows from here on forward
    */
 
   // Check for styled background color across rows (alternating background
   // color is a common feature for data tables).
-  PRUint32 childCount = GetChildCount();
+  PRUint32 childCount = ChildCount();
   nscolor rowColor, prevRowColor;
   for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible* child = GetChildAt(childIdx);
     if (child->Role() == roles::ROW) {
       prevRowColor = rowColor;
       nsIFrame* rowFrame = child->GetFrame();
       rowColor = rowFrame->GetStyleBackground()->mBackgroundColor;
 
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -135,17 +135,17 @@ nsHyperTextAccessible::NativeState()
   if (editor) {
     states |= states::EDITABLE;
 
   } else if (mContent->Tag() == nsGkAtoms::article) {
     // We want <article> to behave like a document in terms of readonly state.
     states |= states::READONLY;
   }
 
-  if (GetChildCount() > 0)
+  if (HasChildren())
     states |= states::SELECTABLE_TEXT;
 
   return states;
 }
 
 // Substring must be entirely within the same text node
 nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 aStartRenderedOffset,
                                                     PRUint32 aEndRenderedOffset)
@@ -266,18 +266,18 @@ nsHyperTextAccessible::GetPosAndText(PRI
   nsIntRect unionRect;
   nsAccessible *lastAccessible = nsnull;
 
   gfxSkipChars skipChars;
   gfxSkipCharsIterator iter;
 
   // Loop through children and collect valid offsets, text and bounds
   // depending on what we need for out parameters.
-  PRInt32 childCount = GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *childAcc = mChildren[childIdx];
     lastAccessible = childAcc;
 
     nsIFrame *frame = childAcc->GetFrame();
     if (!frame) {
       continue;
     }
     nsIFrame *primaryFrame = frame;
@@ -604,19 +604,19 @@ nsHyperTextAccessible::DOMPointToHyperte
 
     descendantAcc = parentAcc;
   }
 
   // Loop through, adding offsets until we reach childAccessible
   // If childAccessible is null we will end up adding up the entire length of
   // the hypertext, which is good -- it just means our offset node
   // came after the last accessible child's node
-  PRInt32 childCount = GetChildCount();
+  PRUint32 childCount = ChildCount();
 
-  PRInt32 childIdx = 0;
+  PRUint32 childIdx = 0;
   nsAccessible *childAcc = nsnull;
   for (; childIdx < childCount; childIdx++) {
     childAcc = mChildren[childIdx];
     if (childAcc == childAccAtOffset)
       break;
 
     *aHyperTextOffset += nsAccUtils::TextLength(childAcc);
   }
@@ -1285,18 +1285,18 @@ nsHyperTextAccessible::GetOffsetAtPoint(
                            context->DevPixelsToAppUnits(pxInHyperText.y));
 
   // Go through the frames to check if each one has the point.
   // When one does, add up the character offsets until we have a match
 
   // We have an point in an accessible child of this, now we need to add up the
   // offsets before it to what we already have
   PRInt32 offset = 0;
-  PRInt32 childCount = GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *childAcc = mChildren[childIdx];
 
     nsIFrame *primaryFrame = childAcc->GetFrame();
     NS_ENSURE_TRUE(primaryFrame, NS_ERROR_FAILURE);
 
     nsIFrame *frame = primaryFrame;
     while (frame) {
       nsIContent *content = frame->GetContent();
@@ -2190,17 +2190,17 @@ nsHyperTextAccessible::GetChildIndexAtOf
       }
       if (high == offsetCount)
         return -1;
 
       return low;
     }
   }
 
-  PRUint32 childCount = GetChildCount();
+  PRUint32 childCount = ChildCount();
   while (mOffsets.Length() < childCount) {
     nsAccessible* child = GetChildAt(mOffsets.Length());
     lastOffset += nsAccUtils::TextLength(child);
     mOffsets.AppendElement(lastOffset);
     if (aOffset < lastOffset)
       return mOffsets.Length() - 1;
   }
 
--- a/accessible/src/html/nsHyperTextAccessible.h
+++ b/accessible/src/html/nsHyperTextAccessible.h
@@ -73,17 +73,17 @@ public:
   //////////////////////////////////////////////////////////////////////////////
   // HyperLinkAccessible
 
   /**
    * Return link count within this hypertext accessible.
    */
   inline PRUint32 GetLinkCount()
   {
-    return GetEmbeddedChildCount();
+    return EmbeddedChildCount();
   }
 
   /**
    * Return link accessible at the given index.
    */
   inline nsAccessible* GetLinkAt(PRUint32 aIndex)
   {
     return GetEmbeddedChildAt(aIndex);
@@ -176,17 +176,17 @@ public:
   //////////////////////////////////////////////////////////////////////////////
   // TextAccessible
 
   /**
    * Return character count within the hypertext accessible.
    */
   inline PRUint32 CharacterCount()
   {
-    return GetChildOffset(GetChildCount());
+    return GetChildOffset(ChildCount());
   }
 
   /**
    * Get a character before/at/after the given offset.
    *
    * @param aOffset       [in] the given offset
    * @param aShift        [in] specifies whether to get a char before/at/after
    *                        offset
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -228,18 +228,18 @@ nsAccessibleWrap::IsIgnored()
 
 void
 nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsAccessible*>* aChildrenArray)
 {
   // we're flat; there are no children.
   if (nsAccUtils::MustPrune(this))
     return;
 
-  PRInt32 childCount = GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessibleWrap *childAcc =
       static_cast<nsAccessibleWrap*>(GetChildAt(childIdx));
 
     // If element is ignored, then add its children as substitutes.
     if (childAcc->IsIgnored()) {
       childAcc->GetUnignoredChildren(aChildrenArray);
       continue;
     }
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -182,17 +182,17 @@ STDMETHODIMP nsAccessibleWrap::get_accCh
   *pcountChildren = 0;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (nsAccUtils::MustPrune(this))
     return S_OK;
 
-  *pcountChildren = GetChildCount();
+  *pcountChildren = ChildCount();
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return S_OK;
 }
 
 STDMETHODIMP nsAccessibleWrap::get_accChild(
       /* [in] */ VARIANT varChild,
       /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
@@ -1043,20 +1043,20 @@ STDMETHODIMP
 nsAccessibleWrap::Skip(ULONG aNumElements)
 {
 __try {
   if (mEnumVARIANTPosition == kIEnumVariantDisconnected)
     return CO_E_OBJNOTCONNECTED;
 
   mEnumVARIANTPosition += aNumElements;
 
-  PRInt32 numChildren = GetChildCount();
-  if (mEnumVARIANTPosition > numChildren)
+  PRUint32 childCount = ChildCount();
+  if (mEnumVARIANTPosition > static_cast<PRInt32>(childCount))
   {
-    mEnumVARIANTPosition = numChildren;
+    mEnumVARIANTPosition = childCount;
     return S_FALSE;
   }
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return NOERROR;
 }
 
 STDMETHODIMP
 nsAccessibleWrap::Reset(void)
--- a/accessible/src/xforms/nsXFormsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsAccessible.cpp
@@ -470,18 +470,18 @@ nsXFormsSelectableAccessible::SelectAll(
   return true;
 }
 
 nsIContent*
 nsXFormsSelectableAccessible::GetItemByIndex(PRUint32* aIndex,
                                              nsAccessible* aAccessible)
 {
   nsAccessible* accessible = aAccessible ? aAccessible : this;
-  PRInt32 childCount = accessible->GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = accessible->ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *child = accessible->GetChildAt(childIdx);
     nsIContent* childContent = child->GetContent();
     nsINodeInfo *nodeInfo = childContent->NodeInfo();
     if (nodeInfo->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS))) {
       if (nodeInfo->Equals(nsGkAtoms::item)) {
         if (!*aIndex)
           return childContent;
 
--- a/accessible/src/xul/XULFormControlAccessible.cpp
+++ b/accessible/src/xul/XULFormControlAccessible.cpp
@@ -441,18 +441,18 @@ XULGroupboxAccessible::RelationByType(PR
 {
   Relation rel = nsAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
     return rel;
 
   // The label for xul:groupbox is generated from xul:label that is
   // inside the anonymous content of the xul:caption.
   // The xul:label has an accessible object but the xul:caption does not
-  PRInt32 childCount = GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *childAcc = GetChildAt(childIdx);
     if (childAcc->Role() == roles::LABEL) {
       // Ensure that it's our label
       Relation reverseRel =
         childAcc->RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
       nsAccessible* testGroupbox = nsnull;
       while ((testGroupbox = reverseRel.Next()))
         if (testGroupbox == this) {
@@ -596,18 +596,18 @@ XULToolbarButtonAccessible::GetPositionA
 {
   PRInt32 setSize = 0;
   PRInt32 posInSet = 0;
 
   nsAccessible* parent = Parent();
   if (!parent)
     return;
 
-  PRInt32 childCount = parent->GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
+  PRUint32 childCount = parent->ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible* child = parent->GetChildAt(childIdx);
     if (IsSeparator(child)) { // end of a group of buttons
       if (posInSet)
         break; // we've found our group, so we're done
 
       setSize = 0; // not our group, so start a new group
 
     } else {
--- a/accessible/src/xul/nsXULListboxAccessible.cpp
+++ b/accessible/src/xul/nsXULListboxAccessible.cpp
@@ -523,19 +523,19 @@ nsXULListboxAccessible::GetSelectedCells
   PRUint32 index = 0;
   for (; index < selectedItemsCount; index++) {
     nsCOMPtr<nsIDOMNode> itemNode;
     selectedItems->Item(index, getter_AddRefs(itemNode));
     nsCOMPtr<nsIContent> itemContent(do_QueryInterface(itemNode));
     nsAccessible *item = mDoc->GetAccessible(itemContent);
 
     if (item) {
-      PRInt32 cellCount = item->GetChildCount();
-      for (PRInt32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
-        nsAccessible *cell = mChildren[cellIdx];
+      PRUint32 cellCount = item->ChildCount();
+      for (PRUint32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
+        nsAccessible* cell = mChildren[cellIdx];
         if (cell->Role() == roles::CELL)
           selCells->AppendElement(static_cast<nsIAccessible*>(cell), false);
       }
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
@@ -1075,18 +1075,18 @@ nsXULListCellAccessible::GetColumnHeader
   nsCOMPtr<nsIAccessibleTable> table;
   GetTable(getter_AddRefs(table));
   NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
 
   // Get column header cell from XUL listhead.
   nsAccessible *list = nsnull;
 
   nsRefPtr<nsAccessible> tableAcc(do_QueryObject(table));
-  PRInt32 tableChildCount = tableAcc->GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < tableChildCount; childIdx++) {
+  PRUint32 tableChildCount = tableAcc->ChildCount();
+  for (PRUint32 childIdx = 0; childIdx < tableChildCount; childIdx++) {
     nsAccessible *child = tableAcc->GetChildAt(childIdx);
     if (child->Role() == roles::LIST) {
       list = child;
       break;
     }
   }
 
   if (list) {
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -423,32 +423,29 @@ nsXULTreeAccessible::SelectAll()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeAccessible: nsAccessible implementation
 
 nsAccessible*
 nsXULTreeAccessible::GetChildAt(PRUint32 aIndex)
 {
-  PRInt32 childCount = nsAccessible::GetChildCount();
-  if (childCount == -1)
-    return nsnull;
-
-  if (static_cast<PRInt32>(aIndex) < childCount)
+  PRUint32 childCount = nsAccessible::ChildCount();
+  if (aIndex < childCount)
     return nsAccessible::GetChildAt(aIndex);
 
   return GetTreeItemAccessible(aIndex - childCount);
 }
 
-PRInt32
-nsXULTreeAccessible::GetChildCount()
+PRUint32
+nsXULTreeAccessible::ChildCount() const
 {
-  // tree's children count is row count + treecols count.
-  PRInt32 childCount = nsAccessible::GetChildCount();
-  if (childCount == -1 || !mTreeView)
+  // Tree's children count is row count + treecols count.
+  PRUint32 childCount = nsAccessible::ChildCount();
+  if (!mTreeView)
     return childCount;
 
   PRInt32 rowCount = 0;
   mTreeView->GetRowCount(&rowCount);
   childCount += rowCount;
 
   return childCount;
 }
--- a/accessible/src/xul/nsXULTreeAccessible.h
+++ b/accessible/src/xul/nsXULTreeAccessible.h
@@ -18,17 +18,16 @@ const PRUint32 kDefaultTreeCacheSize = 2
 
 /**
  * Accessible class for XUL tree element.
  */
 
 class nsXULTreeAccessible : public nsAccessibleWrap
 {
 public:
-  using nsAccessible::GetChildCount;
   using nsAccessible::GetChildAt;
 
   nsXULTreeAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeAccessible,
                                            nsAccessible)
@@ -39,17 +38,17 @@ public:
   // nsAccessible
   virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
 
   virtual nsAccessible* GetChildAt(PRUint32 aIndex);
-  virtual PRInt32 GetChildCount();
+  virtual PRUint32 ChildCount() const;
 
   // SelectAccessible
   virtual bool IsSelect();
   virtual already_AddRefed<nsIArray> SelectedItems();
   virtual PRUint32 SelectedItemCount();
   virtual nsAccessible* GetSelectedItem(PRUint32 aIndex);
   virtual bool IsItemSelected(PRUint32 aIndex);
   virtual bool AddItemToSelection(PRUint32 aIndex);
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -662,22 +662,19 @@ nsXULTreeGridRowAccessible::GetChildAt(P
   nsCOMPtr<nsITreeColumn> column =
     nsCoreUtils::GetSensibleColumnAt(mTree, aIndex);
   if (!column)
     return nsnull;
 
   return GetCellAccessible(column);
 }
 
-PRInt32
-nsXULTreeGridRowAccessible::GetChildCount()
+PRUint32
+nsXULTreeGridRowAccessible::ChildCount() const
 {
-  if (IsDefunct())
-    return -1;
-
   return nsCoreUtils::GetSensibleColumnCount(mTree);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeGridRowAccessible: nsXULTreeItemAccessibleBase implementation
 
 nsAccessible*
 nsXULTreeGridRowAccessible::GetCellAccessible(nsITreeColumn* aColumn)
--- a/accessible/src/xul/nsXULTreeGridAccessible.h
+++ b/accessible/src/xul/nsXULTreeGridAccessible.h
@@ -49,17 +49,16 @@ protected:
 
 /**
  * Represents accessible for XUL tree item in the case when XUL tree has
  * multiple columns.
  */
 class nsXULTreeGridRowAccessible : public nsXULTreeItemAccessibleBase
 {
 public:
-  using nsAccessible::GetChildCount;
   using nsAccessible::GetChildAt;
 
   nsXULTreeGridRowAccessible(nsIContent* aContent, nsDocAccessible* aDoc,
                              nsAccessible* aParent, nsITreeBoxObject* aTree,
                              nsITreeView* aTreeView, PRInt32 aRow);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
@@ -71,17 +70,17 @@ public:
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
 
   virtual nsAccessible* GetChildAt(PRUint32 aIndex);
-  virtual PRInt32 GetChildCount();
+  virtual PRUint32 ChildCount() const;
 
   // nsXULTreeItemAccessibleBase
   virtual nsAccessible* GetCellAccessible(nsITreeColumn *aColumn);
   virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
 
 protected:
 
   // nsAccessible