diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-05-01 17:25:25 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-01 17:25:25 +0000 |
commit | fe06d5109cd575c1e53b9b1cc3cc4ec3c5d7364f (patch) | |
tree | fb6744bab0823722b566978e6a8195bf1509b8b2 /fpdfsdk/fpdf_formfill.cpp | |
parent | 302c8ce0ee78ecb10398c9b1fa2796d116bbb4a5 (diff) | |
download | pdfium-fe06d5109cd575c1e53b9b1cc3cc4ec3c5d7364f.tar.xz |
Make FPDF_Document always be CPDF_Document.
Greatly minimize the impact between going back and forth from
XFA being on/off, so that XFA case is just an extension beyond
the non-XFA data structures we've shipped for years, instead of
being a complete replacement of them.
Change-Id: I6c98206e0ec99ea443547a4931eba912b1764d54
Reviewed-on: https://pdfium-review.googlesource.com/31690
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_formfill.cpp')
-rw-r--r-- | fpdfsdk/fpdf_formfill.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp index 5d762ee1f0..3170627cd5 100644 --- a/fpdfsdk/fpdf_formfill.cpp +++ b/fpdfsdk/fpdf_formfill.cpp @@ -287,7 +287,7 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, if (!formInfo || formInfo->version != kRequiredVersion) return nullptr; - UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); + auto* pDocument = CPDFDocumentFromFPDFDocument(document); if (!pDocument) return nullptr; @@ -295,15 +295,16 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, // If the CPDFXFA_Context has a FormFillEnvironment already then we've done // this and can just return the old Env. Otherwise, we'll end up setting a new // environment into the XFADocument and, that could get weird. - if (pDocument->GetFormFillEnv()) - return pDocument->GetFormFillEnv(); + auto* pContext = static_cast<CPDFXFA_Context*>(pDocument->GetExtension()); + if (pContext->GetFormFillEnv()) + return pContext->GetFormFillEnv(); #endif auto pFormFillEnv = pdfium::MakeUnique<CPDFSDK_FormFillEnvironment>( CPDFDocumentFromFPDFDocument(document), formInfo); #ifdef PDF_ENABLE_XFA - pDocument->SetFormFillEnv(pFormFillEnv.get()); + pContext->SetFormFillEnv(pFormFillEnv.get()); #endif // PDF_ENABLE_XFA return pFormFillEnv.release(); // Caller takes ownership. |