Pass span<> to CPDFSDK_FormFillEnvironment::DoGoToAction().

Avoid casting a size_t to an int early on, and instead use a
checked conversion as a last step at the public API boundary.

Change-Id: I9952d49d119fe565e681065b03ba47567feae555
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/89610
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_actionhandler.cpp b/fpdfsdk/cpdfsdk_actionhandler.cpp
index fce2117..03c98d6 100644
--- a/fpdfsdk/cpdfsdk_actionhandler.cpp
+++ b/fpdfsdk/cpdfsdk_actionhandler.cpp
@@ -99,8 +99,7 @@
   }
 
   form_fill_env->DoGoToAction(dest.GetDestPageIndex(document),
-                              dest.GetZoomMode(), dest_positions.data(),
-                              dest_positions.size());
+                              dest.GetZoomMode(), dest_positions);
   return true;
 }
 
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 75abdc5..95b2bb7 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -450,11 +450,10 @@
 
 void CPDFSDK_FormFillEnvironment::DoGoToAction(int nPageIndex,
                                                int zoomMode,
-                                               float* fPosArray,
-                                               int sizeOfArray) {
+                                               pdfium::span<float> fPosArray) {
   if (m_pInfo && m_pInfo->FFI_DoGoToAction) {
-    m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray,
-                              sizeOfArray);
+    m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray.data(),
+                              fxcrt::CollectionSize<int>(fPosArray));
   }
 }
 
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index de04c32..19027d5 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -107,8 +107,7 @@
   void DoURIAction(const ByteString& bsURI, Mask<FWL_EVENTFLAG> modifiers);
   void DoGoToAction(int nPageIndex,
                     int zoomMode,
-                    float* fPosArray,
-                    int sizeOfArray);
+                    pdfium::span<float> fPosArray);
 
   CPDF_Document* GetPDFDocument() const { return m_pCPDFDoc.Get(); }
   CPDF_Document::Extension* GetDocExtension() const {
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 61fe0e1..328ff28 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -1408,8 +1408,7 @@
   }
   pRuntime->BeginBlock();
   m_pFormFillEnv->DoGoToAction(dest.GetDestPageIndex(pDocument),
-                               dest.GetZoomMode(), scrollPositionArray.data(),
-                               scrollPositionArray.size());
+                               dest.GetZoomMode(), scrollPositionArray);
   pRuntime->EndBlock();
   return CJS_Result::Success();
 }