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

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

Issue 2083453003: Split the XFA_OBJECTTYPE enum into two parts. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix == nullptr Created 4 years, 6 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/app/xfa_ffnotify.h" 8 #include "xfa/fxfa/app/xfa_ffnotify.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_doclayout.h" 10 #include "xfa/fxfa/parser/xfa_doclayout.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 static void XFA_ProtoMerge_MergeNodeRecurse(CXFA_Document* pDocument, 285 static void XFA_ProtoMerge_MergeNodeRecurse(CXFA_Document* pDocument,
286 CXFA_Node* pDestNodeParent, 286 CXFA_Node* pDestNodeParent,
287 CXFA_Node* pProtoNode) { 287 CXFA_Node* pProtoNode) {
288 CXFA_Node* pExistingNode = NULL; 288 CXFA_Node* pExistingNode = NULL;
289 for (CXFA_Node* pFormChild = 289 for (CXFA_Node* pFormChild =
290 pDestNodeParent->GetNodeItem(XFA_NODEITEM_FirstChild); 290 pDestNodeParent->GetNodeItem(XFA_NODEITEM_FirstChild);
291 pFormChild; 291 pFormChild;
292 pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 292 pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
293 if (pFormChild->GetClassID() == pProtoNode->GetClassID() && 293 if (pFormChild->GetClassID() == pProtoNode->GetClassID() &&
294 pFormChild->GetNameHash() == pProtoNode->GetNameHash() && 294 pFormChild->GetNameHash() == pProtoNode->GetNameHash() &&
295 pFormChild->HasFlag(XFA_NODEFLAG_UnusedNode)) { 295 pFormChild->IsUnusedNode()) {
296 pFormChild->ClearFlag(XFA_NODEFLAG_UnusedNode); 296 pFormChild->ClearFlag(XFA_NodeFlag_UnusedNode);
297 pExistingNode = pFormChild; 297 pExistingNode = pFormChild;
298 break; 298 break;
299 } 299 }
300 } 300 }
301 if (pExistingNode) { 301 if (pExistingNode) {
302 pExistingNode->SetTemplateNode(pProtoNode); 302 pExistingNode->SetTemplateNode(pProtoNode);
303 for (CXFA_Node* pTemplateChild = 303 for (CXFA_Node* pTemplateChild =
304 pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild); 304 pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild);
305 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( 305 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
306 XFA_NODEITEM_NextSibling)) { 306 XFA_NODEITEM_NextSibling)) {
307 XFA_ProtoMerge_MergeNodeRecurse(pDocument, pExistingNode, pTemplateChild); 307 XFA_ProtoMerge_MergeNodeRecurse(pDocument, pExistingNode, pTemplateChild);
308 } 308 }
309 return; 309 return;
310 } 310 }
311 CXFA_Node* pNewNode = pProtoNode->Clone(TRUE); 311 CXFA_Node* pNewNode = pProtoNode->Clone(TRUE);
312 pNewNode->SetTemplateNode(pProtoNode); 312 pNewNode->SetTemplateNode(pProtoNode);
313 pDestNodeParent->InsertChild(pNewNode, NULL); 313 pDestNodeParent->InsertChild(pNewNode, NULL);
314 } 314 }
315 static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument, 315 static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument,
316 CXFA_Node* pDestNode, 316 CXFA_Node* pDestNode,
317 CXFA_Node* pProtoNode) { 317 CXFA_Node* pProtoNode) {
318 { 318 {
319 CXFA_NodeIterator sIterator(pDestNode); 319 CXFA_NodeIterator sIterator(pDestNode);
320 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 320 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
321 pNode = sIterator.MoveToNext()) { 321 pNode = sIterator.MoveToNext()) {
322 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true); 322 pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
323 } 323 }
324 } 324 }
325 pDestNode->SetTemplateNode(pProtoNode); 325 pDestNode->SetTemplateNode(pProtoNode);
326 for (CXFA_Node* pTemplateChild = 326 for (CXFA_Node* pTemplateChild =
327 pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild); 327 pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild);
328 pTemplateChild; 328 pTemplateChild;
329 pTemplateChild = pTemplateChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 329 pTemplateChild = pTemplateChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
330 XFA_ProtoMerge_MergeNodeRecurse(pDocument, pDestNode, pTemplateChild); 330 XFA_ProtoMerge_MergeNodeRecurse(pDocument, pDestNode, pTemplateChild);
331 } 331 }
332 { 332 {
333 CXFA_NodeIterator sIterator(pDestNode); 333 CXFA_NodeIterator sIterator(pDestNode);
334 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; 334 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
335 pNode = sIterator.MoveToNext()) { 335 pNode = sIterator.MoveToNext()) {
336 pNode->ClearFlag(XFA_NODEFLAG_UnusedNode); 336 pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
337 } 337 }
338 } 338 }
339 } 339 }
340 void CXFA_Document::DoProtoMerge() { 340 void CXFA_Document::DoProtoMerge() {
341 CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template)); 341 CXFA_Node* pTemplateRoot = ToNode(GetXFAObject(XFA_HASHCODE_Template));
342 if (!pTemplateRoot) { 342 if (!pTemplateRoot) {
343 return; 343 return;
344 } 344 }
345 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> mIDMap; 345 CFX_MapPtrTemplate<uint32_t, CXFA_Node*> mIDMap;
346 CXFA_NodeSet sUseNodes; 346 CXFA_NodeSet sUseNodes;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) { 407 if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) {
408 continue; 408 continue;
409 } 409 }
410 } 410 }
411 if (!pProtoNode) { 411 if (!pProtoNode) {
412 continue; 412 continue;
413 } 413 }
414 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode); 414 XFA_ProtoMerge_MergeNode(this, pUseHrefNode, pProtoNode);
415 } 415 }
416 } 416 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_document_datamerger_imp.cpp ('k') | xfa/fxfa/parser/xfa_document_layout_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698