diff options
author | tsepez <tsepez@chromium.org> | 2016-05-20 13:58:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-20 13:58:28 -0700 |
commit | 92b54029289a312d5dbb5e1d7dc4a8e9b8c73db4 (patch) | |
tree | 8a6f6e139afacbdd2e296f5e2b58d36e1f6841ac /xfa/fxfa/parser | |
parent | 192bb33e621f7d29a7c940eba8b8a6050e430bf3 (diff) | |
download | pdfium-92b54029289a312d5dbb5e1d7dc4a8e9b8c73db4.tar.xz |
Use std::set to track uniqueness in xfa_script_layoutpseudomodel.cpp
Review-Url: https://codereview.chromium.org/2001743002
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index e48d3d5ffa..ffb3a9e588 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -6,6 +6,9 @@ #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" +#include <set> + +#include "third_party/base/stl_util.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" #include "xfa/fxfa/parser/xfa_doclayout.h" @@ -232,8 +235,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( } return; } - CFX_MapPtrToPtr formItems; - formItems.InitHashTable(256, TRUE); + std::set<CXFA_Node*> formItems; if (wsType.IsEmpty()) { if (CXFA_Node* pMasterPage = pLayoutPage->m_pFormNode) { retArray.Add(pMasterPage); @@ -258,10 +260,10 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( eElementType != XFA_ELEMENT_Area) { continue; } - if (formItems.GetValueAt(pItemChild->m_pFormNode)) { + if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) continue; - } - formItems.SetAt(pItemChild->m_pFormNode, this); + + formItems.insert(pItemChild->m_pFormNode); retArray.Add(pItemChild->m_pFormNode); } } @@ -282,10 +284,9 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( eElementType != XFA_ELEMENT_Area) { continue; } - if (formItems.GetValueAt(pItemChild->m_pFormNode)) { + if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) continue; - } - formItems.SetAt(pItemChild->m_pFormNode, this); + formItems.insert(pItemChild->m_pFormNode); retArray.Add(pItemChild->m_pFormNode); } } @@ -313,16 +314,13 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( iterator((CXFA_ContentLayoutItem*)pItem->m_pFirstChild); for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); pItemChild; pItemChild = iterator.MoveToNext()) { - if (!pItemChild->IsContentLayoutItem()) { + if (!pItemChild->IsContentLayoutItem()) continue; - } - if (pItemChild->m_pFormNode->GetClassID() != eType) { + if (pItemChild->m_pFormNode->GetClassID() != eType) continue; - } - if (formItems.GetValueAt(pItemChild->m_pFormNode)) { + if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) continue; - } - formItems.SetAt(pItemChild->m_pFormNode, this); + formItems.insert(pItemChild->m_pFormNode); retArray.Add(pItemChild->m_pFormNode); } } @@ -333,16 +331,13 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( iterator((CXFA_ContentLayoutItem*)pItem); for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); pItemChild; pItemChild = iterator.MoveToNext()) { - if (!pItemChild->IsContentLayoutItem()) { + if (!pItemChild->IsContentLayoutItem()) continue; - } - if (pItemChild->m_pFormNode->GetClassID() != eType) { + if (pItemChild->m_pFormNode->GetClassID() != eType) continue; - } - if (formItems.GetValueAt(pItemChild->m_pFormNode)) { + if (pdfium::ContainsValue(formItems, pItemChild->m_pFormNode)) continue; - } - formItems.SetAt(pItemChild->m_pFormNode, this); + formItems.insert(pItemChild->m_pFormNode); retArray.Add(pItemChild->m_pFormNode); } } |