Introduce CPDF_Dest::GetScrollPositionsArray().
This de-duplicates code from two places, and avoids exposing
the internal array for these cases.
Change-Id: Ibc1679177afb35be85e9d00e997aa0fbedcd8925
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/99070
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index adbe03a..0178e9c 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -888,17 +888,8 @@
CPDF_Document* document = GetPDFDocument();
DCHECK(document);
- const CPDF_Array* dest_array = dest.GetArray();
- std::vector<float> dest_positions;
- // |dest_array| index 0 contains destination page details and index 1 contains
- // parameter that explains about the rest of |dest_array|.
- if (dest_array) {
- for (size_t i = 2; i < dest_array->size(); i++)
- dest_positions.push_back(dest_array->GetFloatAt(i));
- }
-
- DoGoToAction(dest.GetDestPageIndex(document), dest.GetZoomMode(),
- dest_positions);
+ std::vector<float> positions = dest.GetScrollPositionArray();
+ DoGoToAction(dest.GetDestPageIndex(document), dest.GetZoomMode(), positions);
return true;
}