diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-02-15 18:12:29 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-15 18:12:29 +0000 |
commit | e40678ed8a22ecd57421877af39cf7f281f618c4 (patch) | |
tree | 50bbf114829ad3b4852b3739f65c6385091c4ba0 /fxjs | |
parent | 625e6fec9ddd1d023116f7bd22d2192ef9bc49c8 (diff) | |
download | pdfium-e40678ed8a22ecd57421877af39cf7f281f618c4.tar.xz |
Make the CFX_XMLNode a MaybeOwned pointer
This CL removes the HasOwnXML flag from the CXFA_Node objects and
instead uses a MaybeOwned pointer to keep track of the XML nodes.
Change-Id: Ie678258247ec21ecb15c639647b189e140586d25
Reviewed-on: https://pdfium-review.googlesource.com/26811
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/xfa/cjx_node.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index 9b5d4044ea..1343d258e1 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -7,6 +7,7 @@ #include "fxjs/xfa/cjx_node.h" #include <memory> +#include <utility> #include <vector> #include "core/fxcrt/cfx_memorystream.h" @@ -288,8 +289,8 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, if (GetXFANode()->GetPacketType() == XFA_PacketType::Form && GetXFANode()->GetElementType() == XFA_Element::ExData) { CFX_XMLNode* pTempXMLNode = GetXFANode()->GetXMLMappingNode(); - GetXFANode()->SetXMLMappingNode(pFakeXMLRoot.release()); - GetXFANode()->SetFlag(XFA_NodeFlag_OwnXMLNode); + GetXFANode()->SetXMLMappingNode(std::move(pFakeXMLRoot)); + if (pTempXMLNode && !pTempXMLNode->GetParent()) pFakeXMLRoot.reset(pTempXMLNode); else @@ -308,8 +309,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, } if (pFakeXMLRoot) { - pFakeRoot->SetXMLMappingNode(pFakeXMLRoot.release()); - pFakeRoot->SetFlag(XFA_NodeFlag_OwnXMLNode); + pFakeRoot->SetXMLMappingNode(std::move(pFakeXMLRoot)); } pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren); |