Apply pdfium_noshorten_config to xfa/fxfa/layout.

-- alphabetize BUILD.gn variables following source section.
-- rewrite one loop that would never terminate since we no longer
   use -1 as a sentinel since moving to optional<>.

Change-Id: Icf2be4cf47dd89075cd33ee8fff6774999f8d3ad
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/90750
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/layout/BUILD.gn b/xfa/fxfa/layout/BUILD.gn
index 8c12c03..9970467 100644
--- a/xfa/fxfa/layout/BUILD.gn
+++ b/xfa/fxfa/layout/BUILD.gn
@@ -23,17 +23,18 @@
     "cxfa_viewlayoutprocessor.cpp",
     "cxfa_viewlayoutprocessor.h",
   ]
+  allow_circular_includes_from = [ "../../../fxjs" ]
+  configs += [
+    "../../../:pdfium_strict_config",
+    "../../../:pdfium_noshorten_config",
+    "../../:xfa_warnings",
+  ]
   deps = [
     "../../../core/fxcrt",
     "../../../fxjs",
     "../../../fxjs:gc",
     "../parser",
   ]
-  allow_circular_includes_from = [ "../../../fxjs" ]
-  configs += [
-    "../../../:pdfium_strict_config",
-    "../../:xfa_warnings",
-  ]
   visibility = [ "../../../*" ]
 }
 
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
index 086e02d..a8efdb7 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
@@ -181,9 +181,9 @@
     return nullptr;
 
   pTargetAll->Trim();
-  int32_t iSplitIndex = 0;
+  size_t iSplitIndex = 0;
   bool bTargetAllFind = true;
-  while (iSplitIndex != -1) {
+  while (true) {
     WideString wsExpr;
     absl::optional<size_t> iSplitNextIndex = 0;
     if (!bTargetAllFind) {
@@ -224,7 +224,6 @@
     }
     iSplitIndex = iSplitNextIndex.value();
   }
-  return nullptr;
 }
 
 void SetLayoutGeneratedNodeFlag(CXFA_Node* pNode) {
@@ -759,7 +758,9 @@
 int32_t CXFA_ViewLayoutProcessor::GetPageIndex(
     const CXFA_ViewLayoutItem* pPage) const {
   auto it = std::find(m_PageArray.begin(), m_PageArray.end(), pPage);
-  return it != m_PageArray.end() ? it - m_PageArray.begin() : -1;
+  return it != m_PageArray.end()
+             ? pdfium::base::checked_cast<int32_t>(it - m_PageArray.begin())
+             : -1;
 }
 
 bool CXFA_ViewLayoutProcessor::RunBreak(XFA_Element eBreakType,