summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffdoc.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-04-09 19:08:25 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-09 19:08:25 +0000
commit741d5e1e0a64b85717ad054d3fd8807c66845a50 (patch)
tree2da5593f7837c6e971609f4b88c268356fdafb12 /xfa/fxfa/cxfa_ffdoc.cpp
parent53894390dba2ec571bab75157ebe60d11171ed07 (diff)
downloadpdfium-741d5e1e0a64b85717ad054d3fd8807c66845a50.tar.xz
Merge CXFA_FFDoc::{Start|Do|Stop}Load methods
The StartLoad, DoLoad and StopLoad methods are called in sequence from the CPDFXFA_Context. This CL merges the three methods into a single Load method. Change-Id: I7135502354fb4c64784c89fa39b74fc58c76b683 Reviewed-on: https://pdfium-review.googlesource.com/29990 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.cpp79
1 files changed, 39 insertions, 40 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 52ad5f692d..ad7bbd9531 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -165,10 +165,47 @@ CXFA_FFDoc::~CXFA_FFDoc() {
CloseDoc();
}
-int32_t CXFA_FFDoc::StartLoad() {
+int32_t CXFA_FFDoc::Load() {
m_pNotify = pdfium::MakeUnique<CXFA_FFNotify>(this);
m_pDocumentParser = pdfium::MakeUnique<CXFA_DocumentParser>(m_pNotify.get());
- return m_pDocumentParser->StartParse(m_pStream, XFA_PacketType::Xdp);
+ m_pDocumentParser->StartParse(m_pStream, XFA_PacketType::Xdp);
+
+ int32_t iStatus = m_pDocumentParser->DoParse();
+ if (iStatus != XFA_PARSESTATUS_Done)
+ return iStatus;
+ if (!m_pPDFDoc)
+ return XFA_PARSESTATUS_SyntaxErr;
+
+ m_pPDFFontMgr = pdfium::MakeUnique<CFGAS_PDFFontMgr>(
+ GetPDFDoc(), GetApp()->GetFDEFontMgr());
+
+ m_FormType = FormType::kXFAForeground;
+ CXFA_Node* pConfig = ToNode(
+ m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
+ if (!pConfig)
+ return iStatus;
+
+ CXFA_Acrobat* pAcrobat =
+ pConfig->GetFirstChildByClass<CXFA_Acrobat>(XFA_Element::Acrobat);
+ if (!pAcrobat)
+ return iStatus;
+
+ CXFA_Acrobat7* pAcrobat7 =
+ pAcrobat->GetFirstChildByClass<CXFA_Acrobat7>(XFA_Element::Acrobat7);
+ if (!pAcrobat7)
+ return iStatus;
+
+ CXFA_DynamicRender* pDynamicRender =
+ pAcrobat7->GetFirstChildByClass<CXFA_DynamicRender>(
+ XFA_Element::DynamicRender);
+ if (!pDynamicRender)
+ return iStatus;
+
+ WideString wsType = pDynamicRender->JSObject()->GetContent(false);
+ if (wsType == L"required")
+ m_FormType = FormType::kXFAFull;
+
+ return iStatus;
}
bool XFA_GetPDFContentsFromPDFXML(CFX_XMLNode* pPDFElement,
@@ -229,44 +266,6 @@ void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) {
}
}
-int32_t CXFA_FFDoc::DoLoad() {
- int32_t iStatus = m_pDocumentParser->DoParse();
- if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc)
- return XFA_PARSESTATUS_SyntaxErr;
- return iStatus;
-}
-
-void CXFA_FFDoc::StopLoad() {
- m_pPDFFontMgr = pdfium::MakeUnique<CFGAS_PDFFontMgr>(
- GetPDFDoc(), GetApp()->GetFDEFontMgr());
-
- m_FormType = FormType::kXFAForeground;
- CXFA_Node* pConfig = ToNode(
- m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
- if (!pConfig)
- return;
-
- CXFA_Acrobat* pAcrobat =
- pConfig->GetFirstChildByClass<CXFA_Acrobat>(XFA_Element::Acrobat);
- if (!pAcrobat)
- return;
-
- CXFA_Acrobat7* pAcrobat7 =
- pAcrobat->GetFirstChildByClass<CXFA_Acrobat7>(XFA_Element::Acrobat7);
- if (!pAcrobat7)
- return;
-
- CXFA_DynamicRender* pDynamicRender =
- pAcrobat7->GetFirstChildByClass<CXFA_DynamicRender>(
- XFA_Element::DynamicRender);
- if (!pDynamicRender)
- return;
-
- WideString wsType = pDynamicRender->JSObject()->GetContent(false);
- if (wsType == L"required")
- m_FormType = FormType::kXFAFull;
-}
-
CXFA_FFDocView* CXFA_FFDoc::CreateDocView() {
if (!m_DocView)
m_DocView = pdfium::MakeUnique<CXFA_FFDocView>(this);