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_layoutprocessor.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_layoutprocessor.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutprocessor.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index a41b546aa8..c97a1cea58 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "third_party/base/ptr_util.h" +#include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" @@ -18,9 +19,7 @@ #include "xfa/fxfa/parser/xfa_utils.h" CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) - : m_pDocument(pDocument), - m_nProgressCounter(0), - m_bNeeLayout(true) {} + : m_pDocument(pDocument), m_nProgressCounter(0), m_bNeedLayout(true) {} CXFA_LayoutProcessor::~CXFA_LayoutProcessor() {} @@ -85,8 +84,8 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) { if (eStatus == XFA_ItemLayoutProcessorResult::Done) { m_pLayoutPageMgr->FinishPaginatedPageSets(); m_pLayoutPageMgr->SyncLayoutData(); - m_bNeeLayout = false; - m_rgChangedContainers.RemoveAll(); + m_bNeedLayout = false; + m_rgChangedContainers.clear(); } return 100 * (eStatus == XFA_ItemLayoutProcessorResult::Done ? m_nProgressCounter @@ -95,13 +94,11 @@ int32_t CXFA_LayoutProcessor::DoLayout(IFX_Pause* pPause) { } bool CXFA_LayoutProcessor::IncrementLayout() { - if (m_bNeeLayout) { + if (m_bNeedLayout) { StartLayout(true); return DoLayout(nullptr) == 100; } - - for (int32_t i = 0, c = m_rgChangedContainers.GetSize(); i < c; i++) { - CXFA_Node* pNode = m_rgChangedContainers[i]; + for (CXFA_Node* pNode : m_rgChangedContainers) { CXFA_Node* pParentNode = pNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); if (!pParentNode) @@ -111,7 +108,7 @@ bool CXFA_LayoutProcessor::IncrementLayout() { return false; } } - m_rgChangedContainers.RemoveAll(); + m_rgChangedContainers.clear(); return true; } @@ -129,8 +126,8 @@ CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { } void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) { - if (m_rgChangedContainers.Find(pContainer) < 0) - m_rgChangedContainers.Add(pContainer); + if (!pdfium::ContainsValue(m_rgChangedContainers, pContainer)) + m_rgChangedContainers.push_back(pContainer); } CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetRootLayoutItem() const { @@ -138,5 +135,5 @@ CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetRootLayoutItem() const { } bool CXFA_LayoutProcessor::IsNeedLayout() { - return m_bNeeLayout || m_rgChangedContainers.GetSize() > 0; + return m_bNeedLayout || !m_rgChangedContainers.empty(); } |