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 4556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4567 if (iCount > index) { | 4567 if (iCount > index) { |
4568 return pNode; | 4568 return pNode; |
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 ASSERT(m_pDocument->RemovePurgeNode(pNode)); | 4577 FX_BOOL ret = m_pDocument->RemovePurgeNode(pNode); |
| 4578 ASSERT(ret); |
4578 | 4579 |
4579 if (m_pChild == NULL || index == 0) { | 4580 if (m_pChild == NULL || index == 0) { |
4580 if (index > 0) { | 4581 if (index > 0) { |
4581 return -1; | 4582 return -1; |
4582 } | 4583 } |
4583 pNode->m_pNext = m_pChild; | 4584 pNode->m_pNext = m_pChild; |
4584 m_pChild = pNode; | 4585 m_pChild = pNode; |
4585 index = 0; | 4586 index = 0; |
4586 } else if (index < 0) { | 4587 } else if (index < 0) { |
4587 m_pLastChild->m_pNext = pNode; | 4588 m_pLastChild->m_pNext = pNode; |
(...skipping 27 matching lines...) Expand all Loading... |
4615 } | 4616 } |
4616 return index; | 4617 return index; |
4617 } | 4618 } |
4618 | 4619 |
4619 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { | 4620 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { |
4620 if (!pNode || pNode->m_pParent || | 4621 if (!pNode || pNode->m_pParent || |
4621 (pBeforeNode && pBeforeNode->m_pParent != this)) { | 4622 (pBeforeNode && pBeforeNode->m_pParent != this)) { |
4622 ASSERT(false); | 4623 ASSERT(false); |
4623 return FALSE; | 4624 return FALSE; |
4624 } | 4625 } |
4625 ASSERT(m_pDocument->RemovePurgeNode(pNode)); | 4626 FX_BOOL ret = m_pDocument->RemovePurgeNode(pNode); |
| 4627 ASSERT(ret); |
4626 | 4628 |
4627 int32_t nIndex = -1; | 4629 int32_t nIndex = -1; |
4628 pNode->m_pParent = this; | 4630 pNode->m_pParent = this; |
4629 if (m_pChild == NULL || pBeforeNode == m_pChild) { | 4631 if (m_pChild == NULL || pBeforeNode == m_pChild) { |
4630 pNode->m_pNext = m_pChild; | 4632 pNode->m_pNext = m_pChild; |
4631 m_pChild = pNode; | 4633 m_pChild = pNode; |
4632 nIndex = 0; | 4634 nIndex = 0; |
4633 } else if (!pBeforeNode) { | 4635 } else if (!pBeforeNode) { |
4634 pNode->m_pNext = m_pLastChild->m_pNext; | 4636 pNode->m_pNext = m_pLastChild->m_pNext; |
4635 m_pLastChild->m_pNext = pNode; | 4637 m_pLastChild->m_pNext = pNode; |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5377 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5379 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5378 } | 5380 } |
5379 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5381 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5380 return m_pAttachNode->RemoveChild(pNode); | 5382 return m_pAttachNode->RemoveChild(pNode); |
5381 } | 5383 } |
5382 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5384 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5383 return m_pAttachNode->GetChild( | 5385 return m_pAttachNode->GetChild( |
5384 iIndex, XFA_ELEMENT_UNKNOWN, | 5386 iIndex, XFA_ELEMENT_UNKNOWN, |
5385 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5387 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
5386 } | 5388 } |
OLD | NEW |