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

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

Issue 1830323006: Remove FX_DWORD from XFA. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
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/include/fx_ext.h" 7 #include "core/fxcrt/include/fx_ext.h"
8 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 8 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
9 #include "xfa/fxfa/parser/xfa_basic_imp.h" 9 #include "xfa/fxfa/parser/xfa_basic_imp.h"
10 #include "xfa/fxfa/parser/xfa_docdata.h" 10 #include "xfa/fxfa/parser/xfa_docdata.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 m_pRootNode = pNewRoot; 88 m_pRootNode = pNewRoot;
89 RemovePurgeNode(pNewRoot); 89 RemovePurgeNode(pNewRoot);
90 } 90 }
91 IXFA_Notify* CXFA_Document::GetNotify() const { 91 IXFA_Notify* CXFA_Document::GetNotify() const {
92 return m_pParser->GetNotify(); 92 return m_pParser->GetNotify();
93 } 93 }
94 CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { 94 CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) {
95 return GetXFAObject( 95 return GetXFAObject(
96 FX_HashCode_String_GetW(wsNodeName.GetPtr(), wsNodeName.GetLength())); 96 FX_HashCode_String_GetW(wsNodeName.GetPtr(), wsNodeName.GetLength()));
97 } 97 }
98 CXFA_Object* CXFA_Document::GetXFAObject(FX_DWORD dwNodeNameHash) { 98 CXFA_Object* CXFA_Document::GetXFAObject(uint32_t dwNodeNameHash) {
99 switch (dwNodeNameHash) { 99 switch (dwNodeNameHash) {
100 case XFA_HASHCODE_Data: { 100 case XFA_HASHCODE_Data: {
101 CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); 101 CXFA_Node* pDatasetsNode = ToNode(GetXFAObject(XFA_HASHCODE_Datasets));
102 if (!pDatasetsNode) { 102 if (!pDatasetsNode) {
103 return NULL; 103 return NULL;
104 } 104 }
105 for (CXFA_Node* pDatasetsChild = 105 for (CXFA_Node* pDatasetsChild =
106 pDatasetsNode->GetFirstChildByClass(XFA_ELEMENT_DataGroup); 106 pDatasetsNode->GetFirstChildByClass(XFA_ELEMENT_DataGroup);
107 pDatasetsChild; 107 pDatasetsChild;
108 pDatasetsChild = 108 pDatasetsChild =
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 case XFA_HASHCODE_Layout: { 161 case XFA_HASHCODE_Layout: {
162 if (m_pScriptLayout == NULL) { 162 if (m_pScriptLayout == NULL) {
163 m_pScriptLayout = new CScript_LayoutPseudoModel(this); 163 m_pScriptLayout = new CScript_LayoutPseudoModel(this);
164 } 164 }
165 return m_pScriptLayout; 165 return m_pScriptLayout;
166 } 166 }
167 default: 167 default:
168 return m_pRootNode->GetFirstChildByName(dwNodeNameHash); 168 return m_pRootNode->GetFirstChildByName(dwNodeNameHash);
169 } 169 }
170 } 170 }
171 CXFA_Node* CXFA_Document::CreateNode(FX_DWORD dwPacket, XFA_ELEMENT eElement) { 171 CXFA_Node* CXFA_Document::CreateNode(uint32_t dwPacket, XFA_ELEMENT eElement) {
172 return CreateNode(XFA_GetPacketByID(dwPacket), eElement); 172 return CreateNode(XFA_GetPacketByID(dwPacket), eElement);
173 } 173 }
174 CXFA_Node* CXFA_Document::CreateNode(const XFA_PACKETINFO* pPacket, 174 CXFA_Node* CXFA_Document::CreateNode(const XFA_PACKETINFO* pPacket,
175 XFA_ELEMENT eElement) { 175 XFA_ELEMENT eElement) {
176 if (pPacket == NULL) { 176 if (pPacket == NULL) {
177 return NULL; 177 return NULL;
178 } 178 }
179 const XFA_ELEMENTINFO* pElement = XFA_GetElementByID(eElement); 179 const XFA_ELEMENTINFO* pElement = XFA_GetElementByID(eElement);
180 if (pElement && (pElement->dwPackets & pPacket->eName)) { 180 if (pElement && (pElement->dwPackets & pPacket->eName)) {
181 CXFA_Node* pNode = new CXFA_Node(this, pPacket->eName, pElement->eName); 181 CXFA_Node* pNode = new CXFA_Node(this, pPacket->eName, pElement->eName);
(...skipping 12 matching lines...) Expand all
194 } 194 }
195 void CXFA_Document::PurgeNodes() { 195 void CXFA_Document::PurgeNodes() {
196 FX_POSITION psNode = m_rgPurgeNodes.GetStartPosition(); 196 FX_POSITION psNode = m_rgPurgeNodes.GetStartPosition();
197 while (psNode) { 197 while (psNode) {
198 CXFA_Node* pNode; 198 CXFA_Node* pNode;
199 m_rgPurgeNodes.GetNextAssoc(psNode, pNode); 199 m_rgPurgeNodes.GetNextAssoc(psNode, pNode);
200 delete pNode; 200 delete pNode;
201 } 201 }
202 m_rgPurgeNodes.RemoveAll(); 202 m_rgPurgeNodes.RemoveAll();
203 } 203 }
204 void CXFA_Document::SetFlag(FX_DWORD dwFlag, FX_BOOL bOn) { 204 void CXFA_Document::SetFlag(uint32_t dwFlag, FX_BOOL bOn) {
205 if (bOn) { 205 if (bOn) {
206 m_dwDocFlags |= dwFlag; 206 m_dwDocFlags |= dwFlag;
207 } else { 207 } else {
208 m_dwDocFlags &= ~dwFlag; 208 m_dwDocFlags &= ~dwFlag;
209 } 209 }
210 } 210 }
211 FX_BOOL CXFA_Document::IsInteractive() { 211 FX_BOOL CXFA_Document::IsInteractive() {
212 if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive) { 212 if (m_dwDocFlags & XFA_DOCFLAG_HasInteractive) {
213 return m_dwDocFlags & XFA_DOCFLAG_Interactive; 213 return m_dwDocFlags & XFA_DOCFLAG_Interactive;
214 } 214 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 pNode = sIterator.MoveToNext()) { 352 pNode = sIterator.MoveToNext()) {
353 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE); 353 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
354 } 354 }
355 } 355 }
356 } 356 }
357 void CXFA_Document::DoProtoMerge() { 357 void CXFA_Document::DoProtoMerge() {
358 CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template)); 358 CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template));
359 if (!pTemplateRoot) { 359 if (!pTemplateRoot) {
360 return; 360 return;
361 } 361 }
362 CFX_MapPtrTemplate<FX_DWORD, CXFA_Node*> mIDMap; 362 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> mIDMap;
363 CXFA_NodeSet sUseNodes; 363 CXFA_NodeSet sUseNodes;
364 CXFA_NodeIterator sIterator(pTemplateRoot); 364 CXFA_NodeIterator sIterator(pTemplateRoot);
365 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 365 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
366 pNode = sIterator.MoveToNext()) { 366 pNode = sIterator.MoveToNext()) {
367 CFX_WideStringC wsIDVal; 367 CFX_WideStringC wsIDVal;
368 if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { 368 if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) {
369 mIDMap[FX_HashCode_String_GetW(wsIDVal.GetPtr(), wsIDVal.GetLength())] = 369 mIDMap[FX_HashCode_String_GetW(wsIDVal.GetPtr(), wsIDVal.GetLength())] =
370 pNode; 370 pNode;
371 } 371 }
372 CFX_WideStringC wsUseVal; 372 CFX_WideStringC wsUseVal;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } else { 410 } else {
411 wsSOM = 411 wsSOM =
412 CFX_WideStringC((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); 412 CFX_WideStringC((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength());
413 } 413 }
414 } 414 }
415 if (!wsURI.IsEmpty() && wsURI != FX_WSTRC(L".")) { 415 if (!wsURI.IsEmpty() && wsURI != FX_WSTRC(L".")) {
416 continue; 416 continue;
417 } 417 }
418 CXFA_Node* pProtoNode = NULL; 418 CXFA_Node* pProtoNode = NULL;
419 if (!wsSOM.IsEmpty()) { 419 if (!wsSOM.IsEmpty()) {
420 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 420 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
421 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 421 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
422 XFA_RESOLVENODE_Siblings; 422 XFA_RESOLVENODE_Siblings;
423 XFA_RESOLVENODE_RS resoveNodeRS; 423 XFA_RESOLVENODE_RS resoveNodeRS;
424 int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM, 424 int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM,
425 resoveNodeRS, dwFlag); 425 resoveNodeRS, dwFlag);
426 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { 426 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
427 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); 427 pProtoNode = resoveNodeRS.nodes[0]->AsNode();
428 } 428 }
429 } else if (!wsID.IsEmpty()) { 429 } else if (!wsID.IsEmpty()) {
430 if (!mIDMap.Lookup( 430 if (!mIDMap.Lookup(
431 FX_HashCode_String_GetW(wsID.GetPtr(), wsID.GetLength()), 431 FX_HashCode_String_GetW(wsID.GetPtr(), wsID.GetLength()),
432 pProtoNode)) { 432 pProtoNode)) {
433 continue; 433 continue;
434 } 434 }
435 } 435 }
436 if (!pProtoNode) { 436 if (!pProtoNode) {
437 continue; 437 continue;
438 } 438 }
439 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode); 439 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode);
440 } 440 }
441 } 441 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_document_datamerger_imp.cpp ('k') | xfa/fxfa/parser/xfa_document_serialize.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698