From 74136f59eaebb98a4dcc23777203d907d9555c1a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 27 Apr 2018 20:29:37 +0000 Subject: 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 Commit-Queue: Tom Sepez --- fpdfsdk/cpdfsdk_formfillenvironment.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'fpdfsdk/cpdfsdk_formfillenvironment.cpp') diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index b9dbfe7785..4338f984e0 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -334,17 +334,15 @@ void CPDFSDK_FormFillEnvironment::DisplayCaret(CPDFXFA_Page* page, } } -int CPDFSDK_FormFillEnvironment::GetCurrentPageIndex( - CPDFXFA_Context* document) { +int CPDFSDK_FormFillEnvironment::GetCurrentPageIndex() const { if (!m_pInfo || !m_pInfo->FFI_GetCurrentPageIndex) return -1; - return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document); + return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, m_pUnderlyingDoc.Get()); } -void CPDFSDK_FormFillEnvironment::SetCurrentPage(CPDFXFA_Context* document, - int iCurPage) { +void CPDFSDK_FormFillEnvironment::SetCurrentPage(int iCurPage) { if (m_pInfo && m_pInfo->FFI_SetCurrentPage) - m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage); + m_pInfo->FFI_SetCurrentPage(m_pInfo, m_pUnderlyingDoc.Get(), iCurPage); } WideString CPDFSDK_FormFillEnvironment::GetPlatform() { @@ -365,13 +363,13 @@ WideString CPDFSDK_FormFillEnvironment::GetPlatform() { nActualLen / sizeof(uint16_t)); } -void CPDFSDK_FormFillEnvironment::GotoURL(CPDFXFA_Context* document, - const WideStringView& wsURL) { +void CPDFSDK_FormFillEnvironment::GotoURL(const WideString& wsURL) { if (!m_pInfo || !m_pInfo->FFI_GotoURL) return; - ByteString bsTo = WideString(wsURL).UTF16LE_Encode(); - m_pInfo->FFI_GotoURL(m_pInfo, document, AsFPDFWideString(&bsTo)); + ByteString bsTo = wsURL.UTF16LE_Encode(); + m_pInfo->FFI_GotoURL(m_pInfo, m_pUnderlyingDoc.Get(), + AsFPDFWideString(&bsTo)); } void CPDFSDK_FormFillEnvironment::GetPageViewRect(CPDFXFA_Page* page, -- cgit v1.2.3