summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-31 16:27:11 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-31 16:27:11 +0000
commitd8126c2e72a60403c73f4187d4041364d45a8d61 (patch)
tree50ce00d2a04d050b13cdf502ef568561f54a7792
parent75ccb54de5785e37e41ba8b560db0ff1dd7d5775 (diff)
downloadpdfium-d8126c2e72a60403c73f4187d4041364d45a8d61.tar.xz
Make pagview decisions at runtime for non-xfa pages.
Change-Id: I4c51bed2d285060f28311a0c5e1be9a7e19d408d Reviewed-on: https://pdfium-review.googlesource.com/33153 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--fpdfsdk/cpdfsdk_pageview.h5
-rw-r--r--fpdfsdk/fpdf_view.cpp11
2 files changed, 6 insertions, 10 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index cf2d9bf442..1df29b9ec4 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -92,10 +92,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
void SetBeingDestroyed() { m_bBeingDestroyed = true; }
bool IsBeingDestroyed() const { return m_bBeingDestroyed; }
-
-#ifndef PDF_ENABLE_XFA
void TakePageOwnership() { m_pOwnsPage.Reset(ToPDFPage(m_page)); }
-#endif // PDF_ENABLE_XFA
private:
CPDFSDK_Annot* GetFXAnnotAtPoint(const CFX_PointF& point);
@@ -116,9 +113,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
std::vector<CPDFSDK_Annot*> m_SDKAnnotArray;
UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
CPDFSDK_Annot::ObservedPtr m_pCaptureWidget;
-#ifndef PDF_ENABLE_XFA
RetainPtr<CPDF_Page> m_pOwnsPage;
-#endif // PDF_ENABLE_XFA
bool m_bOnWidget = false;
bool m_bValid = false;
bool m_bLocked = false;
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 806b9d2b98..5304e330b7 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -728,7 +728,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())
@@ -743,19 +745,18 @@ 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) {
auto* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc)
+ return;
-#if PDF_ENABLE_XFA
// Deleting the extension will delete the document
- if (pDoc && pDoc->GetExtension()) {
+ if (pDoc->GetExtension()) {
delete pDoc->GetExtension();
return;
}
-#endif // PDF_ENABLE_XFA
delete pDoc;
}