diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-12 19:21:46 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-12 19:21:46 +0000 |
commit | a3843c99e7a631b2fbf87bbc12834e61bfb7b6f2 (patch) | |
tree | 4bc4f0c8c75b40a8a7cfe1246a36b69a1ac9900c /fpdfsdk/fpdf_view.cpp | |
parent | 82c730bf83c7582d360fc4080c7729115b0a9550 (diff) | |
download | pdfium-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/fpdf_view.cpp')
-rw-r--r-- | fpdfsdk/fpdf_view.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index cbbfd9c71d..4f10bcb20a 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -67,7 +67,7 @@ static_assert(WindowsPrintMode::kModePostScript2PassThrough == static_assert(WindowsPrintMode::kModePostScript3PassThrough == FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH, "WindowsPrintMode::kModePostScript3PassThrough value mismatch"); -#endif +#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ namespace { @@ -151,12 +151,12 @@ FPDF_DOCUMENT LoadDocumentImpl( ProcessParseError(error); return nullptr; } - CheckUnSupportError(pDocument.get(), error); #ifdef PDF_ENABLE_XFA pDocument->SetExtension(pdfium::MakeUnique<CPDFXFA_Context>(pDocument.get())); #endif // PDF_ENABLE_XFA + CheckUnSupportError(pDocument.get(), error); return FPDFDocumentFromCPDFDocument(pDocument.release()); } @@ -716,7 +716,7 @@ FPDF_EXPORT FPDF_RECORDER FPDF_CALLCONV FPDF_RenderPageSkp(FPDF_PAGE page, pPage->SetRenderContext(nullptr); return recorder; } -#endif +#endif // _SKIA_SUPPORT_ FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page) { if (!page) @@ -726,7 +726,9 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page) { RetainPtr<IPDF_Page> pPage; pPage.Unleak(IPDFPageFromFPDFPage(page)); -#ifndef PDF_ENABLE_XFA + if (pPage->AsXFAPage()) + return; + CPDFSDK_PageView* pPageView = static_cast<CPDFSDK_PageView*>(pPage->AsPDFPage()->GetView()); if (!pPageView || pPageView->IsBeingDestroyed()) @@ -741,7 +743,6 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page) { // first because it will attempt to reset the View on the |pPage| during // destruction. pPageView->GetFormFillEnv()->RemovePageView(pPage.Get()); -#endif // PDF_ENABLE_XFA } FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document) { |