diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-05-02 16:02:03 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-02 16:02:03 +0000 |
commit | 70180648ffd01dd3716871758411d2031aaaebbe (patch) | |
tree | 6cc1d7aa3df8c3e343a1ef6f7e032bae8499f6db /xfa/fxfa/cxfa_ffdoc.cpp | |
parent | 8ab2b2b2869f769dc169b4a96bb67ec596d5278b (diff) | |
download | pdfium-70180648ffd01dd3716871758411d2031aaaebbe.tar.xz |
Add a CFX_XMLDocument class.
This CL adds a CFX_XMLDocument to act as the XML node container. All
nodes are now owned by the document and the document is returned by the
CFX_XMLParser.
Classes which parse XML files now store the document instead of the root
node.
BUG: chromium:835636
Change-Id: I1e07d6115cf14714911d6fd4c3fa920c94fd5faf
Reviewed-on: https://pdfium-review.googlesource.com/31313
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.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 3d06c7df27..fb2abe3a72 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -18,6 +18,7 @@ #include "core/fxcrt/cfx_seekablemultistream.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/xml/cfx_xmldocument.h" #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" #include "fxjs/xfa/cjx_object.h" @@ -58,12 +59,11 @@ bool CXFA_FFDoc::ParseDoc(CPDF_Object* pElementXFA) { return false; auto stream = pdfium::MakeRetain<CFX_SeekableMultiStream>(xfaStreams); - CXFA_DocumentParser parser(m_pDocument.get()); if (!parser.Parse(stream, XFA_PacketType::Xdp)) return false; - m_pXMLRoot = parser.GetXMLRoot(); + m_pXMLDoc = parser.GetXMLDoc(); m_pDocument->SetRoot(parser.GetRootNode()); return true; } @@ -146,13 +146,11 @@ void CXFA_FFDoc::CloseDoc() { m_DocView->RunDocClose(); m_DocView.reset(); } - if (m_pDocument) { - m_pDocument->ReleaseXMLNodesIfNeeded(); + if (m_pDocument) m_pDocument->ClearLayoutData(); - } m_pDocument.reset(); - m_pXMLRoot.reset(); + m_pXMLDoc.reset(); m_pNotify.reset(); m_pPDFFontMgr.reset(); m_HashToDibDpiMap.clear(); |