Convert CXFA_Node::GetChild to take a size_t for the index

Change-Id: I99ab62f03a42bb1dc5f4d228cd60c0e254a8c70b
Reviewed-on: https://pdfium-review.googlesource.com/22259
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index 2a47411..f9bd26b 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -43,6 +43,6 @@
 
 CXFA_Node* CXFA_AttachNodeList::Item(size_t index) {
   return m_pAttachNode->GetChild<CXFA_Node>(
-      pdfium::base::checked_cast<int32_t>(index), XFA_Element::Unknown,
+      index, XFA_Element::Unknown,
       m_pAttachNode->GetElementType() == XFA_Element::Subform);
 }
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 3d132fe..08af200 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -796,22 +796,20 @@
   return count;
 }
 
-CXFA_Node* CXFA_Node::GetChildInternal(int32_t index,
+CXFA_Node* CXFA_Node::GetChildInternal(size_t index,
                                        XFA_Element eType,
                                        bool bOnlyChild) {
-  ASSERT(index > -1);
-
-  int32_t iCount = 0;
+  size_t count = 0;
   for (CXFA_Node* pNode = m_pChild; pNode;
        pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
     if (pNode->GetElementType() != eType && eType != XFA_Element::Unknown)
       continue;
     if (bOnlyChild && HasProperty(pNode->GetElementType()))
       continue;
-    if (iCount == index)
+    if (count == index)
       return pNode;
 
-    ++iCount;
+    ++count;
   }
   return nullptr;
 }
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index cc8d5e8..dea53e4 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -157,7 +157,7 @@
   size_t CountChildren(XFA_Element eType, bool bOnlyChild);
 
   template <typename T>
-  T* GetChild(int32_t index, XFA_Element eType, bool bOnlyChild) {
+  T* GetChild(size_t index, XFA_Element eType, bool bOnlyChild) {
     return static_cast<T*>(GetChildInternal(index, eType, bOnlyChild));
   }
 
@@ -246,9 +246,7 @@
   void OnRemoved(bool bNotify);
   Optional<void*> GetDefaultValue(XFA_Attribute attr,
                                   XFA_AttributeType eType) const;
-  CXFA_Node* GetChildInternal(int32_t index,
-                              XFA_Element eType,
-                              bool bOnlyChild);
+  CXFA_Node* GetChildInternal(size_t index, XFA_Element eType, bool bOnlyChild);
   CXFA_Node* GetFirstChildByClassInternal(XFA_Element eType) const;
   CXFA_Node* GetNextSameNameSiblingInternal(
       const WideStringView& wsNodeName) const;