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 "xfa/fxfa/parser/xfa_object.h" | 7 #include "xfa/fxfa/parser/xfa_object.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
(...skipping 4558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4569 } | 4569 } |
4570 } | 4570 } |
4571 } | 4571 } |
4572 return NULL; | 4572 return NULL; |
4573 } | 4573 } |
4574 int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { | 4574 int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { |
4575 ASSERT(!pNode->m_pNext); | 4575 ASSERT(!pNode->m_pNext); |
4576 pNode->m_pParent = this; | 4576 pNode->m_pParent = this; |
4577 FX_BOOL ret = m_pDocument->RemovePurgeNode(pNode); | 4577 FX_BOOL ret = m_pDocument->RemovePurgeNode(pNode); |
4578 ASSERT(ret); | 4578 ASSERT(ret); |
| 4579 (void)ret; // Avoid unused variable warning. |
4579 | 4580 |
4580 if (m_pChild == NULL || index == 0) { | 4581 if (m_pChild == NULL || index == 0) { |
4581 if (index > 0) { | 4582 if (index > 0) { |
4582 return -1; | 4583 return -1; |
4583 } | 4584 } |
4584 pNode->m_pNext = m_pChild; | 4585 pNode->m_pNext = m_pChild; |
4585 m_pChild = pNode; | 4586 m_pChild = pNode; |
4586 index = 0; | 4587 index = 0; |
4587 } else if (index < 0) { | 4588 } else if (index < 0) { |
4588 m_pLastChild->m_pNext = pNode; | 4589 m_pLastChild->m_pNext = pNode; |
(...skipping 29 matching lines...) Expand all Loading... |
4618 } | 4619 } |
4619 | 4620 |
4620 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { | 4621 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { |
4621 if (!pNode || pNode->m_pParent || | 4622 if (!pNode || pNode->m_pParent || |
4622 (pBeforeNode && pBeforeNode->m_pParent != this)) { | 4623 (pBeforeNode && pBeforeNode->m_pParent != this)) { |
4623 ASSERT(false); | 4624 ASSERT(false); |
4624 return FALSE; | 4625 return FALSE; |
4625 } | 4626 } |
4626 FX_BOOL ret = m_pDocument->RemovePurgeNode(pNode); | 4627 FX_BOOL ret = m_pDocument->RemovePurgeNode(pNode); |
4627 ASSERT(ret); | 4628 ASSERT(ret); |
| 4629 (void)ret; // Avoid unused variable warning. |
4628 | 4630 |
4629 int32_t nIndex = -1; | 4631 int32_t nIndex = -1; |
4630 pNode->m_pParent = this; | 4632 pNode->m_pParent = this; |
4631 if (m_pChild == NULL || pBeforeNode == m_pChild) { | 4633 if (m_pChild == NULL || pBeforeNode == m_pChild) { |
4632 pNode->m_pNext = m_pChild; | 4634 pNode->m_pNext = m_pChild; |
4633 m_pChild = pNode; | 4635 m_pChild = pNode; |
4634 nIndex = 0; | 4636 nIndex = 0; |
4635 } else if (!pBeforeNode) { | 4637 } else if (!pBeforeNode) { |
4636 pNode->m_pNext = m_pLastChild->m_pNext; | 4638 pNode->m_pNext = m_pLastChild->m_pNext; |
4637 m_pLastChild->m_pNext = pNode; | 4639 m_pLastChild->m_pNext = pNode; |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5379 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5381 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5380 } | 5382 } |
5381 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5383 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5382 return m_pAttachNode->RemoveChild(pNode); | 5384 return m_pAttachNode->RemoveChild(pNode); |
5383 } | 5385 } |
5384 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5386 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5385 return m_pAttachNode->GetChild( | 5387 return m_pAttachNode->GetChild( |
5386 iIndex, XFA_ELEMENT_UNKNOWN, | 5388 iIndex, XFA_ELEMENT_UNKNOWN, |
5387 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5389 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
5388 } | 5390 } |
OLD | NEW |