diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-10-18 12:28:14 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-18 16:41:35 +0000 |
commit | 854d71c1420eb80ec79755a6cdf829f3f39aead7 (patch) | |
tree | ba5f94431c46bcf8fa5b8e873304f14c8c69088c /fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | |
parent | 7c2daec0a5f5d5e0f442db7946e9356daa7c55b2 (diff) | |
download | pdfium-854d71c1420eb80ec79755a6cdf829f3f39aead7.tar.xz |
Refactor HasXFAField into HasFormInfo
The existing API is too restrictive for collection the metrics
information that we want. Specifically it only tells us if there are
XFA forms in the document, but not AcroForms. This refactoring makes
the method more general, so that non-XFA information is provided
also. This change in semantics of the return value required some
changes at the call sites of the API.
BUG=chromium:775519
Change-Id: Id421c66c09b47196c252c64cdc2c711ca1911de0
Reviewed-on: https://pdfium-review.googlesource.com/16210
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_context.cpp')
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index 692306aebf..95f1efcfca 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -36,7 +36,7 @@ extern int GetLastError(); #endif CPDFXFA_Context::CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc) - : m_iDocType(XFA_DocType::kNone), + : m_FormType(FormType::kNone), m_pPDFDoc(std::move(pPDFDoc)), m_pFormFillEnv(nullptr), m_pXFADocView(nullptr), @@ -117,10 +117,10 @@ bool CPDFXFA_Context::LoadXFADoc() { m_pXFADoc->StopLoad(); m_pXFADoc->GetXFADoc()->InitScriptContext(GetJSERuntime()); - if (m_pXFADoc->GetDocType() == XFA_DocType::kFull) - m_iDocType = XFA_DocType::kFull; + if (m_pXFADoc->GetFormType() == FormType::kXFAFull) + m_FormType = FormType::kXFAFull; else - m_iDocType = XFA_DocType::kForegroundOnly; + m_FormType = FormType::kXFAForeground; m_pXFADocView = m_pXFADoc->CreateDocView(); if (m_pXFADocView->StartLayout() < 0) { @@ -140,17 +140,17 @@ int CPDFXFA_Context::GetPageCount() const { if (!m_pPDFDoc && !m_pXFADoc) return 0; - switch (m_iDocType) { - case XFA_DocType::kNone: - case XFA_DocType::kForegroundOnly: + switch (m_FormType) { + case FormType::kNone: + case FormType::kAcroForm: + case FormType::kXFAForeground: if (m_pPDFDoc) return m_pPDFDoc->GetPageCount(); - case XFA_DocType::kFull: + case FormType::kXFAFull: if (m_pXFADoc) return m_pXFADocView->CountPageViews(); - default: - return 0; } + return 0; } RetainPtr<CPDFXFA_Page> CPDFXFA_Context::GetXFAPage(int page_index) { @@ -183,7 +183,7 @@ RetainPtr<CPDFXFA_Page> CPDFXFA_Context::GetXFAPage( if (!m_pXFADoc) return nullptr; - if (m_iDocType != XFA_DocType::kFull) + if (m_FormType != FormType::kXFAFull) return nullptr; for (auto& pTempPage : m_XFAPageList) { |