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_hostpseudomodel.h" | 7 #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" |
8 | 8 |
9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return; | 303 return; |
304 } | 304 } |
305 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 305 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
306 if (!pNotify) { | 306 if (!pNotify) { |
307 return; | 307 return; |
308 } | 308 } |
309 CXFA_Node* pNode = NULL; | 309 CXFA_Node* pNode = NULL; |
310 if (iLength >= 1) { | 310 if (iLength >= 1) { |
311 FXJSE_HVALUE hValue = pArguments->GetValue(0); | 311 FXJSE_HVALUE hValue = pArguments->GetValue(0); |
312 if (FXJSE_Value_IsObject(hValue)) { | 312 if (FXJSE_Value_IsObject(hValue)) { |
313 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr)); | 313 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue)); |
314 } else if (FXJSE_Value_IsUTF8String(hValue)) { | 314 } else if (FXJSE_Value_IsUTF8String(hValue)) { |
315 CFX_ByteString bsString; | 315 CFX_ByteString bsString; |
316 FXJSE_Value_ToUTF8String(hValue, bsString); | 316 FXJSE_Value_ToUTF8String(hValue, bsString); |
317 CFX_WideString wsExpression = | 317 CFX_WideString wsExpression = |
318 CFX_WideString::FromUTF8(bsString.AsStringC()); | 318 CFX_WideString::FromUTF8(bsString.AsStringC()); |
319 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 319 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
320 if (!pScriptContext) { | 320 if (!pScriptContext) { |
321 FXJSE_Value_Release(hValue); | 321 FXJSE_Value_Release(hValue); |
322 return; | 322 return; |
323 } | 323 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 return; | 504 return; |
505 } | 505 } |
506 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 506 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
507 if (!pNotify) { | 507 if (!pNotify) { |
508 return; | 508 return; |
509 } | 509 } |
510 CXFA_Node* pNode = NULL; | 510 CXFA_Node* pNode = NULL; |
511 if (iLength >= 1) { | 511 if (iLength >= 1) { |
512 FXJSE_HVALUE hValue = pArguments->GetValue(0); | 512 FXJSE_HVALUE hValue = pArguments->GetValue(0); |
513 if (FXJSE_Value_IsObject(hValue)) { | 513 if (FXJSE_Value_IsObject(hValue)) { |
514 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, NULL)); | 514 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue)); |
515 } else if (FXJSE_Value_IsUTF8String(hValue)) { | 515 } else if (FXJSE_Value_IsUTF8String(hValue)) { |
516 CFX_ByteString bsString; | 516 CFX_ByteString bsString; |
517 FXJSE_Value_ToUTF8String(hValue, bsString); | 517 FXJSE_Value_ToUTF8String(hValue, bsString); |
518 CFX_WideString wsExpression = | 518 CFX_WideString wsExpression = |
519 CFX_WideString::FromUTF8(bsString.AsStringC()); | 519 CFX_WideString::FromUTF8(bsString.AsStringC()); |
520 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 520 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
521 if (!pScriptContext) { | 521 if (!pScriptContext) { |
522 FXJSE_Value_Release(hValue); | 522 FXJSE_Value_Release(hValue); |
523 return; | 523 return; |
524 } | 524 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 793 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
794 if (!pNotify) { | 794 if (!pNotify) { |
795 return; | 795 return; |
796 } | 796 } |
797 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); | 797 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); |
798 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 798 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
799 if (hValue) { | 799 if (hValue) { |
800 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime).AsStringC()); | 800 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime).AsStringC()); |
801 } | 801 } |
802 } | 802 } |
OLD | NEW |