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_script_nodehelper.h" | 7 #include "xfa/fxfa/parser/xfa_script_nodehelper.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 if (bIsClassName) { | 62 if (bIsClassName) { |
63 return XFA_NodeAcc_TraverseSiblings(parent, pNode->GetClassHashCode(), | 63 return XFA_NodeAcc_TraverseSiblings(parent, pNode->GetClassHashCode(), |
64 pSiblings, eLogicType, bIsClassName); | 64 pSiblings, eLogicType, bIsClassName); |
65 } else { | 65 } else { |
66 return XFA_NodeAcc_TraverseSiblings(parent, pNode->GetNameHash(), pSiblings, | 66 return XFA_NodeAcc_TraverseSiblings(parent, pNode->GetNameHash(), pSiblings, |
67 eLogicType, bIsClassName); | 67 eLogicType, bIsClassName); |
68 } | 68 } |
69 } | 69 } |
70 int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseAnySiblings( | 70 int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseAnySiblings( |
71 CXFA_Node* parent, | 71 CXFA_Node* parent, |
72 FX_DWORD dNameHash, | 72 uint32_t dNameHash, |
73 CXFA_NodeArray* pSiblings, | 73 CXFA_NodeArray* pSiblings, |
74 FX_BOOL bIsClassName) { | 74 FX_BOOL bIsClassName) { |
75 if (parent == NULL || pSiblings == NULL) { | 75 if (parent == NULL || pSiblings == NULL) { |
76 return 0; | 76 return 0; |
77 } | 77 } |
78 int32_t nCount = 0; | 78 int32_t nCount = 0; |
79 int32_t i = 0; | 79 int32_t i = 0; |
80 CXFA_NodeArray properties; | 80 CXFA_NodeArray properties; |
81 parent->GetNodeList(properties, XFA_NODEFILTER_Properties); | 81 parent->GetNodeList(properties, XFA_NODEFILTER_Properties); |
82 int32_t nProperties = properties.GetSize(); | 82 int32_t nProperties = properties.GetSize(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 if (nCount > 0) { | 122 if (nCount > 0) { |
123 return nCount; | 123 return nCount; |
124 } | 124 } |
125 nCount += XFA_NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, | 125 nCount += XFA_NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, |
126 bIsClassName); | 126 bIsClassName); |
127 } | 127 } |
128 return nCount; | 128 return nCount; |
129 } | 129 } |
130 int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, | 130 int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, |
131 FX_DWORD dNameHash, | 131 uint32_t dNameHash, |
132 CXFA_NodeArray* pSiblings, | 132 CXFA_NodeArray* pSiblings, |
133 XFA_LOGIC_TYPE eLogicType, | 133 XFA_LOGIC_TYPE eLogicType, |
134 FX_BOOL bIsClassName, | 134 FX_BOOL bIsClassName, |
135 FX_BOOL bIsFindProperty) { | 135 FX_BOOL bIsFindProperty) { |
136 if (parent == NULL || pSiblings == NULL) { | 136 if (parent == NULL || pSiblings == NULL) { |
137 return 0; | 137 return 0; |
138 } | 138 } |
139 int32_t nCount = 0; | 139 int32_t nCount = 0; |
140 int32_t i = 0; | 140 int32_t i = 0; |
141 if (bIsFindProperty) { | 141 if (bIsFindProperty) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); | 235 XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); |
236 if (parent == NULL) { | 236 if (parent == NULL) { |
237 return 0; | 237 return 0; |
238 } | 238 } |
239 if (!bIsProperty && eLogicType == XFA_LOGIC_Transparent) { | 239 if (!bIsProperty && eLogicType == XFA_LOGIC_Transparent) { |
240 parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); | 240 parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); |
241 if (parent == NULL) { | 241 if (parent == NULL) { |
242 return 0; | 242 return 0; |
243 } | 243 } |
244 } | 244 } |
245 FX_DWORD dwHashName = pNode->GetNameHash(); | 245 uint32_t dwHashName = pNode->GetNameHash(); |
246 if (bIsClassIndex) { | 246 if (bIsClassIndex) { |
247 dwHashName = pNode->GetClassHashCode(); | 247 dwHashName = pNode->GetClassHashCode(); |
248 } | 248 } |
249 CXFA_NodeArray siblings; | 249 CXFA_NodeArray siblings; |
250 int32_t iSize = XFA_NodeAcc_TraverseSiblings(parent, dwHashName, &siblings, | 250 int32_t iSize = XFA_NodeAcc_TraverseSiblings(parent, dwHashName, &siblings, |
251 eLogicType, bIsClassIndex); | 251 eLogicType, bIsClassIndex); |
252 for (int32_t i = 0; i < iSize; ++i) { | 252 for (int32_t i = 0; i < iSize; ++i) { |
253 CXFA_Node* child = siblings[i]; | 253 CXFA_Node* child = siblings[i]; |
254 if (child == pNode) { | 254 if (child == pNode) { |
255 return i; | 255 return i; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 m_eLastCreateType = XFA_ELEMENT_DataValue; | 420 m_eLastCreateType = XFA_ELEMENT_DataValue; |
421 } | 421 } |
422 } | 422 } |
423 FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { | 423 FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { |
424 CXFA_Node* parent = | 424 CXFA_Node* parent = |
425 XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); | 425 XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); |
426 return parent && refNode && | 426 return parent && refNode && |
427 XFA_GetPropertyOfElement(parent->GetClassID(), refNode->GetClassID(), | 427 XFA_GetPropertyOfElement(parent->GetClassID(), refNode->GetClassID(), |
428 XFA_XDPPACKET_UNKNOWN); | 428 XFA_XDPPACKET_UNKNOWN); |
429 } | 429 } |
OLD | NEW |