diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-03-14 12:13:22 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-14 19:59:49 +0000 |
commit | f8a943908a414836271a1b7d7e4a97635d941b7f (patch) | |
tree | 7f900d57e21c72a67a0347e4f25d0784bdad7c83 /xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | |
parent | 05df075154a832fcb476e1dfcfb865722d0ea898 (diff) | |
download | pdfium-f8a943908a414836271a1b7d7e4a97635d941b7f.tar.xz |
Replace CXFA_{Object,Node}Array with std::vector
These two ought to happen at the same time as they are
intertwined in spots. Remove blatant casts between the
two along the way.
Change-Id: I9ce5d2faadf1e38aba7cade316560d24a66d8669
Reviewed-on: https://pdfium-review.googlesource.com/2933
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_layoutpagemgr.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index c8f4b65a16..7b4cf2651a 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" +#include "third_party/base/stl_util.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" @@ -172,8 +173,8 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent); - if (iCount > 0 && rs.nodes[0]->IsNode()) - return rs.nodes[0]->AsNode(); + if (iCount > 0 && rs.objects.front()->IsNode()) + return rs.objects.front()->AsNode(); } iSplitIndex = iSplitNextIndex; } @@ -1661,22 +1662,19 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_FFNotify* pNotify = pDocument->GetNotify(); CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout(); CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem(); - { - for (int32_t iIndex = 0; iIndex < pDocument->m_pPendingPageSet.GetSize(); - iIndex++) { - CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> - sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex)); - for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; - pNode = sIterator.MoveToNext()) { - if (pNode->IsContainerNode()) { - CXFA_Node* pBindNode = pNode->GetBindData(); - if (pBindNode) { - pBindNode->RemoveBindItem(pNode); - pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); - } + for (CXFA_Node* pPageNode : pDocument->m_pPendingPageSet) { + CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> + sIterator(pPageNode); + for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; + pNode = sIterator.MoveToNext()) { + if (pNode->IsContainerNode()) { + CXFA_Node* pBindNode = pNode->GetBindData(); + if (pBindNode) { + pBindNode->RemoveBindItem(pNode); + pNode->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); } - pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); } + pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); } } @@ -1691,8 +1689,9 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_ContainerLayoutItem* pRootPageSetContainerItem = iterator.GetCurrent(); ASSERT(pRootPageSetContainerItem->m_pFormNode->GetElementType() == XFA_Element::PageSet); - if (iIndex < pDocument->m_pPendingPageSet.GetSize()) { - pPendingPageSet = pDocument->m_pPendingPageSet.GetAt(iIndex); + if (iIndex < + pdfium::CollectionSize<int32_t>(pDocument->m_pPendingPageSet)) { + pPendingPageSet = pDocument->m_pPendingPageSet[iIndex]; iIndex++; } if (!pPendingPageSet) { @@ -1958,7 +1957,7 @@ void CXFA_LayoutPageMgr::PrepareLayout() { if (pRootLayoutItem && pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; - pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); + pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.clear(); if (pPageSetFormNode->HasRemovedChildren()) { XFA_ReleaseLayoutItem(pRootLayoutItem); m_pPageSetLayoutItemRoot = nullptr; @@ -1971,7 +1970,7 @@ void CXFA_LayoutPageMgr::PrepareLayout() { pPageSetFormNode->GetNextSameClassSibling(XFA_Element::PageSet); pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) ->RemoveChild(pPageSetFormNode, false); - pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( + pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.push_back( pPageSetFormNode); pPageSetFormNode = pNextPageSet; } |