summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffdoc.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-04-12 13:21:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-12 13:21:48 +0000
commit2efb11c89ee200473f5675ba3d3a946d5606e813 (patch)
tree52b46b0ef3ee3bc91046b217c65aa13e5dd9a06d /xfa/fxfa/cxfa_ffdoc.cpp
parenta995d6fd9b862dbd37aebb9c323766bb5d11d389 (diff)
downloadpdfium-2efb11c89ee200473f5675ba3d3a946d5606e813.tar.xz
Retrieve the XML tree in the DocumentParser
This CL changes the document parser to store the parsed XML tree. That way we no longer need to store the pointer to the CXFA_SimpleParser in the CXFA_DocumentParser. Change-Id: I9272150e73613411cb1bb59c3cf77c7af6cc799d Reviewed-on: https://pdfium-review.googlesource.com/30211 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffdoc.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 655e58ff7f..4c6ae67de7 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -164,15 +164,16 @@ CXFA_FFDoc::~CXFA_FFDoc() {
CloseDoc();
}
-int32_t CXFA_FFDoc::Load() {
+bool CXFA_FFDoc::Load() {
m_pNotify = pdfium::MakeUnique<CXFA_FFNotify>(this);
m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(m_pNotify.get());
-
- int32_t iStatus = m_pDocumentParser->Parse(m_pStream, XFA_PacketType::Xdp);
- if (iStatus != XFA_PARSESTATUS_Done)
- return iStatus;
+ if (!m_pDocumentParser->Parse(m_pStream, XFA_PacketType::Xdp))
+ return false;
if (!m_pPDFDoc)
- return XFA_PARSESTATUS_SyntaxErr;
+ return false;
+
+ // At this point we've got an XFA document and we want to always return
+ // true to signify the load succeeded.
m_pPDFFontMgr = pdfium::MakeUnique<CFGAS_PDFFontMgr>(
GetPDFDoc(), GetApp()->GetFDEFontMgr());
@@ -181,29 +182,29 @@ int32_t CXFA_FFDoc::Load() {
CXFA_Node* pConfig = ToNode(
m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
if (!pConfig)
- return iStatus;
+ return true;
CXFA_Acrobat* pAcrobat =
pConfig->GetFirstChildByClass<CXFA_Acrobat>(XFA_Element::Acrobat);
if (!pAcrobat)
- return iStatus;
+ return true;
CXFA_Acrobat7* pAcrobat7 =
pAcrobat->GetFirstChildByClass<CXFA_Acrobat7>(XFA_Element::Acrobat7);
if (!pAcrobat7)
- return iStatus;
+ return true;
CXFA_DynamicRender* pDynamicRender =
pAcrobat7->GetFirstChildByClass<CXFA_DynamicRender>(
XFA_Element::DynamicRender);
if (!pDynamicRender)
- return iStatus;
+ return true;
WideString wsType = pDynamicRender->JSObject()->GetContent(false);
if (wsType == L"required")
m_FormType = FormType::kXFAFull;
- return iStatus;
+ return true;
}
bool XFA_GetPDFContentsFromPDFXML(CFX_XMLNode* pPDFElement,