summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-27 20:29:37 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 20:29:37 +0000
commit74136f59eaebb98a4dcc23777203d907d9555c1a (patch)
tree18d6014174d15139f761a1c18960ee061ae85039 /fpdfsdk/fpdfxfa
parente3c44e1403906a88d500089c934bc034b8025ae2 (diff)
downloadpdfium-74136f59eaebb98a4dcc23777203d907d9555c1a.tar.xz
Remove arguments from CPDFSDK_FormFillEnvironment methods (part 2)
Follow-on from https://pdfium-review.googlesource.com/c/pdfium/+/31591 Under XFA, the Form Fill Environment already has the XFA context, so there is no need for callers to obtain it and pass it. Tidy some duplicate string allocations along the way. Change-Id: Ia7614b200146e7ca1f68a18f9d2ce118946b53e8 Reviewed-on: https://pdfium-review.googlesource.com/31610 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 4bf6064a34..984fff715c 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -351,14 +351,12 @@ int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) {
int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return -1;
+
if (m_pContext->GetFormType() != FormType::kXFAFull)
return -1;
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
- if (!pFormFillEnv)
- return -1;
-
- return pFormFillEnv->GetCurrentPageIndex(m_pContext.Get());
+ return pFormFillEnv ? pFormFillEnv->GetCurrentPageIndex() : -1;
}
void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc,
@@ -372,7 +370,8 @@ void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc,
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return;
- pFormFillEnv->SetCurrentPage(m_pContext.Get(), iCurPage);
+
+ pFormFillEnv->SetCurrentPage(iCurPage);
}
bool CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
@@ -517,7 +516,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
}
void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
- const WideString& bsURL) {
+ const WideString& wsURL) {
if (hDoc != m_pContext->GetXFADoc())
return;
@@ -528,8 +527,7 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
if (!pFormFillEnv)
return;
- WideStringView str(bsURL.c_str());
- pFormFillEnv->GotoURL(m_pContext.Get(), str);
+ pFormFillEnv->GotoURL(wsURL);
}
bool CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {