summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_document.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-14 18:40:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-14 18:40:53 +0000
commit83cb4369f97a244fc34633b31b3b75abb993a392 (patch)
tree4a09f4e17e44e159ef530753f16cf1b931946737 /xfa/fxfa/parser/cxfa_document.cpp
parentd1b1127cd452a173ec119587c3a6e137e27df6d7 (diff)
downloadpdfium-83cb4369f97a244fc34633b31b3b75abb993a392.tar.xz
Remove CXFA_Node friend class
This CL removes the CXFA_Document friendship with CXFA_Node and adds a CXFA_Node::Create method to create the node objects. Change-Id: If77f9a631b3aa0720803c869446135b8cc17d3c3 Reviewed-on: https://pdfium-review.googlesource.com/18250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_document.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index c80dec979a..c374b762ba 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -214,15 +214,14 @@ CXFA_Node* CXFA_Document::CreateNode(const XFA_PACKETINFO* pPacket,
return nullptr;
const XFA_ELEMENTINFO* pElement = XFA_GetElementByID(eElement);
- if (pElement && (pElement->dwPackets & pPacket->eName)) {
- CXFA_Node* pNode =
- new CXFA_Node(this, pPacket->eName, pElement->eObjectType,
- pElement->eName, pElement->pName);
- AddPurgeNode(pNode);
- return pNode;
- }
+ if (!pElement || !(pElement->dwPackets & pPacket->eName))
+ return nullptr;
- return nullptr;
+ std::unique_ptr<CXFA_Node> pNode =
+ CXFA_Node::Create(this, pPacket->eName, pElement);
+ // TODO(dsinclair): AddPrugeNode should take ownership of the pointer.
+ AddPurgeNode(pNode.get());
+ return pNode.release();
}
void CXFA_Document::AddPurgeNode(CXFA_Node* pNode) {