| 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_imp.h" | 7 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fxfa/app/xfa_ffnotify.h" | 10 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject); | 212 CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject); |
| 213 CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); | 213 CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); |
| 214 if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { | 214 if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { |
| 215 if (szPropName == kFormCalcRuntime) { | 215 if (szPropName == kFormCalcRuntime) { |
| 216 lpScriptContext->m_hFM2JSContext->GlobalPropertyGetter(pValue); | 216 lpScriptContext->m_hFM2JSContext->GlobalPropertyGetter(pValue); |
| 217 return; | 217 return; |
| 218 } | 218 } |
| 219 XFA_HashCode uHashCode = static_cast<XFA_HashCode>( | 219 XFA_HashCode uHashCode = static_cast<XFA_HashCode>( |
| 220 FX_HashCode_GetW(wsPropName.AsStringC(), false)); | 220 FX_HashCode_GetW(wsPropName.AsStringC(), false)); |
| 221 if (uHashCode != XFA_HASHCODE_Layout) { | 221 if (uHashCode != XFA_HASHCODE_Layout) { |
| 222 CXFA_Object* pObject = | 222 CXFA_Object* pObj = |
| 223 lpScriptContext->GetDocument()->GetXFAObject(uHashCode); | 223 lpScriptContext->GetDocument()->GetXFAObject(uHashCode); |
| 224 if (pObject) { | 224 if (pObj) { |
| 225 FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObject)); | 225 FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObj)); |
| 226 return; | 226 return; |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 230 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 231 XFA_RESOLVENODE_Attributes; | 231 XFA_RESOLVENODE_Attributes; |
| 232 CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); | 232 CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); |
| 233 if (pOriginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { | 233 if (pOriginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { |
| 234 pRefNode = ToNode(lpCurNode); | 234 pRefNode = ToNode(lpCurNode); |
| 235 } | 235 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 CXFA_Node* pPropOrChild = NULL; | 328 CXFA_Node* pPropOrChild = NULL; |
| 329 const XFA_ELEMENTINFO* lpElementInfo = | 329 const XFA_ELEMENTINFO* lpElementInfo = |
| 330 XFA_GetElementByName(wsPropName.AsStringC()); | 330 XFA_GetElementByName(wsPropName.AsStringC()); |
| 331 if (lpElementInfo) { | 331 if (lpElementInfo) { |
| 332 pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName); | 332 pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName); |
| 333 } else { | 333 } else { |
| 334 pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringC()); | 334 pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringC()); |
| 335 } | 335 } |
| 336 if (pPropOrChild) { | 336 if (pPropOrChild) { |
| 337 CFX_WideString wsDefaultName(L"{default}"); | 337 CFX_WideString wsDefaultName(L"{default}"); |
| 338 const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = | 338 const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo = |
| 339 XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), | 339 XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), |
| 340 wsDefaultName.AsStringC()); | 340 wsDefaultName.AsStringC()); |
| 341 if (lpAttributeInfo) { | 341 if (lpAttrInfo) { |
| 342 (pPropOrChild->*(lpAttributeInfo->lpfnCallback))( | 342 (pPropOrChild->*(lpAttrInfo->lpfnCallback))( |
| 343 pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); | 343 pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute); |
| 344 return; | 344 return; |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 CXFA_Object* pScriptObject = | 348 CXFA_Object* pScriptObject = |
| 349 lpScriptContext->GetVariablesThis(pOriginalObject, TRUE); | 349 lpScriptContext->GetVariablesThis(pOriginalObject, TRUE); |
| 350 if (pScriptObject) { | 350 if (pScriptObject) { |
| 351 lpScriptContext->QueryVariableValue(ToNode(pScriptObject), szPropName, | 351 lpScriptContext->QueryVariableValue(ToNode(pScriptObject), szPropName, |
| 352 pReturnValue, FALSE); | 352 pReturnValue, FALSE); |
| 353 } | 353 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 } | 762 } |
| 763 } | 763 } |
| 764 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { | 764 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { |
| 765 if (!m_pScriptNodeArray) { | 765 if (!m_pScriptNodeArray) { |
| 766 return; | 766 return; |
| 767 } | 767 } |
| 768 if (m_pScriptNodeArray->Find(pNode) == -1) { | 768 if (m_pScriptNodeArray->Find(pNode) == -1) { |
| 769 m_pScriptNodeArray->Add(pNode); | 769 m_pScriptNodeArray->Add(pNode); |
| 770 } | 770 } |
| 771 } | 771 } |
| OLD | NEW |