summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_pageview.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-12 19:21:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-12 19:21:46 +0000
commita3843c99e7a631b2fbf87bbc12834e61bfb7b6f2 (patch)
tree4bc4f0c8c75b40a8a7cfe1246a36b69a1ac9900c /fpdfsdk/cpdfsdk_pageview.cpp
parent82c730bf83c7582d360fc4080c7729115b0a9550 (diff)
downloadpdfium-a3843c99e7a631b2fbf87bbc12834e61bfb7b6f2.tar.xz
Remove some #ifdef XFA in favor of runtime checks.chromium/3457
Make LoadDocumentImpl() logic match FPDFAvail_GetDocument() logic, so that the XFA extension is loaded before checking unsupported features. Add some comments along the way. Change-Id: I040e40fcca872f7c0a46e921bce1146f0fe42588 Reviewed-on: https://pdfium-review.googlesource.com/34931 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index d2736b1d42..def911d4ae 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -33,24 +33,25 @@
CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_FormFillEnvironment* pFormFillEnv,
IPDF_Page* page)
: m_page(page), m_pFormFillEnv(pFormFillEnv) {
+ ASSERT(m_page);
CPDF_Page* pPDFPage = ToPDFPage(page);
if (pPDFPage) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
pPDFInterForm->FixPageFields(pPDFPage);
-#ifndef PDF_ENABLE_XFA
- pPDFPage->SetView(this);
-#endif // PDF_ENABLE_XFA
+ if (!page->AsXFAPage())
+ pPDFPage->SetView(this);
}
}
CPDFSDK_PageView::~CPDFSDK_PageView() {
-#ifndef PDF_ENABLE_XFA
- // The call to |ReleaseAnnot| can cause the page pointed to by |m_page| to
- // be freed, which will cause issues if we try to cleanup the pageview pointer
- // in |m_page|. So, reset the pageview pointer before doing anything else.
- m_page->AsPDFPage()->SetView(nullptr);
-#endif // PDF_ENABLE_XFA
+ if (!m_page->AsXFAPage()) {
+ // The call to |ReleaseAnnot| can cause the page pointed to by |m_page| to
+ // be freed, which will cause issues if we try to cleanup the pageview
+ // pointer in |m_page|. So, reset the pageview pointer before doing anything
+ // else.
+ m_page->AsPDFPage()->SetView(nullptr);
+ }
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
m_pFormFillEnv->GetAnnotHandlerMgr();