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

Side by Side Diff: xfa/fxfa/parser/cxfa_document.cpp

Issue 2612923002: Remove CFX_MapPtrToPtr from xfa/fxfa. (Closed)
Patch Set: endless loop Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_document.h ('k') | xfa/fxfa/parser/cxfa_layoutpagemgr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fxcrt/fx_ext.h" 7 #include "core/fxcrt/fx_ext.h"
8 #include "xfa/fxfa/app/xfa_ffnotify.h" 8 #include "xfa/fxfa/app/xfa_ffnotify.h"
9 #include "xfa/fxfa/parser/cscript_datawindow.h" 9 #include "xfa/fxfa/parser/cscript_datawindow.h"
10 #include "xfa/fxfa/parser/cscript_eventpseudomodel.h" 10 #include "xfa/fxfa/parser/cscript_eventpseudomodel.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 } 345 }
346 return nullptr; 346 return nullptr;
347 } 347 }
348 348
349 void CXFA_Document::DoProtoMerge() { 349 void CXFA_Document::DoProtoMerge() {
350 CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template)); 350 CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template));
351 if (!pTemplateRoot) 351 if (!pTemplateRoot)
352 return; 352 return;
353 353
354 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> mIDMap; 354 std::map<uint32_t, CXFA_Node*> mIDMap;
355 CXFA_NodeSet sUseNodes; 355 CXFA_NodeSet sUseNodes;
356 CXFA_NodeIterator sIterator(pTemplateRoot); 356 CXFA_NodeIterator sIterator(pTemplateRoot);
357 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 357 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
358 pNode = sIterator.MoveToNext()) { 358 pNode = sIterator.MoveToNext()) {
359 CFX_WideStringC wsIDVal; 359 CFX_WideStringC wsIDVal;
360 if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { 360 if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) {
361 mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode; 361 mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode;
362 } 362 }
363 CFX_WideStringC wsUseVal; 363 CFX_WideStringC wsUseVal;
364 if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { 364 if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 continue; 403 continue;
404 404
405 CXFA_Node* pProtoNode = nullptr; 405 CXFA_Node* pProtoNode = nullptr;
406 if (!wsSOM.IsEmpty()) { 406 if (!wsSOM.IsEmpty()) {
407 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 407 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
408 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 408 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
409 XFA_RESOLVENODE_Siblings; 409 XFA_RESOLVENODE_Siblings;
410 XFA_RESOLVENODE_RS resoveNodeRS; 410 XFA_RESOLVENODE_RS resoveNodeRS;
411 int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM, 411 int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM,
412 resoveNodeRS, dwFlag); 412 resoveNodeRS, dwFlag);
413 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { 413 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode())
414 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); 414 pProtoNode = resoveNodeRS.nodes[0]->AsNode();
415 }
416 } else if (!wsID.IsEmpty()) { 415 } else if (!wsID.IsEmpty()) {
417 if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) { 416 auto it = mIDMap.find(FX_HashCode_GetW(wsID, false));
417 if (it == mIDMap.end())
418 continue; 418 continue;
419 } 419 pProtoNode = it->second;
420 } 420 }
421 if (!pProtoNode) 421 if (!pProtoNode)
422 continue; 422 continue;
423 423
424 MergeNode(this, pUseHrefNode, pProtoNode); 424 MergeNode(this, pUseHrefNode, pProtoNode);
425 } 425 }
426 } 426 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_document.h ('k') | xfa/fxfa/parser/cxfa_layoutpagemgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698