From c40c5aa2d7f1753dd382c35955deafdaca660020 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Nov 2017 21:29:11 +0000 Subject: A CXFA_Node can only be in one packet When a CXFA_Node is created it's created as part of a specific packet. Previously the code would accept an XFA_XDPPACKET which was stored internally. This had the potential to allow a node to exist in multiple packets. This CL changes the XFA_XDPPacket to the XFA_PacketType enum class and cleans up a lot of uses to use the more specific packet type. Change-Id: I7fc8c843bfa6bd32295ae58a26bcec311e43c4b0 Reviewed-on: https://pdfium-review.googlesource.com/20012 Reviewed-by: Henrique Nakashima Reviewed-by: Lei Zhang Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_layoutpagemgr.cpp') diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index e0678c498f..70d5f46856 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -310,7 +310,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { CXFA_Document* pDocument = pTemplateNode->GetDocument(); pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_Element::PageArea, false); if (!pPageArea) { - pPageArea = pDocument->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), + pPageArea = pDocument->CreateNode(m_pTemplatePageSetRoot->GetPacketType(), XFA_Element::PageArea); if (!pPageArea) return false; @@ -321,7 +321,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_Element::ContentArea, false); if (!pContentArea) { - pContentArea = pDocument->CreateNode(pPageArea->GetPacketID(), + pContentArea = pDocument->CreateNode(pPageArea->GetPacketType(), XFA_Element::ContentArea); if (!pContentArea) return false; @@ -340,7 +340,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium, false); if (!pMedium) { pMedium = - pDocument->CreateNode(pPageArea->GetPacketID(), XFA_Element::Medium); + pDocument->CreateNode(pPageArea->GetPacketType(), XFA_Element::Medium); if (!pContentArea) return false; @@ -1721,8 +1721,8 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { iIndex++; } if (!pPendingPageSet) { - if (pRootPageSetContainerItem->m_pFormNode->GetPacketID() == - XFA_XDPPACKET_Template) { + if (pRootPageSetContainerItem->m_pFormNode->GetPacketType() == + XFA_PacketType::Template) { pPendingPageSet = pRootPageSetContainerItem->m_pFormNode->CloneTemplateToForm(false); } else { @@ -1738,7 +1738,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); pContainerItem; pContainerItem = iterator.MoveToNext()) { CXFA_Node* pNode = pContainerItem->m_pFormNode; - if (pNode->GetPacketID() != XFA_XDPPACKET_Template) + if (pNode->GetPacketType() != XFA_PacketType::Template) continue; switch (pNode->GetElementType()) { @@ -1980,7 +1980,7 @@ void CXFA_LayoutPageMgr::PrepareLayout() { CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; if (pRootLayoutItem && - pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { + pRootLayoutItem->m_pFormNode->GetPacketType() == XFA_PacketType::Form) { CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.clear(); if (pPageSetFormNode->HasRemovedChildren()) { -- cgit v1.2.3