| 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/src/foxitlib.h" | 7 #include "xfa/src/foxitlib.h" |
| 8 #include "xfa/src/fxfa/src/common/xfa_utils.h" | 8 #include "xfa/src/fxfa/src/common/xfa_utils.h" |
| 9 #include "xfa/src/fxfa/src/common/xfa_object.h" | 9 #include "xfa/src/fxfa/src/common/xfa_object.h" |
| 10 #include "xfa/src/fxfa/src/common/xfa_document.h" | 10 #include "xfa/src/fxfa/src/common/xfa_document.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); | 110 (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); |
| 111 CXFA_Document* pDoc = lpOrginalNode->GetDocument(); | 111 CXFA_Document* pDoc = lpOrginalNode->GetDocument(); |
| 112 CXFA_ScriptContext* lpScriptContext = | 112 CXFA_ScriptContext* lpScriptContext = |
| 113 (CXFA_ScriptContext*)pDoc->GetScriptContext(); | 113 (CXFA_ScriptContext*)pDoc->GetScriptContext(); |
| 114 CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode); | 114 CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode); |
| 115 CFX_WideString wsPropName = CFX_WideString::FromUTF8( | 115 CFX_WideString wsPropName = CFX_WideString::FromUTF8( |
| 116 (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); | 116 (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); |
| 117 FX_DWORD dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | | 117 FX_DWORD dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | |
| 118 XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 118 XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 119 XFA_RESOLVENODE_Attributes; | 119 XFA_RESOLVENODE_Attributes; |
| 120 CXFA_Node* pRefNode = (CXFA_Node*)lpScriptContext->GetThisObject(); | 120 CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); |
| 121 if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { | 121 if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { |
| 122 pRefNode = (CXFA_Node*)lpCurNode; | 122 pRefNode = ToNode(lpCurNode); |
| 123 } | 123 } |
| 124 if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, | 124 if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, |
| 125 TRUE)) { | 125 TRUE)) { |
| 126 return; | 126 return; |
| 127 } | 127 } |
| 128 if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { | 128 if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { |
| 129 if (FXJSE_Value_IsUndefined(hValue)) { | 129 if (FXJSE_Value_IsUndefined(hValue)) { |
| 130 FXJSE_Value_SetObjectOwnProp(hObject, szPropName, hValue); | 130 FXJSE_Value_SetObjectOwnProp(hObject, szPropName, hValue); |
| 131 return; | 131 return; |
| 132 } | 132 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 CXFA_Object* pObject = | 183 CXFA_Object* pObject = |
| 184 lpScriptContext->GetDocument()->GetXFAObject(uHashCode); | 184 lpScriptContext->GetDocument()->GetXFAObject(uHashCode); |
| 185 if (pObject) { | 185 if (pObject) { |
| 186 FXJSE_Value_Set(hValue, lpScriptContext->GetJSValueFromMap(pObject)); | 186 FXJSE_Value_Set(hValue, lpScriptContext->GetJSValueFromMap(pObject)); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 191 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 192 XFA_RESOLVENODE_Attributes; | 192 XFA_RESOLVENODE_Attributes; |
| 193 CXFA_Node* pRefNode = (CXFA_Node*)lpScriptContext->GetThisObject(); | 193 CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); |
| 194 if (pOrginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { | 194 if (pOrginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { |
| 195 pRefNode = (CXFA_Node*)lpCurNode; | 195 pRefNode = ToNode(lpCurNode); |
| 196 } | 196 } |
| 197 if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, | 197 if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, |
| 198 FALSE)) { | 198 FALSE)) { |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; | 201 dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; |
| 202 if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, | 202 if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, |
| 203 FALSE)) { | 203 FALSE)) { |
| 204 return; | 204 return; |
| 205 } | 205 } |
| 206 CXFA_Object* pScriptObject = | 206 CXFA_Object* pScriptObject = |
| 207 lpScriptContext->GetVariablesThis(pOrginalObject, TRUE); | 207 lpScriptContext->GetVariablesThis(pOrginalObject, TRUE); |
| 208 if (pScriptObject && | 208 if (pScriptObject && |
| 209 lpScriptContext->QueryVariableHValue((CXFA_Node*)pScriptObject, | 209 lpScriptContext->QueryVariableHValue(pScriptObject->AsNode(), szPropName, |
| 210 szPropName, hValue, TRUE)) { | 210 hValue, TRUE)) { |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 IXFA_Notify* pNotify = pDoc->GetNotify(); | 213 IXFA_Notify* pNotify = pDoc->GetNotify(); |
| 214 if (!pNotify) { | 214 if (!pNotify) { |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 pNotify->GetDocProvider()->GetGlobalProperty(pNotify->GetHDOC(), szPropName, | 217 pNotify->GetDocProvider()->GetGlobalProperty(pNotify->GetHDOC(), szPropName, |
| 218 hValue); | 218 hValue); |
| 219 } | 219 } |
| 220 void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, | 220 void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 232 (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); | 232 (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); |
| 233 CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); | 233 CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); |
| 234 if (wsPropName == FX_WSTRC(L"xfa")) { | 234 if (wsPropName == FX_WSTRC(L"xfa")) { |
| 235 FXJSE_HVALUE pValue = lpScriptContext->GetJSValueFromMap( | 235 FXJSE_HVALUE pValue = lpScriptContext->GetJSValueFromMap( |
| 236 lpScriptContext->GetDocument()->GetRoot()); | 236 lpScriptContext->GetDocument()->GetRoot()); |
| 237 FXJSE_Value_Set(hValue, pValue); | 237 FXJSE_Value_Set(hValue, pValue); |
| 238 return; | 238 return; |
| 239 } | 239 } |
| 240 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 240 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 241 XFA_RESOLVENODE_Attributes; | 241 XFA_RESOLVENODE_Attributes; |
| 242 FX_BOOL bRet = lpScriptContext->QueryNodeByFlag( | 242 FX_BOOL bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, |
| 243 (CXFA_Node*)pObject, wsPropName, hValue, dwFlag, FALSE); | 243 hValue, dwFlag, FALSE); |
| 244 if (bRet) { | 244 if (bRet) { |
| 245 return; | 245 return; |
| 246 } | 246 } |
| 247 if (pObject == lpScriptContext->GetThisObject() || | 247 if (pObject == lpScriptContext->GetThisObject() || |
| 248 (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript && | 248 (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript && |
| 249 !lpScriptContext->IsStrictScopeInJavaScript())) { | 249 !lpScriptContext->IsStrictScopeInJavaScript())) { |
| 250 dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; | 250 dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; |
| 251 bRet = lpScriptContext->QueryNodeByFlag((CXFA_Node*)pObject, wsPropName, | 251 bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, hValue, |
| 252 hValue, dwFlag, FALSE); | 252 dwFlag, FALSE); |
| 253 } | 253 } |
| 254 if (bRet) { | 254 if (bRet) { |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 CXFA_Object* pScriptObject = | 257 CXFA_Object* pScriptObject = |
| 258 lpScriptContext->GetVariablesThis(pOrginalObject, TRUE); | 258 lpScriptContext->GetVariablesThis(pOrginalObject, TRUE); |
| 259 if (pScriptObject) { | 259 if (pScriptObject) { |
| 260 bRet = lpScriptContext->QueryVariableHValue((CXFA_Node*)pScriptObject, | 260 bRet = lpScriptContext->QueryVariableHValue(ToNode(pScriptObject), |
| 261 szPropName, hValue, TRUE); | 261 szPropName, hValue, TRUE); |
| 262 } | 262 } |
| 263 if (!bRet) { | 263 if (!bRet) { |
| 264 FXJSE_Value_SetUndefined(hValue); | 264 FXJSE_Value_SetUndefined(hValue); |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, | 267 void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, |
| 268 const CFX_ByteStringC& szPropName, | 268 const CFX_ByteStringC& szPropName, |
| 269 FXJSE_HVALUE hValue) { | 269 FXJSE_HVALUE hValue) { |
| 270 CXFA_Object* pOrginalObject = | 270 CXFA_Object* pOrginalObject = |
| 271 (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); | 271 (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); |
| 272 if (pOrginalObject == NULL) { | 272 if (pOrginalObject == NULL) { |
| 273 return; | 273 return; |
| 274 } | 274 } |
| 275 CXFA_ScriptContext* lpScriptContext = | 275 CXFA_ScriptContext* lpScriptContext = |
| 276 (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); | 276 (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); |
| 277 CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); | 277 CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); |
| 278 CFX_WideString wsPropName = CFX_WideString::FromUTF8( | 278 CFX_WideString wsPropName = CFX_WideString::FromUTF8( |
| 279 (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); | 279 (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); |
| 280 XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = | 280 XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = |
| 281 XFA_GetScriptAttributeByName(pObject->GetClassID(), wsPropName); | 281 XFA_GetScriptAttributeByName(pObject->GetClassID(), wsPropName); |
| 282 if (lpAttributeInfo) { | 282 if (lpAttributeInfo) { |
| 283 (pObject->*(lpAttributeInfo->lpfnCallback))( | 283 (pObject->*(lpAttributeInfo->lpfnCallback))( |
| 284 hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); | 284 hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); |
| 285 } else { | 285 } else { |
| 286 if (pObject->IsNode()) { | 286 if (pObject->IsNode()) { |
| 287 if (wsPropName.GetAt(0) == '#') { | 287 if (wsPropName.GetAt(0) == '#') { |
| 288 wsPropName = wsPropName.Right(wsPropName.GetLength() - 1); | 288 wsPropName = wsPropName.Right(wsPropName.GetLength() - 1); |
| 289 } | 289 } |
| 290 CXFA_Node* pNode = (CXFA_Node*)pObject; | 290 CXFA_Node* pNode = ToNode(pObject); |
| 291 CXFA_Node* pPropOrChild = NULL; | 291 CXFA_Node* pPropOrChild = NULL; |
| 292 XFA_LPCELEMENTINFO lpElementInfo = XFA_GetElementByName(wsPropName); | 292 XFA_LPCELEMENTINFO lpElementInfo = XFA_GetElementByName(wsPropName); |
| 293 if (lpElementInfo) { | 293 if (lpElementInfo) { |
| 294 pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName); | 294 pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName); |
| 295 } else { | 295 } else { |
| 296 pPropOrChild = pNode->GetFirstChildByName(wsPropName); | 296 pPropOrChild = pNode->GetFirstChildByName(wsPropName); |
| 297 } | 297 } |
| 298 if (pPropOrChild) { | 298 if (pPropOrChild) { |
| 299 CFX_WideString wsDefaultName = FX_WSTRC(L"{default}"); | 299 CFX_WideString wsDefaultName = FX_WSTRC(L"{default}"); |
| 300 XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = | 300 XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = |
| 301 XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), | 301 XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), |
| 302 wsDefaultName); | 302 wsDefaultName); |
| 303 if (lpAttributeInfo) { | 303 if (lpAttributeInfo) { |
| 304 (pPropOrChild->*(lpAttributeInfo->lpfnCallback))( | 304 (pPropOrChild->*(lpAttributeInfo->lpfnCallback))( |
| 305 hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); | 305 hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); |
| 306 return; | 306 return; |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 CXFA_Object* pScriptObject = | 310 CXFA_Object* pScriptObject = |
| 311 lpScriptContext->GetVariablesThis(pOrginalObject, TRUE); | 311 lpScriptContext->GetVariablesThis(pOrginalObject, TRUE); |
| 312 if (pScriptObject) { | 312 if (pScriptObject) { |
| 313 lpScriptContext->QueryVariableHValue((CXFA_Node*)pScriptObject, | 313 lpScriptContext->QueryVariableHValue(ToNode(pScriptObject), szPropName, |
| 314 szPropName, hValue, FALSE); | 314 hValue, FALSE); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 int32_t CXFA_ScriptContext::NormalPropTypeGetter( | 318 int32_t CXFA_ScriptContext::NormalPropTypeGetter( |
| 319 FXJSE_HOBJECT hObject, | 319 FXJSE_HOBJECT hObject, |
| 320 const CFX_ByteStringC& szPropName, | 320 const CFX_ByteStringC& szPropName, |
| 321 FX_BOOL bQueryIn) { | 321 FX_BOOL bQueryIn) { |
| 322 CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); | 322 CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(hObject, NULL); |
| 323 if (pObject == NULL) { | 323 if (pObject == NULL) { |
| 324 return FXJSE_ClassPropType_None; | 324 return FXJSE_ClassPropType_None; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 XFA_RESOLVENODE_RS& resolveNodeRS, | 562 XFA_RESOLVENODE_RS& resolveNodeRS, |
| 563 FX_DWORD dwStyles, | 563 FX_DWORD dwStyles, |
| 564 CXFA_Node* bindNode) { | 564 CXFA_Node* bindNode) { |
| 565 if (wsExpression.IsEmpty()) { | 565 if (wsExpression.IsEmpty()) { |
| 566 return 0; | 566 return 0; |
| 567 } | 567 } |
| 568 if (m_eScriptType != XFA_SCRIPTLANGTYPE_Formcalc || | 568 if (m_eScriptType != XFA_SCRIPTLANGTYPE_Formcalc || |
| 569 (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { | 569 (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { |
| 570 m_upObjectArray.RemoveAll(); | 570 m_upObjectArray.RemoveAll(); |
| 571 } | 571 } |
| 572 if (refNode && | 572 if (refNode && refNode->IsNode() && |
| 573 (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings)) && | 573 (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { |
| 574 refNode->IsNode()) { | 574 m_upObjectArray.Add(refNode->AsNode()); |
| 575 m_upObjectArray.Add((CXFA_Node*)refNode); | |
| 576 } | 575 } |
| 577 FX_BOOL bNextCreate = FALSE; | 576 FX_BOOL bNextCreate = FALSE; |
| 578 if (dwStyles & XFA_RESOLVENODE_CreateNode) { | 577 if (dwStyles & XFA_RESOLVENODE_CreateNode) { |
| 579 m_pResolveProcessor->GetNodeHelper()->XFA_SetCreateNodeType(bindNode); | 578 m_pResolveProcessor->GetNodeHelper()->XFA_SetCreateNodeType(bindNode); |
| 580 } | 579 } |
| 581 m_pResolveProcessor->GetNodeHelper()->m_pCreateParent = NULL; | 580 m_pResolveProcessor->GetNodeHelper()->m_pCreateParent = NULL; |
| 582 m_pResolveProcessor->GetNodeHelper()->m_iCurAllStart = -1; | 581 m_pResolveProcessor->GetNodeHelper()->m_iCurAllStart = -1; |
| 583 CXFA_ResolveNodesData rndFind; | 582 CXFA_ResolveNodesData rndFind; |
| 584 int32_t nStart = 0; | 583 int32_t nStart = 0; |
| 585 int32_t nLevel = 0; | 584 int32_t nLevel = 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 604 CXFA_Node* pDataNode = NULL; | 603 CXFA_Node* pDataNode = NULL; |
| 605 nStart = m_pResolveProcessor->GetNodeHelper()->m_iCurAllStart; | 604 nStart = m_pResolveProcessor->GetNodeHelper()->m_iCurAllStart; |
| 606 if (nStart != -1) { | 605 if (nStart != -1) { |
| 607 pDataNode = m_pDocument->GetNotBindNode(findNodes); | 606 pDataNode = m_pDocument->GetNotBindNode(findNodes); |
| 608 if (pDataNode) { | 607 if (pDataNode) { |
| 609 findNodes.RemoveAll(); | 608 findNodes.RemoveAll(); |
| 610 findNodes.Add(pDataNode); | 609 findNodes.Add(pDataNode); |
| 611 break; | 610 break; |
| 612 } | 611 } |
| 613 } else { | 612 } else { |
| 614 pDataNode = (CXFA_Node*)findNodes[0]; | 613 pDataNode = findNodes[0]->AsNode(); |
| 615 findNodes.RemoveAll(); | 614 findNodes.RemoveAll(); |
| 616 findNodes.Add(pDataNode); | 615 findNodes.Add(pDataNode); |
| 617 break; | 616 break; |
| 618 } | 617 } |
| 619 dwStyles |= XFA_RESOLVENODE_Bind; | 618 dwStyles |= XFA_RESOLVENODE_Bind; |
| 620 findNodes.RemoveAll(); | 619 findNodes.RemoveAll(); |
| 621 findNodes.Add(m_pResolveProcessor->GetNodeHelper()->m_pAllStartParent); | 620 findNodes.Add(m_pResolveProcessor->GetNodeHelper()->m_pAllStartParent); |
| 622 continue; | 621 continue; |
| 623 } else { | 622 } else { |
| 624 break; | 623 break; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 break; | 674 break; |
| 676 } | 675 } |
| 677 } | 676 } |
| 678 findNodes.RemoveAll(); | 677 findNodes.RemoveAll(); |
| 679 nNodes = retNodes.GetSize(); | 678 nNodes = retNodes.GetSize(); |
| 680 if (nNodes < 1) { | 679 if (nNodes < 1) { |
| 681 if (dwStyles & XFA_RESOLVENODE_CreateNode) { | 680 if (dwStyles & XFA_RESOLVENODE_CreateNode) { |
| 682 bNextCreate = TRUE; | 681 bNextCreate = TRUE; |
| 683 if (m_pResolveProcessor->GetNodeHelper()->m_pCreateParent == NULL) { | 682 if (m_pResolveProcessor->GetNodeHelper()->m_pCreateParent == NULL) { |
| 684 m_pResolveProcessor->GetNodeHelper()->m_pCreateParent = | 683 m_pResolveProcessor->GetNodeHelper()->m_pCreateParent = |
| 685 (CXFA_Node*)rndFind.m_CurNode; | 684 ToNode(rndFind.m_CurNode); |
| 686 m_pResolveProcessor->GetNodeHelper()->m_iCreateCount = 1; | 685 m_pResolveProcessor->GetNodeHelper()->m_iCreateCount = 1; |
| 687 } | 686 } |
| 688 FX_BOOL bCreate = | 687 FX_BOOL bCreate = |
| 689 m_pResolveProcessor->GetNodeHelper()->XFA_ResolveNodes_CreateNode( | 688 m_pResolveProcessor->GetNodeHelper()->XFA_ResolveNodes_CreateNode( |
| 690 rndFind.m_wsName, rndFind.m_wsCondition, | 689 rndFind.m_wsName, rndFind.m_wsCondition, |
| 691 nStart == wsExpression.GetLength(), this); | 690 nStart == wsExpression.GetLength(), this); |
| 692 if (bCreate) { | 691 if (bCreate) { |
| 693 continue; | 692 continue; |
| 694 } else { | 693 } else { |
| 695 break; | 694 break; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 724 } | 723 } |
| 725 return resolveNodeRS.nodes.GetSize(); | 724 return resolveNodeRS.nodes.GetSize(); |
| 726 } | 725 } |
| 727 return nNodes; | 726 return nNodes; |
| 728 } | 727 } |
| 729 FXJSE_HVALUE CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { | 728 FXJSE_HVALUE CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { |
| 730 if (!pObject) { | 729 if (!pObject) { |
| 731 return NULL; | 730 return NULL; |
| 732 } | 731 } |
| 733 if (pObject->IsNode()) { | 732 if (pObject->IsNode()) { |
| 734 RunVariablesScript((CXFA_Node*)pObject); | 733 RunVariablesScript(pObject->AsNode()); |
| 735 } | 734 } |
| 736 void* pValue = m_mapXFAToHValue.GetValueAt(pObject); | 735 void* pValue = m_mapXFAToHValue.GetValueAt(pObject); |
| 737 if (pValue == NULL) { | 736 if (pValue == NULL) { |
| 738 FXJSE_HVALUE jsHvalue = FXJSE_Value_Create(m_hJsRuntime); | 737 FXJSE_HVALUE jsHvalue = FXJSE_Value_Create(m_hJsRuntime); |
| 739 FXJSE_Value_SetObject(jsHvalue, pObject, m_hJsClass); | 738 FXJSE_Value_SetObject(jsHvalue, pObject, m_hJsClass); |
| 740 m_mapXFAToHValue.SetAt(pObject, jsHvalue); | 739 m_mapXFAToHValue.SetAt(pObject, jsHvalue); |
| 741 pValue = jsHvalue; | 740 pValue = jsHvalue; |
| 742 } | 741 } |
| 743 return (FXJSE_HVALUE)pValue; | 742 return (FXJSE_HVALUE)pValue; |
| 744 } | 743 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 775 if (!m_pScriptNodeArray) { | 774 if (!m_pScriptNodeArray) { |
| 776 return; | 775 return; |
| 777 } | 776 } |
| 778 if (m_pScriptNodeArray->Find(pNode) == -1) { | 777 if (m_pScriptNodeArray->Find(pNode) == -1) { |
| 779 m_pScriptNodeArray->Add(pNode); | 778 m_pScriptNodeArray->Add(pNode); |
| 780 } | 779 } |
| 781 } | 780 } |
| 782 IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument) { | 781 IXFA_ScriptContext* XFA_ScriptContext_Create(CXFA_Document* pDocument) { |
| 783 return new CXFA_ScriptContext(pDocument); | 782 return new CXFA_ScriptContext(pDocument); |
| 784 } | 783 } |
| OLD | NEW |