diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-05-25 22:58:39 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-25 22:58:39 +0000 |
commit | df93cd35530e7b8dd67abde8d199c36c3fae76be (patch) | |
tree | cc760bdcc560f0ad448db5a2d01de01d6ba8d1c7 /fpdfsdk | |
parent | 2aa4b2f3928ccd8393f60db8f7b740c75f4e8a8d (diff) | |
download | pdfium-df93cd35530e7b8dd67abde8d199c36c3fae76be.tar.xz |
Replace some #ifdef PDF_ENABLE_XFA with runtime checks.
Abstract GetUserPermissions() differences via new virtual method.
Abstract GetPageCount() differences via existing virtual method.
Remove unused ReadHeader() form for non-xfa.
Remove unused FindSubstFontByUnicode() for xfa.
Remove unused FXFONT_EXACTMATCH
Change-Id: I0a3de01a9841db86fcbc96991d3fa2682393b9ad
Reviewed-on: https://pdfium-review.googlesource.com/32831
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cpdfsdk_formfillenvironment.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.h | 1 |
3 files changed, 8 insertions, 5 deletions
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index 49a4a601d5..a0859a225a 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -719,11 +719,8 @@ CPDFXFA_Context* CPDFSDK_FormFillEnvironment::GetXFAContext() const { #endif // PDF_ENABLE_XFA int CPDFSDK_FormFillEnvironment::GetPageCount() const { -#ifdef PDF_ENABLE_XFA - return GetXFAContext()->GetPageCount(); -#else - return m_pCPDFDoc->GetPageCount(); -#endif + CPDF_Document::Extension* pExtension = m_pCPDFDoc->GetExtension(); + return pExtension ? pExtension->GetPageCount() : m_pCPDFDoc->GetPageCount(); } bool CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) const { diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index 84fcb37d16..3b10f0d51e 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -203,6 +203,11 @@ void CPDFXFA_Context::DeletePage(int page_index) { m_XFAPageList[page_index].Reset(); } +uint32_t CPDFXFA_Context::GetUserPermissions() const { + // See https://bugs.chromium.org/p/pdfium/issues/detail?id=499 + return 0xFFFFFFFF; +} + void CPDFXFA_Context::ClearChangeMark() { if (m_pFormFillEnv) m_pFormFillEnv->ClearChangeMark(); diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h index c7fe02d8fb..a01990cce4 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h @@ -62,6 +62,7 @@ class CPDFXFA_Context : public CPDF_Document::Extension, CPDF_Document* GetPDFDoc() const override; int GetPageCount() const override; void DeletePage(int page_index) override; + uint32_t GetUserPermissions() const override; // IFXA_AppProvider: WideString GetLanguage() override; |