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 "fxjse/include/cfxjse_arguments.h" | 10 #include "fxjse/include/cfxjse_arguments.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 CFXJSE_Value* pOriginalValue, | 350 CFXJSE_Value* pOriginalValue, |
351 const CFX_ByteStringC& szPropName, | 351 const CFX_ByteStringC& szPropName, |
352 FX_BOOL bQueryIn) { | 352 FX_BOOL bQueryIn) { |
353 CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); | 353 CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); |
354 if (!pObject) | 354 if (!pObject) |
355 return FXJSE_ClassPropType_None; | 355 return FXJSE_ClassPropType_None; |
356 | 356 |
357 CXFA_ScriptContext* lpScriptContext = | 357 CXFA_ScriptContext* lpScriptContext = |
358 pObject->GetDocument()->GetScriptContext(); | 358 pObject->GetDocument()->GetScriptContext(); |
359 pObject = lpScriptContext->GetVariablesThis(pObject); | 359 pObject = lpScriptContext->GetVariablesThis(pObject); |
360 XFA_Element objElement = pObject->GetElementType(); | 360 XFA_Element eType = pObject->GetElementType(); |
361 CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); | 361 CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); |
362 if (XFA_GetMethodByName(objElement, wsPropName.AsStringC())) { | 362 if (XFA_GetMethodByName(eType, wsPropName.AsStringC())) { |
363 return FXJSE_ClassPropType_Method; | 363 return FXJSE_ClassPropType_Method; |
364 } | 364 } |
365 if (bQueryIn && | 365 if (bQueryIn && |
366 !XFA_GetScriptAttributeByName(objElement, wsPropName.AsStringC())) { | 366 !XFA_GetScriptAttributeByName(eType, wsPropName.AsStringC())) { |
367 return FXJSE_ClassPropType_None; | 367 return FXJSE_ClassPropType_None; |
368 } | 368 } |
369 return FXJSE_ClassPropType_Property; | 369 return FXJSE_ClassPropType_Property; |
370 } | 370 } |
371 int32_t CXFA_ScriptContext::GlobalPropTypeGetter( | 371 int32_t CXFA_ScriptContext::GlobalPropTypeGetter( |
372 CFXJSE_Value* pOriginalValue, | 372 CFXJSE_Value* pOriginalValue, |
373 const CFX_ByteStringC& szPropName, | 373 const CFX_ByteStringC& szPropName, |
374 FX_BOOL bQueryIn) { | 374 FX_BOOL bQueryIn) { |
375 CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); | 375 CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); |
376 if (!pObject) | 376 if (!pObject) |
377 return FXJSE_ClassPropType_None; | 377 return FXJSE_ClassPropType_None; |
378 | 378 |
379 CXFA_ScriptContext* lpScriptContext = | 379 CXFA_ScriptContext* lpScriptContext = |
380 pObject->GetDocument()->GetScriptContext(); | 380 pObject->GetDocument()->GetScriptContext(); |
381 pObject = lpScriptContext->GetVariablesThis(pObject); | 381 pObject = lpScriptContext->GetVariablesThis(pObject); |
382 XFA_Element objElement = pObject->GetElementType(); | 382 XFA_Element eType = pObject->GetElementType(); |
383 CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); | 383 CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); |
384 if (XFA_GetMethodByName(objElement, wsPropName.AsStringC())) { | 384 if (XFA_GetMethodByName(eType, wsPropName.AsStringC())) { |
385 return FXJSE_ClassPropType_Method; | 385 return FXJSE_ClassPropType_Method; |
386 } | 386 } |
387 return FXJSE_ClassPropType_Property; | 387 return FXJSE_ClassPropType_Property; |
388 } | 388 } |
389 void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, | 389 void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, |
390 const CFX_ByteStringC& szFuncName, | 390 const CFX_ByteStringC& szFuncName, |
391 CFXJSE_Arguments& args) { | 391 CFXJSE_Arguments& args) { |
392 CXFA_Object* pObject = ToObject(pThis, nullptr); | 392 CXFA_Object* pObject = ToObject(pThis, nullptr); |
393 if (!pObject) | 393 if (!pObject) |
394 return; | 394 return; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 return; | 737 return; |
738 if (nodes.GetSize() > 0) | 738 if (nodes.GetSize() > 0) |
739 m_pScriptNodeArray->Copy(nodes); | 739 m_pScriptNodeArray->Copy(nodes); |
740 } | 740 } |
741 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { | 741 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { |
742 if (!m_pScriptNodeArray) | 742 if (!m_pScriptNodeArray) |
743 return; | 743 return; |
744 if (m_pScriptNodeArray->Find(pNode) == -1) | 744 if (m_pScriptNodeArray->Find(pNode) == -1) |
745 m_pScriptNodeArray->Add(pNode); | 745 m_pScriptNodeArray->Add(pNode); |
746 } | 746 } |
OLD | NEW |