Add CXFA_ItemLayoutProcessor::GotoNextContainerNodeSimple().

Wrapper around the most common use cases for GotoNextContainerNode().

Change-Id: Ica543a02b374f30166bd62bae9aa5f7886bb45c7
Reviewed-on: https://pdfium-review.googlesource.com/c/47276
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index e622469..b48881a 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -839,6 +839,11 @@
   return pLayoutItem;
 }
 
+void CXFA_ItemLayoutProcessor::GotoNextContainerNodeSimple(bool bUsePageBreak) {
+  GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
+                        bUsePageBreak);
+}
+
 void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
     CXFA_Node*& pCurActionNode,
     XFA_ItemLayoutProcessorStages* nCurStage,
@@ -1122,14 +1127,11 @@
   float fContentCalculatedHeight = 0;
   float fHiddenContentCalculatedWidth = 0;
   float fHiddenContentCalculatedHeight = 0;
-  if (!m_pCurChildNode) {
-    GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
-                          false);
-  }
+  if (!m_pCurChildNode)
+    GotoNextContainerNodeSimple(false);
 
   int32_t iColIndex = 0;
-  for (; m_pCurChildNode; GotoNextContainerNode(
-           m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(), false)) {
+  for (; m_pCurChildNode; GotoNextContainerNodeSimple(false)) {
     if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
       continue;
     if (m_pCurChildNode->GetElementType() == XFA_Element::Variables)
@@ -1265,13 +1267,10 @@
   layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths;
   CXFA_LayoutContext* pLayoutContext =
       iSpecifiedColumnCount > 0 ? &layoutContext : nullptr;
-  if (!m_pCurChildNode) {
-    GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
-                          false);
-  }
+  if (!m_pCurChildNode)
+    GotoNextContainerNodeSimple(false);
 
-  for (; m_pCurChildNode; GotoNextContainerNode(
-           m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(), false)) {
+  for (; m_pCurChildNode; GotoNextContainerNodeSimple(false)) {
     layoutContext.m_fCurColumnWidth.reset();
     if (m_nCurChildNodeStage != XFA_ItemLayoutProcessorStages::Container)
       continue;
@@ -1700,10 +1699,8 @@
   }
 
   fContentCurRowY += InsertKeepLayoutItems();
-  if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::None) {
-    GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage, GetFormNode(),
-                          true);
-  }
+  if (m_nCurChildNodeStage == XFA_ItemLayoutProcessorStages::None)
+    GotoNextContainerNodeSimple(true);
 
   fContentCurRowY += InsertPendingItems(GetFormNode());
   if (m_pCurChildPreprocessor &&
@@ -1824,8 +1821,7 @@
                   &bAddedItemInRow, &bForceEndPage, pContext, false);
             }
           }
-          GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage,
-                                GetFormNode(), true);
+          GotoNextContainerNodeSimple(true);
           bForceEndPage = true;
           bIsManualBreak = true;
           goto SuspendAndCreateNewRow;
@@ -1877,8 +1873,7 @@
               AddPendingNode(pLeaderNode, true);
           }
 
-          GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage,
-                                GetFormNode(), true);
+          GotoNextContainerNodeSimple(true);
           if (bCreatePage) {
             bForceEndPage = true;
             bIsManualBreak = true;
@@ -1995,8 +1990,7 @@
         default:
           break;
       }
-      GotoNextContainerNode(m_pCurChildNode, &m_nCurChildNodeStage,
-                            GetFormNode(), true);
+      GotoNextContainerNodeSimple(true);
       if (bAddedItemInRow && eFlowStrategy == XFA_AttributeValue::Tb)
         break;
       continue;
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
index 514bc56..b9bfb60 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.h
@@ -118,6 +118,7 @@
       bool bRootForceTb);
   void DoLayoutField();
 
+  void GotoNextContainerNodeSimple(bool bUsePageBreak);
   void GotoNextContainerNode(CXFA_Node*& pCurActionNode,
                              XFA_ItemLayoutProcessorStages* nCurStage,
                              CXFA_Node* pParentContainer,