| OLD | NEW |
| 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/include/fx_ext.h" | 7 #include "core/fxcrt/include/fx_ext.h" |
| 8 #include "xfa/fxfa/app/xfa_ffnotify.h" | 8 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| 10 #include "xfa/fxfa/parser/xfa_basic_imp.h" | 10 #include "xfa/fxfa/parser/xfa_basic_imp.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 AddPurgeNode(m_pRootNode); | 89 AddPurgeNode(m_pRootNode); |
| 90 } | 90 } |
| 91 m_pRootNode = pNewRoot; | 91 m_pRootNode = pNewRoot; |
| 92 RemovePurgeNode(pNewRoot); | 92 RemovePurgeNode(pNewRoot); |
| 93 } | 93 } |
| 94 CXFA_FFNotify* CXFA_Document::GetNotify() const { | 94 CXFA_FFNotify* CXFA_Document::GetNotify() const { |
| 95 return m_pParser->GetNotify(); | 95 return m_pParser->GetNotify(); |
| 96 } | 96 } |
| 97 CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { | 97 CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { |
| 98 return GetXFAObject( | 98 return GetXFAObject( |
| 99 FX_HashCode_String_GetW(wsNodeName.GetPtr(), wsNodeName.GetLength())); | 99 FX_HashCode_String_GetW(wsNodeName.raw_str(), wsNodeName.GetLength())); |
| 100 } | 100 } |
| 101 CXFA_Object* CXFA_Document::GetXFAObject(uint32_t dwNodeNameHash) { | 101 CXFA_Object* CXFA_Document::GetXFAObject(uint32_t dwNodeNameHash) { |
| 102 switch (dwNodeNameHash) { | 102 switch (dwNodeNameHash) { |
| 103 case XFA_HASHCODE_Data: { | 103 case XFA_HASHCODE_Data: { |
| 104 CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); | 104 CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); |
| 105 if (!pDatasetsNode) { | 105 if (!pDatasetsNode) { |
| 106 return NULL; | 106 return NULL; |
| 107 } | 107 } |
| 108 for (CXFA_Node* pDatasetsChild = | 108 for (CXFA_Node* pDatasetsChild = |
| 109 pDatasetsNode->GetFirstChildByClass(XFA_ELEMENT_DataGroup); | 109 pDatasetsNode->GetFirstChildByClass(XFA_ELEMENT_DataGroup); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 if (!pTemplateRoot) { | 360 if (!pTemplateRoot) { |
| 361 return; | 361 return; |
| 362 } | 362 } |
| 363 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> mIDMap; | 363 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> mIDMap; |
| 364 CXFA_NodeSet sUseNodes; | 364 CXFA_NodeSet sUseNodes; |
| 365 CXFA_NodeIterator sIterator(pTemplateRoot); | 365 CXFA_NodeIterator sIterator(pTemplateRoot); |
| 366 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 366 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; |
| 367 pNode = sIterator.MoveToNext()) { | 367 pNode = sIterator.MoveToNext()) { |
| 368 CFX_WideStringC wsIDVal; | 368 CFX_WideStringC wsIDVal; |
| 369 if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { | 369 if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { |
| 370 mIDMap[FX_HashCode_String_GetW(wsIDVal.GetPtr(), wsIDVal.GetLength())] = | 370 mIDMap[FX_HashCode_String_GetW(wsIDVal.raw_str(), wsIDVal.GetLength())] = |
| 371 pNode; | 371 pNode; |
| 372 } | 372 } |
| 373 CFX_WideStringC wsUseVal; | 373 CFX_WideStringC wsUseVal; |
| 374 if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { | 374 if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { |
| 375 sUseNodes.Add(pNode); | 375 sUseNodes.Add(pNode); |
| 376 } else if (pNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && | 376 } else if (pNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && |
| 377 !wsUseVal.IsEmpty()) { | 377 !wsUseVal.IsEmpty()) { |
| 378 sUseNodes.Add(pNode); | 378 sUseNodes.Add(pNode); |
| 379 } | 379 } |
| 380 } | 380 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 422 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
| 423 XFA_RESOLVENODE_Siblings; | 423 XFA_RESOLVENODE_Siblings; |
| 424 XFA_RESOLVENODE_RS resoveNodeRS; | 424 XFA_RESOLVENODE_RS resoveNodeRS; |
| 425 int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM, | 425 int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM, |
| 426 resoveNodeRS, dwFlag); | 426 resoveNodeRS, dwFlag); |
| 427 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { | 427 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { |
| 428 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); | 428 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); |
| 429 } | 429 } |
| 430 } else if (!wsID.IsEmpty()) { | 430 } else if (!wsID.IsEmpty()) { |
| 431 if (!mIDMap.Lookup( | 431 if (!mIDMap.Lookup( |
| 432 FX_HashCode_String_GetW(wsID.GetPtr(), wsID.GetLength()), | 432 FX_HashCode_String_GetW(wsID.raw_str(), wsID.GetLength()), |
| 433 pProtoNode)) { | 433 pProtoNode)) { |
| 434 continue; | 434 continue; |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 if (!pProtoNode) { | 437 if (!pProtoNode) { |
| 438 continue; | 438 continue; |
| 439 } | 439 } |
| 440 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode); | 440 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode); |
| 441 } | 441 } |
| 442 } | 442 } |
| OLD | NEW |