Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp

Issue 2001743002: Use std::set to track uniqueness in xfa_script_layoutpseudomodel.cpp (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
index e48d3d5ffa0d306789b9c46fda0f0a59f13365c9..ffb3a9e58812df39affff3129d8236e1337f44e8 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);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698