diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-30 21:29:11 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-30 21:29:11 +0000 |
commit | c40c5aa2d7f1753dd382c35955deafdaca660020 (patch) | |
tree | b427f5516046d40b8dd63f8c7a552fac0bf278ae /xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | |
parent | 9daec60824d085db8c2f841fd389c725df1f8b0b (diff) | |
download | pdfium-c40c5aa2d7f1753dd382c35955deafdaca660020.tar.xz |
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 <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_layoutpagemgr.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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()) { |