| 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/fm2js/xfa_fm2jscontext.h" | 7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" |
| 8 | 8 |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 iIndex++; | 489 iIndex++; |
| 490 } | 490 } |
| 491 if (patternType == XFA_VT_NULL) { | 491 if (patternType == XFA_VT_NULL) { |
| 492 patternType = XFA_VT_TEXT | XFA_VT_FLOAT; | 492 patternType = XFA_VT_TEXT | XFA_VT_FLOAT; |
| 493 } | 493 } |
| 494 return false; | 494 return false; |
| 495 } | 495 } |
| 496 | 496 |
| 497 CXFA_FM2JSContext* ToJSContext(CFXJSE_Value* pValue, CFXJSE_Class* pClass) { |
| 498 return static_cast<CXFA_FM2JSContext*>(pValue->ToHostObject(pClass)); |
| 499 } |
| 500 |
| 497 } // namespace | 501 } // namespace |
| 498 | 502 |
| 499 // static | 503 // static |
| 500 void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, | 504 void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, |
| 501 const CFX_ByteStringC& szFuncName, | 505 const CFX_ByteStringC& szFuncName, |
| 502 CFXJSE_Arguments& args) { | 506 CFXJSE_Arguments& args) { |
| 503 if (args.GetLength() != 1) { | 507 if (args.GetLength() != 1) { |
| 504 CXFA_FM2JSContext* pContext = | 508 ToJSContext(pThis, nullptr) |
| 505 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 509 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Abs"); |
| 506 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Abs"); | |
| 507 return; | 510 return; |
| 508 } | 511 } |
| 509 | 512 |
| 510 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 513 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 511 if (ValueIsNull(pThis, argOne.get())) { | 514 if (ValueIsNull(pThis, argOne.get())) { |
| 512 FXJSE_Value_SetNull(args.GetReturnValue()); | 515 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 513 return; | 516 return; |
| 514 } | 517 } |
| 515 | 518 |
| 516 FX_DOUBLE dValue = ValueToDouble(pThis, argOne.get()); | 519 FX_DOUBLE dValue = ValueToDouble(pThis, argOne.get()); |
| 517 if (dValue < 0) | 520 if (dValue < 0) |
| 518 dValue = -dValue; | 521 dValue = -dValue; |
| 519 | 522 |
| 520 FXJSE_Value_SetDouble(args.GetReturnValue(), dValue); | 523 FXJSE_Value_SetDouble(args.GetReturnValue(), dValue); |
| 521 } | 524 } |
| 522 | 525 |
| 523 // static | 526 // static |
| 524 void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, | 527 void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, |
| 525 const CFX_ByteStringC& szFuncName, | 528 const CFX_ByteStringC& szFuncName, |
| 526 CFXJSE_Arguments& args) { | 529 CFXJSE_Arguments& args) { |
| 527 int32_t argc = args.GetLength(); | 530 int32_t argc = args.GetLength(); |
| 528 if (argc < 1) { | 531 if (argc < 1) { |
| 529 FXJSE_Value_SetNull(args.GetReturnValue()); | 532 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 530 return; | 533 return; |
| 531 } | 534 } |
| 532 | 535 |
| 533 CXFA_FM2JSContext* pContext = | 536 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 534 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 535 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 536 uint32_t uCount = 0; | 537 uint32_t uCount = 0; |
| 537 FX_DOUBLE dSum = 0.0; | 538 FX_DOUBLE dSum = 0.0; |
| 538 for (int32_t i = 0; i < argc; i++) { | 539 for (int32_t i = 0; i < argc; i++) { |
| 539 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); | 540 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); |
| 540 if (FXJSE_Value_IsNull(argValue.get())) | 541 if (FXJSE_Value_IsNull(argValue.get())) |
| 541 continue; | 542 continue; |
| 542 | 543 |
| 543 if (!FXJSE_Value_IsArray(argValue.get())) { | 544 if (!FXJSE_Value_IsArray(argValue.get())) { |
| 544 dSum += ValueToDouble(pThis, argValue.get()); | 545 dSum += ValueToDouble(pThis, argValue.get()); |
| 545 uCount++; | 546 uCount++; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 } | 595 } |
| 595 | 596 |
| 596 FXJSE_Value_SetDouble(args.GetReturnValue(), dSum / uCount); | 597 FXJSE_Value_SetDouble(args.GetReturnValue(), dSum / uCount); |
| 597 } | 598 } |
| 598 | 599 |
| 599 // static | 600 // static |
| 600 void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, | 601 void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, |
| 601 const CFX_ByteStringC& szFuncName, | 602 const CFX_ByteStringC& szFuncName, |
| 602 CFXJSE_Arguments& args) { | 603 CFXJSE_Arguments& args) { |
| 603 if (args.GetLength() != 1) { | 604 if (args.GetLength() != 1) { |
| 604 CXFA_FM2JSContext* pContext = | 605 ToJSContext(pThis, nullptr) |
| 605 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 606 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ceil"); |
| 606 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ceil"); | |
| 607 return; | 607 return; |
| 608 } | 608 } |
| 609 | 609 |
| 610 std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0); | 610 std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0); |
| 611 if (ValueIsNull(pThis, argValue.get())) { | 611 if (ValueIsNull(pThis, argValue.get())) { |
| 612 FXJSE_Value_SetNull(args.GetReturnValue()); | 612 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 613 return; | 613 return; |
| 614 } | 614 } |
| 615 | 615 |
| 616 FXJSE_Value_SetFloat(args.GetReturnValue(), | 616 FXJSE_Value_SetFloat(args.GetReturnValue(), |
| 617 FXSYS_ceil(ValueToFloat(pThis, argValue.get()))); | 617 FXSYS_ceil(ValueToFloat(pThis, argValue.get()))); |
| 618 } | 618 } |
| 619 | 619 |
| 620 // static | 620 // static |
| 621 void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, | 621 void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, |
| 622 const CFX_ByteStringC& szFuncName, | 622 const CFX_ByteStringC& szFuncName, |
| 623 CFXJSE_Arguments& args) { | 623 CFXJSE_Arguments& args) { |
| 624 CXFA_FM2JSContext* pContext = | 624 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 625 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 626 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 625 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 627 int32_t iCount = 0; | 626 int32_t iCount = 0; |
| 628 for (int32_t i = 0; i < args.GetLength(); i++) { | 627 for (int32_t i = 0; i < args.GetLength(); i++) { |
| 629 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); | 628 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); |
| 630 if (FXJSE_Value_IsNull(argValue.get())) | 629 if (FXJSE_Value_IsNull(argValue.get())) |
| 631 continue; | 630 continue; |
| 632 | 631 |
| 633 if (FXJSE_Value_IsArray(argValue.get())) { | 632 if (FXJSE_Value_IsArray(argValue.get())) { |
| 634 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 633 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 635 FXJSE_Value_GetObjectProp(argValue.get(), "length", lengthValue.get()); | 634 FXJSE_Value_GetObjectProp(argValue.get(), "length", lengthValue.get()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 676 } |
| 678 } | 677 } |
| 679 FXJSE_Value_SetInteger(args.GetReturnValue(), iCount); | 678 FXJSE_Value_SetInteger(args.GetReturnValue(), iCount); |
| 680 } | 679 } |
| 681 | 680 |
| 682 // static | 681 // static |
| 683 void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, | 682 void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, |
| 684 const CFX_ByteStringC& szFuncName, | 683 const CFX_ByteStringC& szFuncName, |
| 685 CFXJSE_Arguments& args) { | 684 CFXJSE_Arguments& args) { |
| 686 if (args.GetLength() != 1) { | 685 if (args.GetLength() != 1) { |
| 687 CXFA_FM2JSContext* pContext = | 686 ToJSContext(pThis, nullptr) |
| 688 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 687 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Floor"); |
| 689 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Floor"); | |
| 690 return; | 688 return; |
| 691 } | 689 } |
| 692 | 690 |
| 693 std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0); | 691 std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0); |
| 694 if (ValueIsNull(pThis, argValue.get())) { | 692 if (ValueIsNull(pThis, argValue.get())) { |
| 695 FXJSE_Value_SetNull(args.GetReturnValue()); | 693 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 696 return; | 694 return; |
| 697 } | 695 } |
| 698 | 696 |
| 699 FXJSE_Value_SetFloat(args.GetReturnValue(), | 697 FXJSE_Value_SetFloat(args.GetReturnValue(), |
| 700 FXSYS_floor(ValueToFloat(pThis, argValue.get()))); | 698 FXSYS_floor(ValueToFloat(pThis, argValue.get()))); |
| 701 } | 699 } |
| 702 | 700 |
| 703 // static | 701 // static |
| 704 void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, | 702 void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, |
| 705 const CFX_ByteStringC& szFuncName, | 703 const CFX_ByteStringC& szFuncName, |
| 706 CFXJSE_Arguments& args) { | 704 CFXJSE_Arguments& args) { |
| 707 CXFA_FM2JSContext* pContext = | 705 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 708 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 709 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 706 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 710 uint32_t uCount = 0; | 707 uint32_t uCount = 0; |
| 711 FX_DOUBLE dMaxValue = 0.0; | 708 FX_DOUBLE dMaxValue = 0.0; |
| 712 for (int32_t i = 0; i < args.GetLength(); i++) { | 709 for (int32_t i = 0; i < args.GetLength(); i++) { |
| 713 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); | 710 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); |
| 714 if (FXJSE_Value_IsNull(argValue.get())) | 711 if (FXJSE_Value_IsNull(argValue.get())) |
| 715 continue; | 712 continue; |
| 716 | 713 |
| 717 if (FXJSE_Value_IsArray(argValue.get())) { | 714 if (FXJSE_Value_IsArray(argValue.get())) { |
| 718 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 715 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 return; | 776 return; |
| 780 } | 777 } |
| 781 | 778 |
| 782 FXJSE_Value_SetDouble(args.GetReturnValue(), dMaxValue); | 779 FXJSE_Value_SetDouble(args.GetReturnValue(), dMaxValue); |
| 783 } | 780 } |
| 784 | 781 |
| 785 // static | 782 // static |
| 786 void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, | 783 void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, |
| 787 const CFX_ByteStringC& szFuncName, | 784 const CFX_ByteStringC& szFuncName, |
| 788 CFXJSE_Arguments& args) { | 785 CFXJSE_Arguments& args) { |
| 789 CXFA_FM2JSContext* pContext = | 786 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 790 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 791 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 787 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 792 uint32_t uCount = 0; | 788 uint32_t uCount = 0; |
| 793 FX_DOUBLE dMinValue = 0.0; | 789 FX_DOUBLE dMinValue = 0.0; |
| 794 for (int32_t i = 0; i < args.GetLength(); i++) { | 790 for (int32_t i = 0; i < args.GetLength(); i++) { |
| 795 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); | 791 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); |
| 796 if (FXJSE_Value_IsNull(argValue.get())) | 792 if (FXJSE_Value_IsNull(argValue.get())) |
| 797 continue; | 793 continue; |
| 798 | 794 |
| 799 if (FXJSE_Value_IsArray(argValue.get())) { | 795 if (FXJSE_Value_IsArray(argValue.get())) { |
| 800 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 796 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 return; | 857 return; |
| 862 } | 858 } |
| 863 | 859 |
| 864 FXJSE_Value_SetDouble(args.GetReturnValue(), dMinValue); | 860 FXJSE_Value_SetDouble(args.GetReturnValue(), dMinValue); |
| 865 } | 861 } |
| 866 | 862 |
| 867 // static | 863 // static |
| 868 void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, | 864 void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, |
| 869 const CFX_ByteStringC& szFuncName, | 865 const CFX_ByteStringC& szFuncName, |
| 870 CFXJSE_Arguments& args) { | 866 CFXJSE_Arguments& args) { |
| 871 CXFA_FM2JSContext* pContext = | 867 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 872 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 873 if (args.GetLength() != 2) { | 868 if (args.GetLength() != 2) { |
| 874 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Mod"); | 869 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Mod"); |
| 875 return; | 870 return; |
| 876 } | 871 } |
| 877 | 872 |
| 878 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 873 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 879 std::unique_ptr<CFXJSE_Value> argTwo = args.GetValue(1); | 874 std::unique_ptr<CFXJSE_Value> argTwo = args.GetValue(1); |
| 880 if (FXJSE_Value_IsNull(argOne.get()) || FXJSE_Value_IsNull(argTwo.get())) { | 875 if (FXJSE_Value_IsNull(argOne.get()) || FXJSE_Value_IsNull(argTwo.get())) { |
| 881 FXJSE_Value_SetNull(args.GetReturnValue()); | 876 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 882 return; | 877 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 897 } | 892 } |
| 898 | 893 |
| 899 FXJSE_Value_SetDouble(args.GetReturnValue(), | 894 FXJSE_Value_SetDouble(args.GetReturnValue(), |
| 900 dDividend - dDivisor * (int32_t)(dDividend / dDivisor)); | 895 dDividend - dDivisor * (int32_t)(dDividend / dDivisor)); |
| 901 } | 896 } |
| 902 | 897 |
| 903 // static | 898 // static |
| 904 void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, | 899 void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, |
| 905 const CFX_ByteStringC& szFuncName, | 900 const CFX_ByteStringC& szFuncName, |
| 906 CFXJSE_Arguments& args) { | 901 CFXJSE_Arguments& args) { |
| 907 CXFA_FM2JSContext* pContext = | 902 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 908 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 909 int32_t argc = args.GetLength(); | 903 int32_t argc = args.GetLength(); |
| 910 if (argc != 1 && argc != 2) { | 904 if (argc != 1 && argc != 2) { |
| 911 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Round"); | 905 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Round"); |
| 912 return; | 906 return; |
| 913 } | 907 } |
| 914 | 908 |
| 915 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 909 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 916 if (FXJSE_Value_IsNull(argOne.get())) { | 910 if (FXJSE_Value_IsNull(argOne.get())) { |
| 917 FXJSE_Value_SetNull(args.GetReturnValue()); | 911 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 918 return; | 912 return; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 // static | 947 // static |
| 954 void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, | 948 void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, |
| 955 const CFX_ByteStringC& szFuncName, | 949 const CFX_ByteStringC& szFuncName, |
| 956 CFXJSE_Arguments& args) { | 950 CFXJSE_Arguments& args) { |
| 957 int32_t argc = args.GetLength(); | 951 int32_t argc = args.GetLength(); |
| 958 if (argc == 0) { | 952 if (argc == 0) { |
| 959 FXJSE_Value_SetNull(args.GetReturnValue()); | 953 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 960 return; | 954 return; |
| 961 } | 955 } |
| 962 | 956 |
| 963 CXFA_FM2JSContext* pContext = | 957 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 964 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 965 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 958 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 966 uint32_t uCount = 0; | 959 uint32_t uCount = 0; |
| 967 FX_DOUBLE dSum = 0.0; | 960 FX_DOUBLE dSum = 0.0; |
| 968 for (int32_t i = 0; i < argc; i++) { | 961 for (int32_t i = 0; i < argc; i++) { |
| 969 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); | 962 std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i); |
| 970 if (FXJSE_Value_IsNull(argValue.get())) | 963 if (FXJSE_Value_IsNull(argValue.get())) |
| 971 continue; | 964 continue; |
| 972 | 965 |
| 973 if (FXJSE_Value_IsArray(argValue.get())) { | 966 if (FXJSE_Value_IsArray(argValue.get())) { |
| 974 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 967 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 } | 1024 } |
| 1032 | 1025 |
| 1033 FXJSE_Value_SetDouble(args.GetReturnValue(), dSum); | 1026 FXJSE_Value_SetDouble(args.GetReturnValue(), dSum); |
| 1034 } | 1027 } |
| 1035 | 1028 |
| 1036 // static | 1029 // static |
| 1037 void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, | 1030 void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, |
| 1038 const CFX_ByteStringC& szFuncName, | 1031 const CFX_ByteStringC& szFuncName, |
| 1039 CFXJSE_Arguments& args) { | 1032 CFXJSE_Arguments& args) { |
| 1040 if (args.GetLength() != 0) { | 1033 if (args.GetLength() != 0) { |
| 1041 CXFA_FM2JSContext* pContext = | 1034 ToJSContext(pThis, nullptr) |
| 1042 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1035 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date"); |
| 1043 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date"); | |
| 1044 return; | 1036 return; |
| 1045 } | 1037 } |
| 1046 | 1038 |
| 1047 time_t currentTime; | 1039 time_t currentTime; |
| 1048 time(¤tTime); | 1040 time(¤tTime); |
| 1049 struct tm* pTmStruct = gmtime(¤tTime); | 1041 struct tm* pTmStruct = gmtime(¤tTime); |
| 1050 | 1042 |
| 1051 CFX_ByteString bufferYear; | 1043 CFX_ByteString bufferYear; |
| 1052 CFX_ByteString bufferMon; | 1044 CFX_ByteString bufferMon; |
| 1053 CFX_ByteString bufferDay; | 1045 CFX_ByteString bufferDay; |
| 1054 bufferYear.Format("%d", pTmStruct->tm_year + 1900); | 1046 bufferYear.Format("%d", pTmStruct->tm_year + 1900); |
| 1055 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); | 1047 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); |
| 1056 bufferDay.Format("%02d", pTmStruct->tm_mday); | 1048 bufferDay.Format("%02d", pTmStruct->tm_mday); |
| 1057 | 1049 |
| 1058 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; | 1050 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; |
| 1059 FXJSE_Value_SetInteger(args.GetReturnValue(), | 1051 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 1060 DateString2Num(bufferCurrent.AsStringC())); | 1052 DateString2Num(bufferCurrent.AsStringC())); |
| 1061 } | 1053 } |
| 1062 | 1054 |
| 1063 // static | 1055 // static |
| 1064 void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, | 1056 void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, |
| 1065 const CFX_ByteStringC& szFuncName, | 1057 const CFX_ByteStringC& szFuncName, |
| 1066 CFXJSE_Arguments& args) { | 1058 CFXJSE_Arguments& args) { |
| 1067 int32_t argc = args.GetLength(); | 1059 int32_t argc = args.GetLength(); |
| 1068 if (argc <= 0 || argc >= 4) { | 1060 if (argc <= 0 || argc >= 4) { |
| 1069 CXFA_FM2JSContext* pContext = | 1061 ToJSContext(pThis, nullptr) |
| 1070 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1062 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); |
| 1071 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); | |
| 1072 return; | 1063 return; |
| 1073 } | 1064 } |
| 1074 | 1065 |
| 1075 std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, args, 0); | 1066 std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, args, 0); |
| 1076 if (ValueIsNull(pThis, dateValue.get())) { | 1067 if (ValueIsNull(pThis, dateValue.get())) { |
| 1077 FXJSE_Value_SetNull(args.GetReturnValue()); | 1068 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1078 return; | 1069 return; |
| 1079 } | 1070 } |
| 1080 | 1071 |
| 1081 CFX_ByteString dateString; | 1072 CFX_ByteString dateString; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1111 FXJSE_Value_SetInteger(args.GetReturnValue(), | 1102 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 1112 DateString2Num(szIsoDateString.AsStringC())); | 1103 DateString2Num(szIsoDateString.AsStringC())); |
| 1113 } | 1104 } |
| 1114 | 1105 |
| 1115 // static | 1106 // static |
| 1116 void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, | 1107 void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, |
| 1117 const CFX_ByteStringC& szFuncName, | 1108 const CFX_ByteStringC& szFuncName, |
| 1118 CFXJSE_Arguments& args) { | 1109 CFXJSE_Arguments& args) { |
| 1119 int32_t argc = args.GetLength(); | 1110 int32_t argc = args.GetLength(); |
| 1120 if (argc >= 3) { | 1111 if (argc >= 3) { |
| 1121 CXFA_FM2JSContext* pContext = | 1112 ToJSContext(pThis, nullptr) |
| 1122 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1113 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); |
| 1123 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); | |
| 1124 return; | 1114 return; |
| 1125 } | 1115 } |
| 1126 | 1116 |
| 1127 int32_t iStyle = 0; | 1117 int32_t iStyle = 0; |
| 1128 if (argc > 0) { | 1118 if (argc > 0) { |
| 1129 std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0); | 1119 std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0); |
| 1130 if (FXJSE_Value_IsNull(argStyle.get())) { | 1120 if (FXJSE_Value_IsNull(argStyle.get())) { |
| 1131 FXJSE_Value_SetNull(args.GetReturnValue()); | 1121 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1132 return; | 1122 return; |
| 1133 } | 1123 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1150 CFX_ByteString formatStr; | 1140 CFX_ByteString formatStr; |
| 1151 GetStandardDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr); | 1141 GetStandardDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr); |
| 1152 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); | 1142 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1153 } | 1143 } |
| 1154 | 1144 |
| 1155 // static | 1145 // static |
| 1156 void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, | 1146 void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, |
| 1157 const CFX_ByteStringC& szFuncName, | 1147 const CFX_ByteStringC& szFuncName, |
| 1158 CFXJSE_Arguments& args) { | 1148 CFXJSE_Arguments& args) { |
| 1159 if (args.GetLength() != 1) { | 1149 if (args.GetLength() != 1) { |
| 1160 CXFA_FM2JSContext* pContext = | 1150 ToJSContext(pThis, nullptr) |
| 1161 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1151 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"IsoDate2Num"); |
| 1162 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | |
| 1163 L"IsoDate2Num"); | |
| 1164 return; | 1152 return; |
| 1165 } | 1153 } |
| 1166 | 1154 |
| 1167 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 1155 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 1168 if (FXJSE_Value_IsNull(argOne.get())) { | 1156 if (FXJSE_Value_IsNull(argOne.get())) { |
| 1169 FXJSE_Value_SetNull(args.GetReturnValue()); | 1157 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1170 return; | 1158 return; |
| 1171 } | 1159 } |
| 1172 | 1160 |
| 1173 CFX_ByteString szArgString; | 1161 CFX_ByteString szArgString; |
| 1174 ValueToUTF8String(argOne.get(), szArgString); | 1162 ValueToUTF8String(argOne.get(), szArgString); |
| 1175 FXJSE_Value_SetInteger(args.GetReturnValue(), | 1163 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 1176 DateString2Num(szArgString.AsStringC())); | 1164 DateString2Num(szArgString.AsStringC())); |
| 1177 } | 1165 } |
| 1178 | 1166 |
| 1179 // static | 1167 // static |
| 1180 void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, | 1168 void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, |
| 1181 const CFX_ByteStringC& szFuncName, | 1169 const CFX_ByteStringC& szFuncName, |
| 1182 CFXJSE_Arguments& args) { | 1170 CFXJSE_Arguments& args) { |
| 1183 CXFA_FM2JSContext* pContext = | 1171 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 1184 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 1185 if (args.GetLength() != 1) { | 1172 if (args.GetLength() != 1) { |
| 1186 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1173 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 1187 L"IsoTime2Num"); | 1174 L"IsoTime2Num"); |
| 1188 return; | 1175 return; |
| 1189 } | 1176 } |
| 1190 | 1177 |
| 1191 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 1178 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 1192 if (ValueIsNull(pThis, argOne.get())) { | 1179 if (ValueIsNull(pThis, argOne.get())) { |
| 1193 FXJSE_Value_SetNull(args.GetReturnValue()); | 1180 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1194 return; | 1181 return; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 CFX_ByteString formatStr; | 1254 CFX_ByteString formatStr; |
| 1268 GetLocalDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); | 1255 GetLocalDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); |
| 1269 if (formatStr.IsEmpty()) { | 1256 if (formatStr.IsEmpty()) { |
| 1270 formatStr = ""; | 1257 formatStr = ""; |
| 1271 } | 1258 } |
| 1272 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); | 1259 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1273 } else { | 1260 } else { |
| 1274 FXJSE_Value_SetNull(args.GetReturnValue()); | 1261 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1275 } | 1262 } |
| 1276 } else { | 1263 } else { |
| 1277 CXFA_FM2JSContext* pContext = | 1264 ToJSContext(pThis, nullptr) |
| 1278 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1265 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"LocalDateFmt"); |
| 1279 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | |
| 1280 L"LocalDateFmt"); | |
| 1281 } | 1266 } |
| 1282 } | 1267 } |
| 1283 | 1268 |
| 1284 // static | 1269 // static |
| 1285 void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, | 1270 void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, |
| 1286 const CFX_ByteStringC& szFuncName, | 1271 const CFX_ByteStringC& szFuncName, |
| 1287 CFXJSE_Arguments& args) { | 1272 CFXJSE_Arguments& args) { |
| 1288 int32_t argc = args.GetLength(); | 1273 int32_t argc = args.GetLength(); |
| 1289 if (argc < 3) { | 1274 if (argc < 3) { |
| 1290 FX_BOOL bFlags = FALSE; | 1275 FX_BOOL bFlags = FALSE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1312 CFX_ByteString formatStr; | 1297 CFX_ByteString formatStr; |
| 1313 GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); | 1298 GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); |
| 1314 if (formatStr.IsEmpty()) { | 1299 if (formatStr.IsEmpty()) { |
| 1315 formatStr = ""; | 1300 formatStr = ""; |
| 1316 } | 1301 } |
| 1317 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); | 1302 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1318 } else { | 1303 } else { |
| 1319 FXJSE_Value_SetNull(args.GetReturnValue()); | 1304 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1320 } | 1305 } |
| 1321 } else { | 1306 } else { |
| 1322 CXFA_FM2JSContext* pContext = | 1307 ToJSContext(pThis, nullptr) |
| 1323 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1308 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"LocalTimeFmt"); |
| 1324 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | |
| 1325 L"LocalTimeFmt"); | |
| 1326 } | 1309 } |
| 1327 } | 1310 } |
| 1328 | 1311 |
| 1329 // static | 1312 // static |
| 1330 void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, | 1313 void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, |
| 1331 const CFX_ByteStringC& szFuncName, | 1314 const CFX_ByteStringC& szFuncName, |
| 1332 CFXJSE_Arguments& args) { | 1315 CFXJSE_Arguments& args) { |
| 1333 int32_t argc = args.GetLength(); | 1316 int32_t argc = args.GetLength(); |
| 1334 if ((argc > 0) && (argc < 4)) { | 1317 if ((argc > 0) && (argc < 4)) { |
| 1335 FX_BOOL bFlags = FALSE; | 1318 FX_BOOL bFlags = FALSE; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 szLocalDateString); | 1444 szLocalDateString); |
| 1462 if (szLocalDateString.IsEmpty()) { | 1445 if (szLocalDateString.IsEmpty()) { |
| 1463 szLocalDateString = ""; | 1446 szLocalDateString = ""; |
| 1464 } | 1447 } |
| 1465 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1448 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1466 szLocalDateString.AsStringC()); | 1449 szLocalDateString.AsStringC()); |
| 1467 } else { | 1450 } else { |
| 1468 FXJSE_Value_SetNull(args.GetReturnValue()); | 1451 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1469 } | 1452 } |
| 1470 } else { | 1453 } else { |
| 1471 CXFA_FM2JSContext* pContext = | 1454 ToJSContext(pThis, nullptr) |
| 1472 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1455 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Date"); |
| 1473 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Date"); | |
| 1474 } | 1456 } |
| 1475 } | 1457 } |
| 1476 | 1458 |
| 1477 // static | 1459 // static |
| 1478 void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, | 1460 void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, |
| 1479 const CFX_ByteStringC& szFuncName, | 1461 const CFX_ByteStringC& szFuncName, |
| 1480 CFXJSE_Arguments& args) { | 1462 CFXJSE_Arguments& args) { |
| 1481 int32_t argc = args.GetLength(); | 1463 int32_t argc = args.GetLength(); |
| 1482 if ((argc > 0) && (argc < 4)) { | 1464 if ((argc > 0) && (argc < 4)) { |
| 1483 FX_BOOL bFlags = FALSE; | 1465 FX_BOOL bFlags = FALSE; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 localString.AsStringC(), TRUE, szGMTTimeString); | 1498 localString.AsStringC(), TRUE, szGMTTimeString); |
| 1517 if (szGMTTimeString.IsEmpty()) { | 1499 if (szGMTTimeString.IsEmpty()) { |
| 1518 szGMTTimeString = ""; | 1500 szGMTTimeString = ""; |
| 1519 } | 1501 } |
| 1520 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1502 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1521 szGMTTimeString.AsStringC()); | 1503 szGMTTimeString.AsStringC()); |
| 1522 } else { | 1504 } else { |
| 1523 FXJSE_Value_SetNull(args.GetReturnValue()); | 1505 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1524 } | 1506 } |
| 1525 } else { | 1507 } else { |
| 1526 CXFA_FM2JSContext* pContext = | 1508 ToJSContext(pThis, nullptr) |
| 1527 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1509 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2GMTime"); |
| 1528 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2GMTime"); | |
| 1529 } | 1510 } |
| 1530 } | 1511 } |
| 1531 | 1512 |
| 1532 // static | 1513 // static |
| 1533 void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, | 1514 void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, |
| 1534 const CFX_ByteStringC& szFuncName, | 1515 const CFX_ByteStringC& szFuncName, |
| 1535 CFXJSE_Arguments& args) { | 1516 CFXJSE_Arguments& args) { |
| 1536 int32_t argc = args.GetLength(); | 1517 int32_t argc = args.GetLength(); |
| 1537 if ((argc > 0) && (argc < 4)) { | 1518 if ((argc > 0) && (argc < 4)) { |
| 1538 FX_BOOL bFlags = FALSE; | 1519 FX_BOOL bFlags = FALSE; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 localString.AsStringC(), FALSE, szLocalTimeString); | 1552 localString.AsStringC(), FALSE, szLocalTimeString); |
| 1572 if (szLocalTimeString.IsEmpty()) { | 1553 if (szLocalTimeString.IsEmpty()) { |
| 1573 szLocalTimeString = ""; | 1554 szLocalTimeString = ""; |
| 1574 } | 1555 } |
| 1575 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1556 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1576 szLocalTimeString.AsStringC()); | 1557 szLocalTimeString.AsStringC()); |
| 1577 } else { | 1558 } else { |
| 1578 FXJSE_Value_SetNull(args.GetReturnValue()); | 1559 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1579 } | 1560 } |
| 1580 } else { | 1561 } else { |
| 1581 CXFA_FM2JSContext* pContext = | 1562 ToJSContext(pThis, nullptr) |
| 1582 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1563 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Time"); |
| 1583 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Time"); | |
| 1584 } | 1564 } |
| 1585 } | 1565 } |
| 1586 | 1566 |
| 1587 // static | 1567 // static |
| 1588 void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, | 1568 void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, |
| 1589 const CFX_ByteStringC& szFuncName, | 1569 const CFX_ByteStringC& szFuncName, |
| 1590 CFXJSE_Arguments& args) { | 1570 CFXJSE_Arguments& args) { |
| 1591 if (args.GetLength() == 0) { | 1571 if (args.GetLength() == 0) { |
| 1592 time_t now; | 1572 time_t now; |
| 1593 time(&now); | 1573 time(&now); |
| 1594 struct tm* pGmt = gmtime(&now); | 1574 struct tm* pGmt = gmtime(&now); |
| 1595 int32_t iGMHour = pGmt->tm_hour; | 1575 int32_t iGMHour = pGmt->tm_hour; |
| 1596 int32_t iGMMin = pGmt->tm_min; | 1576 int32_t iGMMin = pGmt->tm_min; |
| 1597 int32_t iGMSec = pGmt->tm_sec; | 1577 int32_t iGMSec = pGmt->tm_sec; |
| 1598 FXJSE_Value_SetInteger(args.GetReturnValue(), | 1578 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 1599 ((iGMHour * 3600 + iGMMin * 60 + iGMSec) * 1000)); | 1579 ((iGMHour * 3600 + iGMMin * 60 + iGMSec) * 1000)); |
| 1600 } else { | 1580 } else { |
| 1601 CXFA_FM2JSContext* pContext = | 1581 ToJSContext(pThis, nullptr) |
| 1602 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1582 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time"); |
| 1603 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time"); | |
| 1604 } | 1583 } |
| 1605 } | 1584 } |
| 1606 | 1585 |
| 1607 // static | 1586 // static |
| 1608 void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, | 1587 void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, |
| 1609 const CFX_ByteStringC& szFuncName, | 1588 const CFX_ByteStringC& szFuncName, |
| 1610 CFXJSE_Arguments& args) { | 1589 CFXJSE_Arguments& args) { |
| 1611 int32_t argc = args.GetLength(); | 1590 int32_t argc = args.GetLength(); |
| 1612 if ((argc > 0) && (argc < 4)) { | 1591 if ((argc > 0) && (argc < 4)) { |
| 1613 FX_BOOL bFlags = FALSE; | 1592 FX_BOOL bFlags = FALSE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1631 } | 1610 } |
| 1632 if (argc == 3) { | 1611 if (argc == 3) { |
| 1633 std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); | 1612 std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); |
| 1634 if (ValueIsNull(pThis, localValue.get())) { | 1613 if (ValueIsNull(pThis, localValue.get())) { |
| 1635 bFlags = TRUE; | 1614 bFlags = TRUE; |
| 1636 } else { | 1615 } else { |
| 1637 ValueToUTF8String(localValue.get(), localString); | 1616 ValueToUTF8String(localValue.get(), localString); |
| 1638 } | 1617 } |
| 1639 } | 1618 } |
| 1640 if (!bFlags) { | 1619 if (!bFlags) { |
| 1641 CXFA_FM2JSContext* pContext = | 1620 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 1642 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 1643 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 1644 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1621 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 1645 IFX_Locale* pLocale = nullptr; | 1622 IFX_Locale* pLocale = nullptr; |
| 1646 if (localString.IsEmpty()) { | 1623 if (localString.IsEmpty()) { |
| 1647 CXFA_Node* pThisNode = | 1624 CXFA_Node* pThisNode = |
| 1648 ToNode(pDoc->GetScriptContext()->GetThisObject()); | 1625 ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 1649 ASSERT(pThisNode); | 1626 ASSERT(pThisNode); |
| 1650 CXFA_WidgetData widgetData(pThisNode); | 1627 CXFA_WidgetData widgetData(pThisNode); |
| 1651 pLocale = widgetData.GetLocal(); | 1628 pLocale = widgetData.GetLocal(); |
| 1652 } else { | 1629 } else { |
| 1653 pLocale = pMgr->GetLocaleByName( | 1630 pLocale = pMgr->GetLocaleByName( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 int32_t iResult = | 1665 int32_t iResult = |
| 1689 hour * 3600000 + min * 60000 + second * 1000 + milSecond + 1; | 1666 hour * 3600000 + min * 60000 + second * 1000 + milSecond + 1; |
| 1690 FXJSE_Value_SetInteger(args.GetReturnValue(), iResult); | 1667 FXJSE_Value_SetInteger(args.GetReturnValue(), iResult); |
| 1691 } else { | 1668 } else { |
| 1692 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 1669 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 1693 } | 1670 } |
| 1694 } else { | 1671 } else { |
| 1695 FXJSE_Value_SetNull(args.GetReturnValue()); | 1672 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1696 } | 1673 } |
| 1697 } else { | 1674 } else { |
| 1698 CXFA_FM2JSContext* pContext = | 1675 ToJSContext(pThis, nullptr) |
| 1699 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1676 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time2Num"); |
| 1700 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time2Num"); | |
| 1701 } | 1677 } |
| 1702 } | 1678 } |
| 1703 | 1679 |
| 1704 // static | 1680 // static |
| 1705 void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, | 1681 void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, |
| 1706 const CFX_ByteStringC& szFuncName, | 1682 const CFX_ByteStringC& szFuncName, |
| 1707 CFXJSE_Arguments& args) { | 1683 CFXJSE_Arguments& args) { |
| 1708 int32_t argc = args.GetLength(); | 1684 int32_t argc = args.GetLength(); |
| 1709 if (argc < 3) { | 1685 if (argc < 3) { |
| 1710 FX_BOOL bFlags = FALSE; | 1686 FX_BOOL bFlags = FALSE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1732 CFX_ByteString formatStr; | 1708 CFX_ByteString formatStr; |
| 1733 GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr); | 1709 GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr); |
| 1734 if (formatStr.IsEmpty()) { | 1710 if (formatStr.IsEmpty()) { |
| 1735 formatStr = ""; | 1711 formatStr = ""; |
| 1736 } | 1712 } |
| 1737 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); | 1713 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1738 } else { | 1714 } else { |
| 1739 FXJSE_Value_SetNull(args.GetReturnValue()); | 1715 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1740 } | 1716 } |
| 1741 } else { | 1717 } else { |
| 1742 CXFA_FM2JSContext* pContext = | 1718 ToJSContext(pThis, nullptr) |
| 1743 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 1719 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"TimeFmt"); |
| 1744 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"TimeFmt"); | |
| 1745 } | 1720 } |
| 1746 } | 1721 } |
| 1747 | 1722 |
| 1748 // static | 1723 // static |
| 1749 FX_BOOL CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, | 1724 FX_BOOL CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, |
| 1750 int32_t iLength, | 1725 int32_t iLength, |
| 1751 int32_t& iStyle, | 1726 int32_t& iStyle, |
| 1752 int32_t& iYear, | 1727 int32_t& iYear, |
| 1753 int32_t& iMonth, | 1728 int32_t& iMonth, |
| 1754 int32_t& iDay) { | 1729 int32_t& iDay) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 iRet = TRUE; | 2044 iRet = TRUE; |
| 2070 return iRet; | 2045 return iRet; |
| 2071 } | 2046 } |
| 2072 | 2047 |
| 2073 // static | 2048 // static |
| 2074 FX_BOOL CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis, | 2049 FX_BOOL CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis, |
| 2075 const CFX_ByteStringC& szDate, | 2050 const CFX_ByteStringC& szDate, |
| 2076 const CFX_ByteStringC& szFormat, | 2051 const CFX_ByteStringC& szFormat, |
| 2077 const CFX_ByteStringC& szLocale, | 2052 const CFX_ByteStringC& szLocale, |
| 2078 CFX_ByteString& strIsoDate) { | 2053 CFX_ByteString& strIsoDate) { |
| 2079 CXFA_FM2JSContext* pContext = | 2054 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 2080 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2081 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 2082 if (!pDoc) { | 2055 if (!pDoc) { |
| 2083 return FALSE; | 2056 return FALSE; |
| 2084 } | 2057 } |
| 2085 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2058 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2086 IFX_Locale* pLocale = nullptr; | 2059 IFX_Locale* pLocale = nullptr; |
| 2087 if (szLocale.IsEmpty()) { | 2060 if (szLocale.IsEmpty()) { |
| 2088 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2061 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2089 ASSERT(pThisNode); | 2062 ASSERT(pThisNode); |
| 2090 CXFA_WidgetData widgetData(pThisNode); | 2063 CXFA_WidgetData widgetData(pThisNode); |
| 2091 pLocale = widgetData.GetLocal(); | 2064 pLocale = widgetData.GetLocal(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2107 strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay()); | 2080 strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay()); |
| 2108 return TRUE; | 2081 return TRUE; |
| 2109 } | 2082 } |
| 2110 | 2083 |
| 2111 // static | 2084 // static |
| 2112 FX_BOOL CXFA_FM2JSContext::Local2IsoTime(CFXJSE_Value* pThis, | 2085 FX_BOOL CXFA_FM2JSContext::Local2IsoTime(CFXJSE_Value* pThis, |
| 2113 const CFX_ByteStringC& szTime, | 2086 const CFX_ByteStringC& szTime, |
| 2114 const CFX_ByteStringC& szFormat, | 2087 const CFX_ByteStringC& szFormat, |
| 2115 const CFX_ByteStringC& szLocale, | 2088 const CFX_ByteStringC& szLocale, |
| 2116 CFX_ByteString& strIsoTime) { | 2089 CFX_ByteString& strIsoTime) { |
| 2117 CXFA_FM2JSContext* pContext = | 2090 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 2118 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2119 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 2120 if (!pDoc) { | 2091 if (!pDoc) { |
| 2121 return FALSE; | 2092 return FALSE; |
| 2122 } | 2093 } |
| 2123 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2094 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2124 IFX_Locale* pLocale = nullptr; | 2095 IFX_Locale* pLocale = nullptr; |
| 2125 if (szLocale.IsEmpty()) { | 2096 if (szLocale.IsEmpty()) { |
| 2126 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2097 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2127 ASSERT(pThisNode); | 2098 ASSERT(pThisNode); |
| 2128 CXFA_WidgetData widgetData(pThisNode); | 2099 CXFA_WidgetData widgetData(pThisNode); |
| 2129 pLocale = widgetData.GetLocal(); | 2100 pLocale = widgetData.GetLocal(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2148 utime.GetSecond(), utime.GetMillisecond()); | 2119 utime.GetSecond(), utime.GetMillisecond()); |
| 2149 return TRUE; | 2120 return TRUE; |
| 2150 } | 2121 } |
| 2151 | 2122 |
| 2152 // static | 2123 // static |
| 2153 FX_BOOL CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis, | 2124 FX_BOOL CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis, |
| 2154 const CFX_ByteStringC& szDate, | 2125 const CFX_ByteStringC& szDate, |
| 2155 const CFX_ByteStringC& szFormat, | 2126 const CFX_ByteStringC& szFormat, |
| 2156 const CFX_ByteStringC& szLocale, | 2127 const CFX_ByteStringC& szLocale, |
| 2157 CFX_ByteString& strLocalDate) { | 2128 CFX_ByteString& strLocalDate) { |
| 2158 CXFA_FM2JSContext* pContext = | 2129 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 2159 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2160 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 2161 if (!pDoc) { | 2130 if (!pDoc) { |
| 2162 return FALSE; | 2131 return FALSE; |
| 2163 } | 2132 } |
| 2164 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2133 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2165 IFX_Locale* pLocale = nullptr; | 2134 IFX_Locale* pLocale = nullptr; |
| 2166 if (szLocale.IsEmpty()) { | 2135 if (szLocale.IsEmpty()) { |
| 2167 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2136 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2168 ASSERT(pThisNode); | 2137 ASSERT(pThisNode); |
| 2169 CXFA_WidgetData widgetData(pThisNode); | 2138 CXFA_WidgetData widgetData(pThisNode); |
| 2170 pLocale = widgetData.GetLocal(); | 2139 pLocale = widgetData.GetLocal(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2188 strLocalDate = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); | 2157 strLocalDate = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); |
| 2189 return TRUE; | 2158 return TRUE; |
| 2190 } | 2159 } |
| 2191 | 2160 |
| 2192 // static | 2161 // static |
| 2193 FX_BOOL CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis, | 2162 FX_BOOL CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis, |
| 2194 const CFX_ByteStringC& szTime, | 2163 const CFX_ByteStringC& szTime, |
| 2195 const CFX_ByteStringC& szFormat, | 2164 const CFX_ByteStringC& szFormat, |
| 2196 const CFX_ByteStringC& szLocale, | 2165 const CFX_ByteStringC& szLocale, |
| 2197 CFX_ByteString& strLocalTime) { | 2166 CFX_ByteString& strLocalTime) { |
| 2198 CXFA_FM2JSContext* pContext = | 2167 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 2199 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2200 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 2201 if (!pDoc) { | 2168 if (!pDoc) { |
| 2202 return FALSE; | 2169 return FALSE; |
| 2203 } | 2170 } |
| 2204 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2171 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2205 IFX_Locale* pLocale = nullptr; | 2172 IFX_Locale* pLocale = nullptr; |
| 2206 if (szLocale.IsEmpty()) { | 2173 if (szLocale.IsEmpty()) { |
| 2207 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2174 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2208 ASSERT(pThisNode); | 2175 ASSERT(pThisNode); |
| 2209 CXFA_WidgetData widgetData(pThisNode); | 2176 CXFA_WidgetData widgetData(pThisNode); |
| 2210 pLocale = widgetData.GetLocal(); | 2177 pLocale = widgetData.GetLocal(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2230 strLocalTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); | 2197 strLocalTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); |
| 2231 return TRUE; | 2198 return TRUE; |
| 2232 } | 2199 } |
| 2233 | 2200 |
| 2234 // static | 2201 // static |
| 2235 FX_BOOL CXFA_FM2JSContext::GetGMTTime(CFXJSE_Value* pThis, | 2202 FX_BOOL CXFA_FM2JSContext::GetGMTTime(CFXJSE_Value* pThis, |
| 2236 const CFX_ByteStringC& szTime, | 2203 const CFX_ByteStringC& szTime, |
| 2237 const CFX_ByteStringC& szFormat, | 2204 const CFX_ByteStringC& szFormat, |
| 2238 const CFX_ByteStringC& szLocale, | 2205 const CFX_ByteStringC& szLocale, |
| 2239 CFX_ByteString& strGMTTime) { | 2206 CFX_ByteString& strGMTTime) { |
| 2240 CXFA_FM2JSContext* pContext = | 2207 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 2241 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2242 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 2243 if (!pDoc) { | 2208 if (!pDoc) { |
| 2244 return FALSE; | 2209 return FALSE; |
| 2245 } | 2210 } |
| 2246 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2211 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2247 IFX_Locale* pLocale = nullptr; | 2212 IFX_Locale* pLocale = nullptr; |
| 2248 if (szLocale.IsEmpty()) { | 2213 if (szLocale.IsEmpty()) { |
| 2249 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2214 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2250 ASSERT(pThisNode); | 2215 ASSERT(pThisNode); |
| 2251 CXFA_WidgetData widgetData(pThisNode); | 2216 CXFA_WidgetData widgetData(pThisNode); |
| 2252 pLocale = widgetData.GetLocal(); | 2217 pLocale = widgetData.GetLocal(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2367 case 3: | 2332 case 3: |
| 2368 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; | 2333 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; |
| 2369 break; | 2334 break; |
| 2370 case 4: | 2335 case 4: |
| 2371 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; | 2336 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; |
| 2372 break; | 2337 break; |
| 2373 default: | 2338 default: |
| 2374 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; | 2339 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; |
| 2375 break; | 2340 break; |
| 2376 } | 2341 } |
| 2377 CXFA_FM2JSContext* pContext = | 2342 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 2378 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2379 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 2380 if (!pDoc) { | 2343 if (!pDoc) { |
| 2381 return; | 2344 return; |
| 2382 } | 2345 } |
| 2383 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2346 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2384 IFX_Locale* pLocale = nullptr; | 2347 IFX_Locale* pLocale = nullptr; |
| 2385 if (szLocalStr.IsEmpty()) { | 2348 if (szLocalStr.IsEmpty()) { |
| 2386 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2349 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2387 ASSERT(pThisNode); | 2350 ASSERT(pThisNode); |
| 2388 CXFA_WidgetData widgetData(pThisNode); | 2351 CXFA_WidgetData widgetData(pThisNode); |
| 2389 pLocale = widgetData.GetLocal(); | 2352 pLocale = widgetData.GetLocal(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 case 3: | 2386 case 3: |
| 2424 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; | 2387 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; |
| 2425 break; | 2388 break; |
| 2426 case 4: | 2389 case 4: |
| 2427 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; | 2390 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; |
| 2428 break; | 2391 break; |
| 2429 default: | 2392 default: |
| 2430 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; | 2393 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; |
| 2431 break; | 2394 break; |
| 2432 } | 2395 } |
| 2433 CXFA_FM2JSContext* pContext = | 2396 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 2434 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2435 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 2436 if (!pDoc) { | 2397 if (!pDoc) { |
| 2437 return; | 2398 return; |
| 2438 } | 2399 } |
| 2439 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2400 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2440 IFX_Locale* pLocale = nullptr; | 2401 IFX_Locale* pLocale = nullptr; |
| 2441 if (szLocalStr.IsEmpty()) { | 2402 if (szLocalStr.IsEmpty()) { |
| 2442 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2403 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2443 ASSERT(pThisNode); | 2404 ASSERT(pThisNode); |
| 2444 CXFA_WidgetData widgetData(pThisNode); | 2405 CXFA_WidgetData widgetData(pThisNode); |
| 2445 pLocale = widgetData.GetLocal(); | 2406 pLocale = widgetData.GetLocal(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2528 int32_t iLocalSec = pLocal->tm_sec; | 2489 int32_t iLocalSec = pLocal->tm_sec; |
| 2529 iHour = iLocalHour - iGMHour; | 2490 iHour = iLocalHour - iGMHour; |
| 2530 iMin = iLocalMin - iGMMin; | 2491 iMin = iLocalMin - iGMMin; |
| 2531 iSec = iLocalSec - iGMSec; | 2492 iSec = iLocalSec - iGMSec; |
| 2532 } | 2493 } |
| 2533 | 2494 |
| 2534 // static | 2495 // static |
| 2535 void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, | 2496 void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, |
| 2536 const CFX_ByteStringC& szFuncName, | 2497 const CFX_ByteStringC& szFuncName, |
| 2537 CFXJSE_Arguments& args) { | 2498 CFXJSE_Arguments& args) { |
| 2538 CXFA_FM2JSContext* pContext = | 2499 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2539 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2540 if (args.GetLength() == 3) { | 2500 if (args.GetLength() == 3) { |
| 2541 FX_BOOL bFlags = FALSE; | 2501 FX_BOOL bFlags = FALSE; |
| 2542 FX_DOUBLE nPrincipal = 0; | 2502 FX_DOUBLE nPrincipal = 0; |
| 2543 FX_DOUBLE nPayment = 0; | 2503 FX_DOUBLE nPayment = 0; |
| 2544 FX_DOUBLE nPeriods = 0; | 2504 FX_DOUBLE nPeriods = 0; |
| 2545 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2505 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2546 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2506 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2547 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2507 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| 2548 bFlags = | 2508 bFlags = |
| 2549 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || | 2509 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 } | 2552 } |
| 2593 } else { | 2553 } else { |
| 2594 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Apr"); | 2554 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Apr"); |
| 2595 } | 2555 } |
| 2596 } | 2556 } |
| 2597 | 2557 |
| 2598 // static | 2558 // static |
| 2599 void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, | 2559 void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, |
| 2600 const CFX_ByteStringC& szFuncName, | 2560 const CFX_ByteStringC& szFuncName, |
| 2601 CFXJSE_Arguments& args) { | 2561 CFXJSE_Arguments& args) { |
| 2602 CXFA_FM2JSContext* pContext = | 2562 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2603 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2604 if (args.GetLength() == 3) { | 2563 if (args.GetLength() == 3) { |
| 2605 FX_BOOL bFlags = FALSE; | 2564 FX_BOOL bFlags = FALSE; |
| 2606 FX_FLOAT nRate = 0; | 2565 FX_FLOAT nRate = 0; |
| 2607 FX_FLOAT nFutureValue = 0; | 2566 FX_FLOAT nFutureValue = 0; |
| 2608 FX_FLOAT nInitAmount = 0; | 2567 FX_FLOAT nInitAmount = 0; |
| 2609 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2568 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2610 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2569 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2611 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2570 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| 2612 bFlags = | 2571 bFlags = |
| 2613 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || | 2572 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2629 } | 2588 } |
| 2630 } else { | 2589 } else { |
| 2631 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"CTerm"); | 2590 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"CTerm"); |
| 2632 } | 2591 } |
| 2633 } | 2592 } |
| 2634 | 2593 |
| 2635 // static | 2594 // static |
| 2636 void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, | 2595 void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, |
| 2637 const CFX_ByteStringC& szFuncName, | 2596 const CFX_ByteStringC& szFuncName, |
| 2638 CFXJSE_Arguments& args) { | 2597 CFXJSE_Arguments& args) { |
| 2639 CXFA_FM2JSContext* pContext = | 2598 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2640 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2641 if (args.GetLength() == 3) { | 2599 if (args.GetLength() == 3) { |
| 2642 FX_BOOL bFlags = FALSE; | 2600 FX_BOOL bFlags = FALSE; |
| 2643 FX_DOUBLE nAmount = 0; | 2601 FX_DOUBLE nAmount = 0; |
| 2644 FX_DOUBLE nRate = 0; | 2602 FX_DOUBLE nRate = 0; |
| 2645 FX_DOUBLE nPeriod = 0; | 2603 FX_DOUBLE nPeriod = 0; |
| 2646 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2604 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2647 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2605 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2648 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2606 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| 2649 bFlags = | 2607 bFlags = |
| 2650 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || | 2608 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2674 } | 2632 } |
| 2675 } else { | 2633 } else { |
| 2676 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"FV"); | 2634 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"FV"); |
| 2677 } | 2635 } |
| 2678 } | 2636 } |
| 2679 | 2637 |
| 2680 // static | 2638 // static |
| 2681 void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, | 2639 void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, |
| 2682 const CFX_ByteStringC& szFuncName, | 2640 const CFX_ByteStringC& szFuncName, |
| 2683 CFXJSE_Arguments& args) { | 2641 CFXJSE_Arguments& args) { |
| 2684 CXFA_FM2JSContext* pContext = | 2642 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2685 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2686 if (args.GetLength() == 5) { | 2643 if (args.GetLength() == 5) { |
| 2687 FX_BOOL bFlags = FALSE; | 2644 FX_BOOL bFlags = FALSE; |
| 2688 FX_FLOAT nPrincpalAmount = 0; | 2645 FX_FLOAT nPrincpalAmount = 0; |
| 2689 FX_FLOAT nRate = 0; | 2646 FX_FLOAT nRate = 0; |
| 2690 FX_FLOAT nPayment = 0; | 2647 FX_FLOAT nPayment = 0; |
| 2691 FX_FLOAT nFirstMonth = 0; | 2648 FX_FLOAT nFirstMonth = 0; |
| 2692 FX_FLOAT nNumberOfMonths = 0; | 2649 FX_FLOAT nNumberOfMonths = 0; |
| 2693 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2650 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2694 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2651 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2695 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2652 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 } | 2702 } |
| 2746 } else { | 2703 } else { |
| 2747 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"IPmt"); | 2704 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"IPmt"); |
| 2748 } | 2705 } |
| 2749 } | 2706 } |
| 2750 | 2707 |
| 2751 // static | 2708 // static |
| 2752 void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, | 2709 void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, |
| 2753 const CFX_ByteStringC& szFuncName, | 2710 const CFX_ByteStringC& szFuncName, |
| 2754 CFXJSE_Arguments& args) { | 2711 CFXJSE_Arguments& args) { |
| 2755 CXFA_FM2JSContext* pContext = | 2712 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2756 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2757 int32_t argc = args.GetLength(); | 2713 int32_t argc = args.GetLength(); |
| 2758 if (argc > 2) { | 2714 if (argc > 2) { |
| 2759 FX_BOOL bFlags = FALSE; | 2715 FX_BOOL bFlags = FALSE; |
| 2760 std::vector<std::unique_ptr<CFXJSE_Value>> argValues; | 2716 std::vector<std::unique_ptr<CFXJSE_Value>> argValues; |
| 2761 for (int32_t i = 0; i < argc; i++) { | 2717 for (int32_t i = 0; i < argc; i++) { |
| 2762 argValues.push_back(GetSimpleValue(pThis, args, i)); | 2718 argValues.push_back(GetSimpleValue(pThis, args, i)); |
| 2763 if (ValueIsNull(pThis, argValues[i].get())) { | 2719 if (ValueIsNull(pThis, argValues[i].get())) { |
| 2764 bFlags = TRUE; | 2720 bFlags = TRUE; |
| 2765 } | 2721 } |
| 2766 } | 2722 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2793 } | 2749 } |
| 2794 } else { | 2750 } else { |
| 2795 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"NPV"); | 2751 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"NPV"); |
| 2796 } | 2752 } |
| 2797 } | 2753 } |
| 2798 | 2754 |
| 2799 // static | 2755 // static |
| 2800 void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, | 2756 void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, |
| 2801 const CFX_ByteStringC& szFuncName, | 2757 const CFX_ByteStringC& szFuncName, |
| 2802 CFXJSE_Arguments& args) { | 2758 CFXJSE_Arguments& args) { |
| 2803 CXFA_FM2JSContext* pContext = | 2759 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2804 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2805 if (args.GetLength() == 3) { | 2760 if (args.GetLength() == 3) { |
| 2806 FX_BOOL bFlags = FALSE; | 2761 FX_BOOL bFlags = FALSE; |
| 2807 FX_FLOAT nPrincipal = 0; | 2762 FX_FLOAT nPrincipal = 0; |
| 2808 FX_FLOAT nRate = 0; | 2763 FX_FLOAT nRate = 0; |
| 2809 FX_FLOAT nPeriods = 0; | 2764 FX_FLOAT nPeriods = 0; |
| 2810 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2765 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2811 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2766 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2812 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2767 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| 2813 bFlags = | 2768 bFlags = |
| 2814 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || | 2769 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2835 } | 2790 } |
| 2836 } else { | 2791 } else { |
| 2837 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Pmt"); | 2792 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Pmt"); |
| 2838 } | 2793 } |
| 2839 } | 2794 } |
| 2840 | 2795 |
| 2841 // static | 2796 // static |
| 2842 void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, | 2797 void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, |
| 2843 const CFX_ByteStringC& szFuncName, | 2798 const CFX_ByteStringC& szFuncName, |
| 2844 CFXJSE_Arguments& args) { | 2799 CFXJSE_Arguments& args) { |
| 2845 CXFA_FM2JSContext* pContext = | 2800 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2846 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2847 if (args.GetLength() == 5) { | 2801 if (args.GetLength() == 5) { |
| 2848 FX_BOOL bFlags = FALSE; | 2802 FX_BOOL bFlags = FALSE; |
| 2849 FX_FLOAT nPrincpalAmount = 0; | 2803 FX_FLOAT nPrincpalAmount = 0; |
| 2850 FX_FLOAT nRate = 0; | 2804 FX_FLOAT nRate = 0; |
| 2851 FX_FLOAT nPayment = 0; | 2805 FX_FLOAT nPayment = 0; |
| 2852 FX_FLOAT nFirstMonth = 0; | 2806 FX_FLOAT nFirstMonth = 0; |
| 2853 FX_FLOAT nNumberOfMonths = 0; | 2807 FX_FLOAT nNumberOfMonths = 0; |
| 2854 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2808 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2855 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2809 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2856 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2810 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 } | 2861 } |
| 2908 } else { | 2862 } else { |
| 2909 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"PPmt"); | 2863 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"PPmt"); |
| 2910 } | 2864 } |
| 2911 } | 2865 } |
| 2912 | 2866 |
| 2913 // static | 2867 // static |
| 2914 void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, | 2868 void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, |
| 2915 const CFX_ByteStringC& szFuncName, | 2869 const CFX_ByteStringC& szFuncName, |
| 2916 CFXJSE_Arguments& args) { | 2870 CFXJSE_Arguments& args) { |
| 2917 CXFA_FM2JSContext* pContext = | 2871 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2918 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2919 if (args.GetLength() == 3) { | 2872 if (args.GetLength() == 3) { |
| 2920 FX_BOOL bFlags = FALSE; | 2873 FX_BOOL bFlags = FALSE; |
| 2921 FX_DOUBLE nAmount = 0; | 2874 FX_DOUBLE nAmount = 0; |
| 2922 FX_DOUBLE nRate = 0; | 2875 FX_DOUBLE nRate = 0; |
| 2923 FX_DOUBLE nPeriod = 0; | 2876 FX_DOUBLE nPeriod = 0; |
| 2924 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2877 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2925 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2878 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2926 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2879 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| 2927 bFlags = | 2880 bFlags = |
| 2928 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || | 2881 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2948 } | 2901 } |
| 2949 } else { | 2902 } else { |
| 2950 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"PV"); | 2903 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"PV"); |
| 2951 } | 2904 } |
| 2952 } | 2905 } |
| 2953 | 2906 |
| 2954 // static | 2907 // static |
| 2955 void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, | 2908 void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, |
| 2956 const CFX_ByteStringC& szFuncName, | 2909 const CFX_ByteStringC& szFuncName, |
| 2957 CFXJSE_Arguments& args) { | 2910 CFXJSE_Arguments& args) { |
| 2958 CXFA_FM2JSContext* pContext = | 2911 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2959 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2960 if (args.GetLength() == 3) { | 2912 if (args.GetLength() == 3) { |
| 2961 FX_BOOL bFlags = FALSE; | 2913 FX_BOOL bFlags = FALSE; |
| 2962 FX_FLOAT nFuture = 0; | 2914 FX_FLOAT nFuture = 0; |
| 2963 FX_FLOAT nPresent = 0; | 2915 FX_FLOAT nPresent = 0; |
| 2964 FX_FLOAT nTotalNumber = 0; | 2916 FX_FLOAT nTotalNumber = 0; |
| 2965 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2917 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 2966 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2918 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 2967 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2919 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| 2968 bFlags = | 2920 bFlags = |
| 2969 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || | 2921 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2986 } | 2938 } |
| 2987 } else { | 2939 } else { |
| 2988 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Rate"); | 2940 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Rate"); |
| 2989 } | 2941 } |
| 2990 } | 2942 } |
| 2991 | 2943 |
| 2992 // static | 2944 // static |
| 2993 void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, | 2945 void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, |
| 2994 const CFX_ByteStringC& szFuncName, | 2946 const CFX_ByteStringC& szFuncName, |
| 2995 CFXJSE_Arguments& args) { | 2947 CFXJSE_Arguments& args) { |
| 2996 CXFA_FM2JSContext* pContext = | 2948 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 2997 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 2998 if (args.GetLength() == 3) { | 2949 if (args.GetLength() == 3) { |
| 2999 FX_BOOL bFlags = FALSE; | 2950 FX_BOOL bFlags = FALSE; |
| 3000 FX_FLOAT nMount = 0; | 2951 FX_FLOAT nMount = 0; |
| 3001 FX_FLOAT nRate = 0; | 2952 FX_FLOAT nRate = 0; |
| 3002 FX_FLOAT nFuture = 0; | 2953 FX_FLOAT nFuture = 0; |
| 3003 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 2954 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 3004 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 2955 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 3005 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); | 2956 std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); |
| 3006 bFlags = | 2957 bFlags = |
| 3007 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || | 2958 (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3024 } | 2975 } |
| 3025 } else { | 2976 } else { |
| 3026 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Term"); | 2977 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Term"); |
| 3027 } | 2978 } |
| 3028 } | 2979 } |
| 3029 | 2980 |
| 3030 // static | 2981 // static |
| 3031 void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, | 2982 void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, |
| 3032 const CFX_ByteStringC& szFuncName, | 2983 const CFX_ByteStringC& szFuncName, |
| 3033 CFXJSE_Arguments& args) { | 2984 CFXJSE_Arguments& args) { |
| 3034 CXFA_FM2JSContext* pContext = | 2985 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 3035 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 3036 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 2986 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 3037 int32_t argc = args.GetLength(); | 2987 int32_t argc = args.GetLength(); |
| 3038 if (argc > 1) { | 2988 if (argc > 1) { |
| 3039 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 2989 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 3040 FX_BOOL argOneIsNull = FALSE; | 2990 FX_BOOL argOneIsNull = FALSE; |
| 3041 int32_t iIndex = 0; | 2991 int32_t iIndex = 0; |
| 3042 argOneIsNull = ValueIsNull(pThis, argOne.get()); | 2992 argOneIsNull = ValueIsNull(pThis, argOne.get()); |
| 3043 if (!argOneIsNull) { | 2993 if (!argOneIsNull) { |
| 3044 iIndex = (int32_t)ValueToFloat(pThis, argOne.get()); | 2994 iIndex = (int32_t)ValueToFloat(pThis, argOne.get()); |
| 3045 } | 2995 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3101 bFound = TRUE; | 3051 bFound = TRUE; |
| 3102 } | 3052 } |
| 3103 } | 3053 } |
| 3104 iArgIndex++; | 3054 iArgIndex++; |
| 3105 } | 3055 } |
| 3106 if (!bFound) { | 3056 if (!bFound) { |
| 3107 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 3057 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 3108 } | 3058 } |
| 3109 } | 3059 } |
| 3110 } else { | 3060 } else { |
| 3111 CXFA_FM2JSContext* pContext = | |
| 3112 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 3113 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Choose"); | 3061 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Choose"); |
| 3114 } | 3062 } |
| 3115 } | 3063 } |
| 3116 | 3064 |
| 3117 // static | 3065 // static |
| 3118 void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, | 3066 void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, |
| 3119 const CFX_ByteStringC& szFuncName, | 3067 const CFX_ByteStringC& szFuncName, |
| 3120 CFXJSE_Arguments& args) { | 3068 CFXJSE_Arguments& args) { |
| 3121 if (args.GetLength() == 1) { | 3069 if (args.GetLength() == 1) { |
| 3122 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 3070 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 3123 FXJSE_Value_SetInteger(args.GetReturnValue(), | 3071 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 3124 FXJSE_Value_IsObject(argOne.get())); | 3072 FXJSE_Value_IsObject(argOne.get())); |
| 3125 } else { | 3073 } else { |
| 3126 CXFA_FM2JSContext* pContext = | 3074 ToJSContext(pThis, nullptr) |
| 3127 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3075 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Exists"); |
| 3128 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Exists"); | |
| 3129 } | 3076 } |
| 3130 } | 3077 } |
| 3131 | 3078 |
| 3132 // static | 3079 // static |
| 3133 void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, | 3080 void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, |
| 3134 const CFX_ByteStringC& szFuncName, | 3081 const CFX_ByteStringC& szFuncName, |
| 3135 CFXJSE_Arguments& args) { | 3082 CFXJSE_Arguments& args) { |
| 3136 if (args.GetLength() == 1) { | 3083 if (args.GetLength() == 1) { |
| 3137 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 3084 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 3138 if (FXJSE_Value_IsUTF8String(argOne.get())) { | 3085 if (FXJSE_Value_IsUTF8String(argOne.get())) { |
| 3139 CFX_ByteString valueStr; | 3086 CFX_ByteString valueStr; |
| 3140 FXJSE_Value_ToUTF8String(argOne.get(), valueStr); | 3087 FXJSE_Value_ToUTF8String(argOne.get(), valueStr); |
| 3141 valueStr.TrimLeft(); | 3088 valueStr.TrimLeft(); |
| 3142 FXJSE_Value_SetInteger(args.GetReturnValue(), (!valueStr.IsEmpty())); | 3089 FXJSE_Value_SetInteger(args.GetReturnValue(), (!valueStr.IsEmpty())); |
| 3143 } else if (FXJSE_Value_IsNumber(argOne.get()) || | 3090 } else if (FXJSE_Value_IsNumber(argOne.get()) || |
| 3144 FXJSE_Value_IsBoolean(argOne.get())) { | 3091 FXJSE_Value_IsBoolean(argOne.get())) { |
| 3145 FXJSE_Value_SetInteger(args.GetReturnValue(), TRUE); | 3092 FXJSE_Value_SetInteger(args.GetReturnValue(), TRUE); |
| 3146 } else { | 3093 } else { |
| 3147 FXJSE_Value_SetInteger(args.GetReturnValue(), FALSE); | 3094 FXJSE_Value_SetInteger(args.GetReturnValue(), FALSE); |
| 3148 } | 3095 } |
| 3149 } else { | 3096 } else { |
| 3150 CXFA_FM2JSContext* pContext = | 3097 ToJSContext(pThis, nullptr) |
| 3151 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3098 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"HasValue"); |
| 3152 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"HasValue"); | |
| 3153 } | 3099 } |
| 3154 } | 3100 } |
| 3155 | 3101 |
| 3156 // static | 3102 // static |
| 3157 void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, | 3103 void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, |
| 3158 const CFX_ByteStringC& szFuncName, | 3104 const CFX_ByteStringC& szFuncName, |
| 3159 CFXJSE_Arguments& args) { | 3105 CFXJSE_Arguments& args) { |
| 3160 if (args.GetLength() > 1) { | 3106 if (args.GetLength() > 1) { |
| 3161 FX_BOOL bFlags = FALSE; | 3107 FX_BOOL bFlags = FALSE; |
| 3162 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 3108 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 3163 CFXJSE_Value** parametersValue = nullptr; | 3109 CFXJSE_Value** parametersValue = nullptr; |
| 3164 int32_t iCount = 0; | 3110 int32_t iCount = 0; |
| 3165 unfoldArgs(pThis, args, parametersValue, iCount, 1); | 3111 unfoldArgs(pThis, args, parametersValue, iCount, 1); |
| 3166 for (int32_t i = 0; i < iCount; i++) { | 3112 for (int32_t i = 0; i < iCount; i++) { |
| 3167 if (simpleValueCompare(pThis, argOne.get(), parametersValue[i])) { | 3113 if (simpleValueCompare(pThis, argOne.get(), parametersValue[i])) { |
| 3168 bFlags = TRUE; | 3114 bFlags = TRUE; |
| 3169 break; | 3115 break; |
| 3170 } | 3116 } |
| 3171 } | 3117 } |
| 3172 FXJSE_Value_SetInteger(args.GetReturnValue(), bFlags); | 3118 FXJSE_Value_SetInteger(args.GetReturnValue(), bFlags); |
| 3173 for (int32_t i = 0; i < iCount; i++) { | 3119 for (int32_t i = 0; i < iCount; i++) { |
| 3174 delete parametersValue[i]; | 3120 delete parametersValue[i]; |
| 3175 } | 3121 } |
| 3176 FX_Free(parametersValue); | 3122 FX_Free(parametersValue); |
| 3177 } else { | 3123 } else { |
| 3178 CXFA_FM2JSContext* pContext = | 3124 ToJSContext(pThis, nullptr) |
| 3179 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3125 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Oneof"); |
| 3180 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Oneof"); | |
| 3181 } | 3126 } |
| 3182 } | 3127 } |
| 3183 | 3128 |
| 3184 // static | 3129 // static |
| 3185 void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, | 3130 void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, |
| 3186 const CFX_ByteStringC& szFuncName, | 3131 const CFX_ByteStringC& szFuncName, |
| 3187 CFXJSE_Arguments& args) { | 3132 CFXJSE_Arguments& args) { |
| 3188 if (args.GetLength() == 3) { | 3133 if (args.GetLength() == 3) { |
| 3189 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 3134 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 3190 if (FXJSE_Value_IsNull(argOne.get())) { | 3135 if (FXJSE_Value_IsNull(argOne.get())) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3206 ValueToUTF8String(argOne.get(), oneString); | 3151 ValueToUTF8String(argOne.get(), oneString); |
| 3207 ValueToUTF8String(argLow.get(), lowString); | 3152 ValueToUTF8String(argLow.get(), lowString); |
| 3208 ValueToUTF8String(argHeight.get(), heightString); | 3153 ValueToUTF8String(argHeight.get(), heightString); |
| 3209 FXJSE_Value_SetInteger( | 3154 FXJSE_Value_SetInteger( |
| 3210 args.GetReturnValue(), | 3155 args.GetReturnValue(), |
| 3211 ((oneString.Compare(lowString.AsStringC()) >= 0) && | 3156 ((oneString.Compare(lowString.AsStringC()) >= 0) && |
| 3212 (oneString.Compare(heightString.AsStringC()) <= 0))); | 3157 (oneString.Compare(heightString.AsStringC()) <= 0))); |
| 3213 } | 3158 } |
| 3214 } | 3159 } |
| 3215 } else { | 3160 } else { |
| 3216 CXFA_FM2JSContext* pContext = | 3161 ToJSContext(pThis, nullptr) |
| 3217 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3162 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Within"); |
| 3218 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Within"); | |
| 3219 } | 3163 } |
| 3220 } | 3164 } |
| 3221 | 3165 |
| 3222 // static | 3166 // static |
| 3223 void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, | 3167 void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, |
| 3224 const CFX_ByteStringC& szFuncName, | 3168 const CFX_ByteStringC& szFuncName, |
| 3225 CFXJSE_Arguments& args) { | 3169 CFXJSE_Arguments& args) { |
| 3226 if (args.GetLength() == 3) { | 3170 if (args.GetLength() == 3) { |
| 3227 std::unique_ptr<CFXJSE_Value> argCondition = GetSimpleValue(pThis, args, 0); | 3171 std::unique_ptr<CFXJSE_Value> argCondition = GetSimpleValue(pThis, args, 0); |
| 3228 std::unique_ptr<CFXJSE_Value> argFirstValue = | 3172 std::unique_ptr<CFXJSE_Value> argFirstValue = |
| 3229 GetSimpleValue(pThis, args, 1); | 3173 GetSimpleValue(pThis, args, 1); |
| 3230 std::unique_ptr<CFXJSE_Value> argSecondValue = | 3174 std::unique_ptr<CFXJSE_Value> argSecondValue = |
| 3231 GetSimpleValue(pThis, args, 2); | 3175 GetSimpleValue(pThis, args, 2); |
| 3232 FX_BOOL bCondition = FXJSE_Value_ToBoolean(argCondition.get()); | 3176 FX_BOOL bCondition = FXJSE_Value_ToBoolean(argCondition.get()); |
| 3233 FXJSE_Value_Set(args.GetReturnValue(), | 3177 FXJSE_Value_Set(args.GetReturnValue(), |
| 3234 bCondition ? argFirstValue.get() : argSecondValue.get()); | 3178 bCondition ? argFirstValue.get() : argSecondValue.get()); |
| 3235 } else { | 3179 } else { |
| 3236 CXFA_FM2JSContext* pContext = | 3180 ToJSContext(pThis, nullptr) |
| 3237 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3181 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"If"); |
| 3238 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"If"); | |
| 3239 } | 3182 } |
| 3240 } | 3183 } |
| 3241 | 3184 |
| 3242 // static | 3185 // static |
| 3243 void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, | 3186 void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, |
| 3244 const CFX_ByteStringC& szFuncName, | 3187 const CFX_ByteStringC& szFuncName, |
| 3245 CFXJSE_Arguments& args) { | 3188 CFXJSE_Arguments& args) { |
| 3246 CXFA_FM2JSContext* pContext = | 3189 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 3247 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 3248 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 3190 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 3249 if (args.GetLength() == 1) { | 3191 if (args.GetLength() == 1) { |
| 3250 std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0); | 3192 std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0); |
| 3251 CFX_ByteString utf8ScriptString; | 3193 CFX_ByteString utf8ScriptString; |
| 3252 ValueToUTF8String(scriptValue.get(), utf8ScriptString); | 3194 ValueToUTF8String(scriptValue.get(), utf8ScriptString); |
| 3253 if (utf8ScriptString.IsEmpty()) { | 3195 if (utf8ScriptString.IsEmpty()) { |
| 3254 FXJSE_Value_SetNull(args.GetReturnValue()); | 3196 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3255 } else { | 3197 } else { |
| 3256 CFX_WideTextBuf wsJavaScriptBuf; | 3198 CFX_WideTextBuf wsJavaScriptBuf; |
| 3257 CFX_WideString javaScript; | 3199 CFX_WideString javaScript; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3272 } | 3214 } |
| 3273 } else { | 3215 } else { |
| 3274 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Eval"); | 3216 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Eval"); |
| 3275 } | 3217 } |
| 3276 } | 3218 } |
| 3277 | 3219 |
| 3278 // static | 3220 // static |
| 3279 void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, | 3221 void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, |
| 3280 const CFX_ByteStringC& szFuncName, | 3222 const CFX_ByteStringC& szFuncName, |
| 3281 CFXJSE_Arguments& args) { | 3223 CFXJSE_Arguments& args) { |
| 3282 CXFA_FM2JSContext* pContext = | 3224 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 3283 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 3284 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 3225 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 3285 if (args.GetLength() == 1) { | 3226 if (args.GetLength() == 1) { |
| 3286 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 3227 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 3287 if (FXJSE_Value_IsNull(argOne.get())) { | 3228 if (FXJSE_Value_IsNull(argOne.get())) { |
| 3288 CFXJSE_Value* rgValues[3]; | 3229 CFXJSE_Value* rgValues[3]; |
| 3289 for (int32_t i = 0; i < 3; i++) | 3230 for (int32_t i = 0; i < 3; i++) |
| 3290 rgValues[i] = new CFXJSE_Value(pIsolate); | 3231 rgValues[i] = new CFXJSE_Value(pIsolate); |
| 3291 | 3232 |
| 3292 FXJSE_Value_SetInteger(rgValues[0], 4); | 3233 FXJSE_Value_SetInteger(rgValues[0], 4); |
| 3293 FXJSE_Value_SetNull(rgValues[1]); | 3234 FXJSE_Value_SetNull(rgValues[1]); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3452 break; | 3393 break; |
| 3453 case VALUETYPE_ISMP: | 3394 case VALUETYPE_ISMP: |
| 3454 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "mp"); | 3395 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "mp"); |
| 3455 break; | 3396 break; |
| 3456 default: | 3397 default: |
| 3457 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "in"); | 3398 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "in"); |
| 3458 break; | 3399 break; |
| 3459 } | 3400 } |
| 3460 } | 3401 } |
| 3461 } else { | 3402 } else { |
| 3462 CXFA_FM2JSContext* pContext = | 3403 ToJSContext(pThis, nullptr) |
| 3463 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3404 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitType"); |
| 3464 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitType"); | |
| 3465 } | 3405 } |
| 3466 } | 3406 } |
| 3467 | 3407 |
| 3468 // static | 3408 // static |
| 3469 void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, | 3409 void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, |
| 3470 const CFX_ByteStringC& szFuncName, | 3410 const CFX_ByteStringC& szFuncName, |
| 3471 CFXJSE_Arguments& args) { | 3411 CFXJSE_Arguments& args) { |
| 3472 int32_t argc = args.GetLength(); | 3412 int32_t argc = args.GetLength(); |
| 3473 if ((argc == 1) || (argc == 2)) { | 3413 if ((argc == 1) || (argc == 2)) { |
| 3474 std::unique_ptr<CFXJSE_Value> unitspanValue = | 3414 std::unique_ptr<CFXJSE_Value> unitspanValue = |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3609 } else { | 3549 } else { |
| 3610 dResult = dFirstNumber / 72000; | 3550 dResult = dFirstNumber / 72000; |
| 3611 } | 3551 } |
| 3612 } | 3552 } |
| 3613 FXJSE_Value_SetDouble(args.GetReturnValue(), dResult); | 3553 FXJSE_Value_SetDouble(args.GetReturnValue(), dResult); |
| 3614 } else { | 3554 } else { |
| 3615 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 3555 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 3616 } | 3556 } |
| 3617 } | 3557 } |
| 3618 } else { | 3558 } else { |
| 3619 CXFA_FM2JSContext* pContext = | 3559 ToJSContext(pThis, nullptr) |
| 3620 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3560 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitValue"); |
| 3621 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitValue"); | |
| 3622 } | 3561 } |
| 3623 } | 3562 } |
| 3624 | 3563 |
| 3625 // static | 3564 // static |
| 3626 void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, | 3565 void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, |
| 3627 const CFX_ByteStringC& szFuncName, | 3566 const CFX_ByteStringC& szFuncName, |
| 3628 CFXJSE_Arguments& args) { | 3567 CFXJSE_Arguments& args) { |
| 3629 if (args.GetLength() == 2) { | 3568 if (args.GetLength() == 2) { |
| 3630 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 3569 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 3631 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 3570 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 3632 if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) { | 3571 if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) { |
| 3633 FXJSE_Value_SetNull(args.GetReturnValue()); | 3572 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3634 } else { | 3573 } else { |
| 3635 CFX_ByteString stringTwo; | 3574 CFX_ByteString stringTwo; |
| 3636 ValueToUTF8String(argTwo.get(), stringTwo); | 3575 ValueToUTF8String(argTwo.get(), stringTwo); |
| 3637 if (stringTwo.IsEmpty()) { | 3576 if (stringTwo.IsEmpty()) { |
| 3638 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); | 3577 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); |
| 3639 } else { | 3578 } else { |
| 3640 CFX_ByteString stringOne; | 3579 CFX_ByteString stringOne; |
| 3641 ValueToUTF8String(argOne.get(), stringOne); | 3580 ValueToUTF8String(argOne.get(), stringOne); |
| 3642 FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsStringC()); | 3581 FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsStringC()); |
| 3643 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); | 3582 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); |
| 3644 } | 3583 } |
| 3645 } | 3584 } |
| 3646 } else { | 3585 } else { |
| 3647 CXFA_FM2JSContext* pContext = | 3586 ToJSContext(pThis, nullptr) |
| 3648 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3587 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"At"); |
| 3649 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"At"); | |
| 3650 } | 3588 } |
| 3651 } | 3589 } |
| 3652 | 3590 |
| 3653 // static | 3591 // static |
| 3654 void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, | 3592 void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, |
| 3655 const CFX_ByteStringC& szFuncName, | 3593 const CFX_ByteStringC& szFuncName, |
| 3656 CFXJSE_Arguments& args) { | 3594 CFXJSE_Arguments& args) { |
| 3657 int32_t argc = args.GetLength(); | 3595 int32_t argc = args.GetLength(); |
| 3658 if (argc >= 1) { | 3596 if (argc >= 1) { |
| 3659 CFX_ByteString resultString; | 3597 CFX_ByteString resultString; |
| 3660 FX_BOOL bAllNull = TRUE; | 3598 FX_BOOL bAllNull = TRUE; |
| 3661 | 3599 |
| 3662 for (int32_t i = 0; i < argc; i++) { | 3600 for (int32_t i = 0; i < argc; i++) { |
| 3663 std::unique_ptr<CFXJSE_Value> value = GetSimpleValue(pThis, args, i); | 3601 std::unique_ptr<CFXJSE_Value> value = GetSimpleValue(pThis, args, i); |
| 3664 if (!ValueIsNull(pThis, value.get())) { | 3602 if (!ValueIsNull(pThis, value.get())) { |
| 3665 CFX_ByteString valueStr; | 3603 CFX_ByteString valueStr; |
| 3666 ValueToUTF8String(value.get(), valueStr); | 3604 ValueToUTF8String(value.get(), valueStr); |
| 3667 resultString += valueStr; | 3605 resultString += valueStr; |
| 3668 bAllNull = FALSE; | 3606 bAllNull = FALSE; |
| 3669 } | 3607 } |
| 3670 } | 3608 } |
| 3671 | 3609 |
| 3672 if (bAllNull) { | 3610 if (bAllNull) { |
| 3673 FXJSE_Value_SetNull(args.GetReturnValue()); | 3611 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3674 } else { | 3612 } else { |
| 3675 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3613 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3676 resultString.AsStringC()); | 3614 resultString.AsStringC()); |
| 3677 } | 3615 } |
| 3678 } else { | 3616 } else { |
| 3679 CXFA_FM2JSContext* pContext = | 3617 ToJSContext(pThis, nullptr) |
| 3680 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3618 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Concat"); |
| 3681 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Concat"); | |
| 3682 } | 3619 } |
| 3683 } | 3620 } |
| 3684 | 3621 |
| 3685 // static | 3622 // static |
| 3686 void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, | 3623 void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, |
| 3687 const CFX_ByteStringC& szFuncName, | 3624 const CFX_ByteStringC& szFuncName, |
| 3688 CFXJSE_Arguments& args) { | 3625 CFXJSE_Arguments& args) { |
| 3689 int32_t argc = args.GetLength(); | 3626 int32_t argc = args.GetLength(); |
| 3690 if (argc == 1) { | 3627 if (argc == 1) { |
| 3691 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 3628 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3712 if (identifyString.EqualNoCase("html")) { | 3649 if (identifyString.EqualNoCase("html")) { |
| 3713 DecodeHTML(toDecodeString.AsStringC(), resultBuf); | 3650 DecodeHTML(toDecodeString.AsStringC(), resultBuf); |
| 3714 } else if (identifyString.EqualNoCase("xml")) { | 3651 } else if (identifyString.EqualNoCase("xml")) { |
| 3715 DecodeXML(toDecodeString.AsStringC(), resultBuf); | 3652 DecodeXML(toDecodeString.AsStringC(), resultBuf); |
| 3716 } else { | 3653 } else { |
| 3717 DecodeURL(toDecodeString.AsStringC(), resultBuf); | 3654 DecodeURL(toDecodeString.AsStringC(), resultBuf); |
| 3718 } | 3655 } |
| 3719 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); | 3656 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); |
| 3720 } | 3657 } |
| 3721 } else { | 3658 } else { |
| 3722 CXFA_FM2JSContext* pContext = | 3659 ToJSContext(pThis, nullptr) |
| 3723 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3660 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Decode"); |
| 3724 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Decode"); | |
| 3725 } | 3661 } |
| 3726 } | 3662 } |
| 3727 | 3663 |
| 3728 // static | 3664 // static |
| 3729 void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, | 3665 void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, |
| 3730 CFX_ByteTextBuf& szResultString) { | 3666 CFX_ByteTextBuf& szResultString) { |
| 3731 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); | 3667 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); |
| 3732 const FX_WCHAR* pData = wsURLString.c_str(); | 3668 const FX_WCHAR* pData = wsURLString.c_str(); |
| 3733 int32_t iLen = wsURLString.GetLength(); | 3669 int32_t iLen = wsURLString.GetLength(); |
| 3734 int32_t i = 0; | 3670 int32_t i = 0; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3987 if (identifyString.EqualNoCase("html")) { | 3923 if (identifyString.EqualNoCase("html")) { |
| 3988 EncodeHTML(toEncodeString.AsStringC(), resultBuf); | 3924 EncodeHTML(toEncodeString.AsStringC(), resultBuf); |
| 3989 } else if (identifyString.EqualNoCase("xml")) { | 3925 } else if (identifyString.EqualNoCase("xml")) { |
| 3990 EncodeXML(toEncodeString.AsStringC(), resultBuf); | 3926 EncodeXML(toEncodeString.AsStringC(), resultBuf); |
| 3991 } else { | 3927 } else { |
| 3992 EncodeURL(toEncodeString.AsStringC(), resultBuf); | 3928 EncodeURL(toEncodeString.AsStringC(), resultBuf); |
| 3993 } | 3929 } |
| 3994 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); | 3930 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); |
| 3995 } | 3931 } |
| 3996 } else { | 3932 } else { |
| 3997 CXFA_FM2JSContext* pContext = | 3933 ToJSContext(pThis, nullptr) |
| 3998 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 3934 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Encode"); |
| 3999 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Encode"); | |
| 4000 } | 3935 } |
| 4001 } | 3936 } |
| 4002 | 3937 |
| 4003 // static | 3938 // static |
| 4004 void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, | 3939 void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, |
| 4005 CFX_ByteTextBuf& szResultBuf) { | 3940 CFX_ByteTextBuf& szResultBuf) { |
| 4006 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); | 3941 CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); |
| 4007 CFX_WideTextBuf wsResultBuf; | 3942 CFX_WideTextBuf wsResultBuf; |
| 4008 FX_WCHAR ch = 0; | 3943 FX_WCHAR ch = 0; |
| 4009 int32_t iLength = wsURLString.GetLength(); | 3944 int32_t iLength = wsURLString.GetLength(); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4289 iStart = iMid + 1; | 4224 iStart = iMid + 1; |
| 4290 } | 4225 } |
| 4291 } while (iStart <= iEnd); | 4226 } while (iStart <= iEnd); |
| 4292 return FALSE; | 4227 return FALSE; |
| 4293 } | 4228 } |
| 4294 | 4229 |
| 4295 // static | 4230 // static |
| 4296 void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, | 4231 void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, |
| 4297 const CFX_ByteStringC& szFuncName, | 4232 const CFX_ByteStringC& szFuncName, |
| 4298 CFXJSE_Arguments& args) { | 4233 CFXJSE_Arguments& args) { |
| 4299 CXFA_FM2JSContext* pContext = | 4234 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 4300 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 4301 if (args.GetLength() >= 2) { | 4235 if (args.GetLength() >= 2) { |
| 4302 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4236 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 4303 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 4237 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 4304 CFX_ByteString szPattern; | 4238 CFX_ByteString szPattern; |
| 4305 ValueToUTF8String(argOne.get(), szPattern); | 4239 ValueToUTF8String(argOne.get(), szPattern); |
| 4306 CFX_ByteString szValue; | 4240 CFX_ByteString szValue; |
| 4307 ValueToUTF8String(argTwo.get(), szValue); | 4241 ValueToUTF8String(argTwo.get(), szValue); |
| 4308 CXFA_Document* pDoc = pContext->GetDocument(); | 4242 CXFA_Document* pDoc = pContext->GetDocument(); |
| 4309 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4243 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 4310 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 4244 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4394 CFX_ByteString sourceString; | 4328 CFX_ByteString sourceString; |
| 4395 ValueToUTF8String(argOne.get(), sourceString); | 4329 ValueToUTF8String(argOne.get(), sourceString); |
| 4396 int32_t count = ValueToInteger(pThis, argTwo.get()); | 4330 int32_t count = ValueToInteger(pThis, argTwo.get()); |
| 4397 if (count < 0) { | 4331 if (count < 0) { |
| 4398 count = 0; | 4332 count = 0; |
| 4399 } | 4333 } |
| 4400 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4334 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4401 sourceString.Left(count).AsStringC()); | 4335 sourceString.Left(count).AsStringC()); |
| 4402 } | 4336 } |
| 4403 } else { | 4337 } else { |
| 4404 CXFA_FM2JSContext* pContext = | 4338 ToJSContext(pThis, nullptr) |
| 4405 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4339 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Left"); |
| 4406 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Left"); | |
| 4407 } | 4340 } |
| 4408 } | 4341 } |
| 4409 | 4342 |
| 4410 // static | 4343 // static |
| 4411 void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, | 4344 void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, |
| 4412 const CFX_ByteStringC& szFuncName, | 4345 const CFX_ByteStringC& szFuncName, |
| 4413 CFXJSE_Arguments& args) { | 4346 CFXJSE_Arguments& args) { |
| 4414 if (args.GetLength() == 1) { | 4347 if (args.GetLength() == 1) { |
| 4415 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4348 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 4416 if (ValueIsNull(pThis, argOne.get())) { | 4349 if (ValueIsNull(pThis, argOne.get())) { |
| 4417 FXJSE_Value_SetNull(args.GetReturnValue()); | 4350 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4418 } else { | 4351 } else { |
| 4419 CFX_ByteString sourceString; | 4352 CFX_ByteString sourceString; |
| 4420 ValueToUTF8String(argOne.get(), sourceString); | 4353 ValueToUTF8String(argOne.get(), sourceString); |
| 4421 FXJSE_Value_SetInteger(args.GetReturnValue(), sourceString.GetLength()); | 4354 FXJSE_Value_SetInteger(args.GetReturnValue(), sourceString.GetLength()); |
| 4422 } | 4355 } |
| 4423 } else { | 4356 } else { |
| 4424 CXFA_FM2JSContext* pContext = | 4357 ToJSContext(pThis, nullptr) |
| 4425 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4358 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Len"); |
| 4426 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Len"); | |
| 4427 } | 4359 } |
| 4428 } | 4360 } |
| 4429 | 4361 |
| 4430 // static | 4362 // static |
| 4431 void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, | 4363 void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, |
| 4432 const CFX_ByteStringC& szFuncName, | 4364 const CFX_ByteStringC& szFuncName, |
| 4433 CFXJSE_Arguments& args) { | 4365 CFXJSE_Arguments& args) { |
| 4434 int32_t argc = args.GetLength(); | 4366 int32_t argc = args.GetLength(); |
| 4435 if ((argc > 0) && (argc < 3)) { | 4367 if ((argc > 0) && (argc < 3)) { |
| 4436 CFX_ByteString argString; | 4368 CFX_ByteString argString; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4458 lowStringBuf.AppendChar(ch); | 4390 lowStringBuf.AppendChar(ch); |
| 4459 ++i; | 4391 ++i; |
| 4460 } | 4392 } |
| 4461 lowStringBuf.AppendChar(0); | 4393 lowStringBuf.AppendChar(0); |
| 4462 FXJSE_Value_SetUTF8String( | 4394 FXJSE_Value_SetUTF8String( |
| 4463 args.GetReturnValue(), | 4395 args.GetReturnValue(), |
| 4464 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) | 4396 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) |
| 4465 .AsStringC()); | 4397 .AsStringC()); |
| 4466 } | 4398 } |
| 4467 } else { | 4399 } else { |
| 4468 CXFA_FM2JSContext* pContext = | 4400 ToJSContext(pThis, nullptr) |
| 4469 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4401 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Lower"); |
| 4470 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Lower"); | |
| 4471 } | 4402 } |
| 4472 } | 4403 } |
| 4473 | 4404 |
| 4474 // static | 4405 // static |
| 4475 void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, | 4406 void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, |
| 4476 const CFX_ByteStringC& szFuncName, | 4407 const CFX_ByteStringC& szFuncName, |
| 4477 CFXJSE_Arguments& args) { | 4408 CFXJSE_Arguments& args) { |
| 4478 if (args.GetLength() == 1) { | 4409 if (args.GetLength() == 1) { |
| 4479 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4410 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 4480 if (ValueIsNull(pThis, argOne.get())) { | 4411 if (ValueIsNull(pThis, argOne.get())) { |
| 4481 FXJSE_Value_SetNull(args.GetReturnValue()); | 4412 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4482 } else { | 4413 } else { |
| 4483 CFX_ByteString sourceString; | 4414 CFX_ByteString sourceString; |
| 4484 ValueToUTF8String(argOne.get(), sourceString); | 4415 ValueToUTF8String(argOne.get(), sourceString); |
| 4485 sourceString.TrimLeft(); | 4416 sourceString.TrimLeft(); |
| 4486 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4417 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4487 sourceString.AsStringC()); | 4418 sourceString.AsStringC()); |
| 4488 } | 4419 } |
| 4489 } else { | 4420 } else { |
| 4490 CXFA_FM2JSContext* pContext = | 4421 ToJSContext(pThis, nullptr) |
| 4491 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4422 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ltrim"); |
| 4492 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ltrim"); | |
| 4493 } | 4423 } |
| 4494 } | 4424 } |
| 4495 | 4425 |
| 4496 // static | 4426 // static |
| 4497 void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, | 4427 void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, |
| 4498 const CFX_ByteStringC& szFuncName, | 4428 const CFX_ByteStringC& szFuncName, |
| 4499 CFXJSE_Arguments& args) { | 4429 CFXJSE_Arguments& args) { |
| 4500 CXFA_FM2JSContext* pContext = | 4430 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 4501 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 4502 if (args.GetLength() == 2) { | 4431 if (args.GetLength() == 2) { |
| 4503 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4432 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 4504 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 4433 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 4505 if (ValueIsNull(pThis, argTwo.get())) { | 4434 if (ValueIsNull(pThis, argTwo.get())) { |
| 4506 FXJSE_Value_SetNull(args.GetReturnValue()); | 4435 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4507 } else { | 4436 } else { |
| 4508 CFX_ByteString szPattern; | 4437 CFX_ByteString szPattern; |
| 4509 ValueToUTF8String(argOne.get(), szPattern); | 4438 ValueToUTF8String(argOne.get(), szPattern); |
| 4510 CFX_ByteString szValue; | 4439 CFX_ByteString szValue; |
| 4511 ValueToUTF8String(argTwo.get(), szValue); | 4440 ValueToUTF8String(argTwo.get(), szValue); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4681 } else { | 4610 } else { |
| 4682 resultString.AppendChar(ch); | 4611 resultString.AppendChar(ch); |
| 4683 } | 4612 } |
| 4684 } else { | 4613 } else { |
| 4685 resultString.AppendChar(ch); | 4614 resultString.AppendChar(ch); |
| 4686 } | 4615 } |
| 4687 } | 4616 } |
| 4688 resultString.AppendChar(0); | 4617 resultString.AppendChar(0); |
| 4689 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); | 4618 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); |
| 4690 } else { | 4619 } else { |
| 4691 CXFA_FM2JSContext* pContext = | 4620 ToJSContext(pThis, nullptr) |
| 4692 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4621 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Replace"); |
| 4693 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Replace"); | |
| 4694 } | 4622 } |
| 4695 } | 4623 } |
| 4696 | 4624 |
| 4697 // static | 4625 // static |
| 4698 void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, | 4626 void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, |
| 4699 const CFX_ByteStringC& szFuncName, | 4627 const CFX_ByteStringC& szFuncName, |
| 4700 CFXJSE_Arguments& args) { | 4628 CFXJSE_Arguments& args) { |
| 4701 if (args.GetLength() == 2) { | 4629 if (args.GetLength() == 2) { |
| 4702 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4630 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 4703 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); | 4631 std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| 4704 FX_BOOL argIsNull = FALSE; | 4632 FX_BOOL argIsNull = FALSE; |
| 4705 if ((ValueIsNull(pThis, argOne.get())) || | 4633 if ((ValueIsNull(pThis, argOne.get())) || |
| 4706 (ValueIsNull(pThis, argTwo.get()))) { | 4634 (ValueIsNull(pThis, argTwo.get()))) { |
| 4707 argIsNull = TRUE; | 4635 argIsNull = TRUE; |
| 4708 } | 4636 } |
| 4709 if (argIsNull) { | 4637 if (argIsNull) { |
| 4710 FXJSE_Value_SetNull(args.GetReturnValue()); | 4638 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4711 } else { | 4639 } else { |
| 4712 CFX_ByteString sourceString; | 4640 CFX_ByteString sourceString; |
| 4713 ValueToUTF8String(argOne.get(), sourceString); | 4641 ValueToUTF8String(argOne.get(), sourceString); |
| 4714 int32_t count = ValueToInteger(pThis, argTwo.get()); | 4642 int32_t count = ValueToInteger(pThis, argTwo.get()); |
| 4715 if (count < 0) { | 4643 if (count < 0) { |
| 4716 count = 0; | 4644 count = 0; |
| 4717 } | 4645 } |
| 4718 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4646 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4719 sourceString.Right(count).AsStringC()); | 4647 sourceString.Right(count).AsStringC()); |
| 4720 } | 4648 } |
| 4721 } else { | 4649 } else { |
| 4722 CXFA_FM2JSContext* pContext = | 4650 ToJSContext(pThis, nullptr) |
| 4723 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4651 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Right"); |
| 4724 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Right"); | |
| 4725 } | 4652 } |
| 4726 } | 4653 } |
| 4727 | 4654 |
| 4728 // static | 4655 // static |
| 4729 void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, | 4656 void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, |
| 4730 const CFX_ByteStringC& szFuncName, | 4657 const CFX_ByteStringC& szFuncName, |
| 4731 CFXJSE_Arguments& args) { | 4658 CFXJSE_Arguments& args) { |
| 4732 if (args.GetLength() == 1) { | 4659 if (args.GetLength() == 1) { |
| 4733 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4660 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 4734 if (ValueIsNull(pThis, argOne.get())) { | 4661 if (ValueIsNull(pThis, argOne.get())) { |
| 4735 FXJSE_Value_SetNull(args.GetReturnValue()); | 4662 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4736 } else { | 4663 } else { |
| 4737 CFX_ByteString sourceString; | 4664 CFX_ByteString sourceString; |
| 4738 ValueToUTF8String(argOne.get(), sourceString); | 4665 ValueToUTF8String(argOne.get(), sourceString); |
| 4739 sourceString.TrimRight(); | 4666 sourceString.TrimRight(); |
| 4740 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4667 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4741 sourceString.AsStringC()); | 4668 sourceString.AsStringC()); |
| 4742 } | 4669 } |
| 4743 } else { | 4670 } else { |
| 4744 CXFA_FM2JSContext* pContext = | 4671 ToJSContext(pThis, nullptr) |
| 4745 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4672 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Rtrim"); |
| 4746 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Rtrim"); | |
| 4747 } | 4673 } |
| 4748 } | 4674 } |
| 4749 | 4675 |
| 4750 // static | 4676 // static |
| 4751 void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, | 4677 void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, |
| 4752 const CFX_ByteStringC& szFuncName, | 4678 const CFX_ByteStringC& szFuncName, |
| 4753 CFXJSE_Arguments& args) { | 4679 CFXJSE_Arguments& args) { |
| 4754 if (args.GetLength() == 1) { | 4680 if (args.GetLength() == 1) { |
| 4755 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4681 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 4756 if (FXJSE_Value_IsNull(argOne.get())) { | 4682 if (FXJSE_Value_IsNull(argOne.get())) { |
| 4757 FXJSE_Value_SetNull(args.GetReturnValue()); | 4683 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4758 } else { | 4684 } else { |
| 4759 int32_t count = 0; | 4685 int32_t count = 0; |
| 4760 count = ValueToInteger(pThis, argOne.get()); | 4686 count = ValueToInteger(pThis, argOne.get()); |
| 4761 count = (count < 0) ? 0 : count; | 4687 count = (count < 0) ? 0 : count; |
| 4762 CFX_ByteTextBuf spaceString; | 4688 CFX_ByteTextBuf spaceString; |
| 4763 int32_t index = 0; | 4689 int32_t index = 0; |
| 4764 while (index < count) { | 4690 while (index < count) { |
| 4765 spaceString.AppendByte(' '); | 4691 spaceString.AppendByte(' '); |
| 4766 index++; | 4692 index++; |
| 4767 } | 4693 } |
| 4768 spaceString.AppendByte(0); | 4694 spaceString.AppendByte(0); |
| 4769 FXJSE_Value_SetUTF8String(args.GetReturnValue(), spaceString.AsStringC()); | 4695 FXJSE_Value_SetUTF8String(args.GetReturnValue(), spaceString.AsStringC()); |
| 4770 } | 4696 } |
| 4771 } else { | 4697 } else { |
| 4772 CXFA_FM2JSContext* pContext = | 4698 ToJSContext(pThis, nullptr) |
| 4773 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4699 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Space"); |
| 4774 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Space"); | |
| 4775 } | 4700 } |
| 4776 } | 4701 } |
| 4777 | 4702 |
| 4778 // static | 4703 // static |
| 4779 void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, | 4704 void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, |
| 4780 const CFX_ByteStringC& szFuncName, | 4705 const CFX_ByteStringC& szFuncName, |
| 4781 CFXJSE_Arguments& args) { | 4706 CFXJSE_Arguments& args) { |
| 4782 int32_t argc = args.GetLength(); | 4707 int32_t argc = args.GetLength(); |
| 4783 if ((argc > 0) && (argc < 4)) { | 4708 if ((argc > 0) && (argc < 4)) { |
| 4784 FX_BOOL bFlags = FALSE; | 4709 FX_BOOL bFlags = FALSE; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4881 ++i; | 4806 ++i; |
| 4882 } | 4807 } |
| 4883 resultBuf.AppendChar(0); | 4808 resultBuf.AppendChar(0); |
| 4884 } | 4809 } |
| 4885 } | 4810 } |
| 4886 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); | 4811 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); |
| 4887 } else { | 4812 } else { |
| 4888 FXJSE_Value_SetNull(args.GetReturnValue()); | 4813 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4889 } | 4814 } |
| 4890 } else { | 4815 } else { |
| 4891 CXFA_FM2JSContext* pContext = | 4816 ToJSContext(pThis, nullptr) |
| 4892 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4817 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Str"); |
| 4893 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Str"); | |
| 4894 } | 4818 } |
| 4895 } | 4819 } |
| 4896 | 4820 |
| 4897 // static | 4821 // static |
| 4898 void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, | 4822 void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, |
| 4899 const CFX_ByteStringC& szFuncName, | 4823 const CFX_ByteStringC& szFuncName, |
| 4900 CFXJSE_Arguments& args) { | 4824 CFXJSE_Arguments& args) { |
| 4901 int32_t argc = args.GetLength(); | 4825 int32_t argc = args.GetLength(); |
| 4902 if ((argc == 3) || (argc == 4)) { | 4826 if ((argc == 3) || (argc == 4)) { |
| 4903 CFX_ByteString sourceString; | 4827 CFX_ByteString sourceString; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4939 } | 4863 } |
| 4940 resultString << insertString.AsStringC(); | 4864 resultString << insertString.AsStringC(); |
| 4941 i = iStart + iDelete; | 4865 i = iStart + iDelete; |
| 4942 while (i < iLength) { | 4866 while (i < iLength) { |
| 4943 resultString.AppendChar(sourceString.GetAt(i)); | 4867 resultString.AppendChar(sourceString.GetAt(i)); |
| 4944 ++i; | 4868 ++i; |
| 4945 } | 4869 } |
| 4946 resultString.AppendChar(0); | 4870 resultString.AppendChar(0); |
| 4947 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); | 4871 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); |
| 4948 } else { | 4872 } else { |
| 4949 CXFA_FM2JSContext* pContext = | 4873 ToJSContext(pThis, nullptr) |
| 4950 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4874 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Stuff"); |
| 4951 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Stuff"); | |
| 4952 } | 4875 } |
| 4953 } | 4876 } |
| 4954 | 4877 |
| 4955 // static | 4878 // static |
| 4956 void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, | 4879 void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, |
| 4957 const CFX_ByteStringC& szFuncName, | 4880 const CFX_ByteStringC& szFuncName, |
| 4958 CFXJSE_Arguments& args) { | 4881 CFXJSE_Arguments& args) { |
| 4959 if (args.GetLength() == 3) { | 4882 if (args.GetLength() == 3) { |
| 4960 std::unique_ptr<CFXJSE_Value> stringValue = GetSimpleValue(pThis, args, 0); | 4883 std::unique_ptr<CFXJSE_Value> stringValue = GetSimpleValue(pThis, args, 0); |
| 4961 std::unique_ptr<CFXJSE_Value> startValue = GetSimpleValue(pThis, args, 1); | 4884 std::unique_ptr<CFXJSE_Value> startValue = GetSimpleValue(pThis, args, 1); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4983 } | 4906 } |
| 4984 if (iCount <= 0) { | 4907 if (iCount <= 0) { |
| 4985 iCount = 0; | 4908 iCount = 0; |
| 4986 } | 4909 } |
| 4987 iStart -= 1; | 4910 iStart -= 1; |
| 4988 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4911 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4989 szSourceStr.Mid(iStart, iCount).AsStringC()); | 4912 szSourceStr.Mid(iStart, iCount).AsStringC()); |
| 4990 } | 4913 } |
| 4991 } | 4914 } |
| 4992 } else { | 4915 } else { |
| 4993 CXFA_FM2JSContext* pContext = | 4916 ToJSContext(pThis, nullptr) |
| 4994 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4917 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Substr"); |
| 4995 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Substr"); | |
| 4996 } | 4918 } |
| 4997 } | 4919 } |
| 4998 | 4920 |
| 4999 // static | 4921 // static |
| 5000 void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, | 4922 void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, |
| 5001 const CFX_ByteStringC& szFuncName, | 4923 const CFX_ByteStringC& szFuncName, |
| 5002 CFXJSE_Arguments& args) { | 4924 CFXJSE_Arguments& args) { |
| 5003 int32_t argc = args.GetLength(); | 4925 int32_t argc = args.GetLength(); |
| 5004 if ((argc == 0) || (argc == 1)) { | 4926 if ((argc == 0) || (argc == 1)) { |
| 5005 int32_t iNum = 0; | 4927 int32_t iNum = 0; |
| 5006 if (argc == 1) { | 4928 if (argc == 1) { |
| 5007 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 4929 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 5008 iNum = (int32_t)ValueToFloat(pThis, argOne.get()); | 4930 iNum = (int32_t)ValueToFloat(pThis, argOne.get()); |
| 5009 } | 4931 } |
| 5010 FX_GUID guid; | 4932 FX_GUID guid; |
| 5011 FX_GUID_CreateV4(&guid); | 4933 FX_GUID_CreateV4(&guid); |
| 5012 CFX_ByteString bsUId; | 4934 CFX_ByteString bsUId; |
| 5013 FX_GUID_ToString(&guid, bsUId, iNum); | 4935 FX_GUID_ToString(&guid, bsUId, iNum); |
| 5014 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); | 4936 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); |
| 5015 } else { | 4937 } else { |
| 5016 CXFA_FM2JSContext* pContext = | 4938 ToJSContext(pThis, nullptr) |
| 5017 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4939 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Uuid"); |
| 5018 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Uuid"); | |
| 5019 } | 4940 } |
| 5020 } | 4941 } |
| 5021 | 4942 |
| 5022 // static | 4943 // static |
| 5023 void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, | 4944 void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, |
| 5024 const CFX_ByteStringC& szFuncName, | 4945 const CFX_ByteStringC& szFuncName, |
| 5025 CFXJSE_Arguments& args) { | 4946 CFXJSE_Arguments& args) { |
| 5026 int32_t argc = args.GetLength(); | 4947 int32_t argc = args.GetLength(); |
| 5027 if ((argc > 0) && (argc < 3)) { | 4948 if ((argc > 0) && (argc < 3)) { |
| 5028 CFX_ByteString argString; | 4949 CFX_ByteString argString; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5050 upperStringBuf.AppendChar(ch); | 4971 upperStringBuf.AppendChar(ch); |
| 5051 ++i; | 4972 ++i; |
| 5052 } | 4973 } |
| 5053 upperStringBuf.AppendChar(0); | 4974 upperStringBuf.AppendChar(0); |
| 5054 FXJSE_Value_SetUTF8String( | 4975 FXJSE_Value_SetUTF8String( |
| 5055 args.GetReturnValue(), | 4976 args.GetReturnValue(), |
| 5056 FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) | 4977 FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) |
| 5057 .AsStringC()); | 4978 .AsStringC()); |
| 5058 } | 4979 } |
| 5059 } else { | 4980 } else { |
| 5060 CXFA_FM2JSContext* pContext = | 4981 ToJSContext(pThis, nullptr) |
| 5061 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 4982 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Upper"); |
| 5062 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Upper"); | |
| 5063 } | 4983 } |
| 5064 } | 4984 } |
| 5065 | 4985 |
| 5066 // static | 4986 // static |
| 5067 void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, | 4987 void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, |
| 5068 const CFX_ByteStringC& szFuncName, | 4988 const CFX_ByteStringC& szFuncName, |
| 5069 CFXJSE_Arguments& args) { | 4989 CFXJSE_Arguments& args) { |
| 5070 int32_t argc = args.GetLength(); | 4990 int32_t argc = args.GetLength(); |
| 5071 if ((argc > 0) && (argc < 4)) { | 4991 if ((argc > 0) && (argc < 4)) { |
| 5072 FX_BOOL bFlags = FALSE; | 4992 FX_BOOL bFlags = FALSE; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5104 CFX_ByteTextBuf resultBuf; | 5024 CFX_ByteTextBuf resultBuf; |
| 5105 CFX_ByteString numberString; | 5025 CFX_ByteString numberString; |
| 5106 numberString.Format("%.2f", fNumber); | 5026 numberString.Format("%.2f", fNumber); |
| 5107 WordUS(numberString.AsStringC(), iIdentifier, resultBuf); | 5027 WordUS(numberString.AsStringC(), iIdentifier, resultBuf); |
| 5108 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); | 5028 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); |
| 5109 } | 5029 } |
| 5110 } else { | 5030 } else { |
| 5111 FXJSE_Value_SetNull(args.GetReturnValue()); | 5031 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5112 } | 5032 } |
| 5113 } else { | 5033 } else { |
| 5114 CXFA_FM2JSContext* pContext = | 5034 ToJSContext(pThis, nullptr) |
| 5115 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | 5035 ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"WordNum"); |
| 5116 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"WordNum"); | |
| 5117 } | 5036 } |
| 5118 } | 5037 } |
| 5119 | 5038 |
| 5120 // static | 5039 // static |
| 5121 void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, | 5040 void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, |
| 5122 CFX_ByteTextBuf& strBuf) { | 5041 CFX_ByteTextBuf& strBuf) { |
| 5123 CFX_ByteStringC pUnits[] = {"zero", "one", "two", "three", "four", | 5042 CFX_ByteStringC pUnits[] = {"zero", "one", "two", "three", "four", |
| 5124 "five", "six", "seven", "eight", "nine"}; | 5043 "five", "six", "seven", "eight", "nine"}; |
| 5125 CFX_ByteStringC pCapUnits[] = {"Zero", "One", "Two", "Three", "Four", | 5044 CFX_ByteStringC pCapUnits[] = {"Zero", "One", "Two", "Three", "Four", |
| 5126 "Five", "Six", "Seven", "Eight", "Nine"}; | 5045 "Five", "Six", "Seven", "Eight", "Nine"}; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5313 } break; | 5232 } break; |
| 5314 default: | 5233 default: |
| 5315 break; | 5234 break; |
| 5316 } | 5235 } |
| 5317 } | 5236 } |
| 5318 | 5237 |
| 5319 // static | 5238 // static |
| 5320 void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, | 5239 void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, |
| 5321 const CFX_ByteStringC& szFuncName, | 5240 const CFX_ByteStringC& szFuncName, |
| 5322 CFXJSE_Arguments& args) { | 5241 CFXJSE_Arguments& args) { |
| 5323 CXFA_FM2JSContext* pContext = | 5242 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5324 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5325 if (args.GetLength() == 1) { | 5243 if (args.GetLength() == 1) { |
| 5326 CXFA_Document* pDoc = pContext->GetDocument(); | 5244 CXFA_Document* pDoc = pContext->GetDocument(); |
| 5327 if (!pDoc) { | 5245 if (!pDoc) { |
| 5328 return; | 5246 return; |
| 5329 } | 5247 } |
| 5330 IXFA_AppProvider* pAppProvider = | 5248 IXFA_AppProvider* pAppProvider = |
| 5331 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5249 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
| 5332 if (!pAppProvider) { | 5250 if (!pAppProvider) { |
| 5333 return; | 5251 return; |
| 5334 } | 5252 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5348 } | 5266 } |
| 5349 } else { | 5267 } else { |
| 5350 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Get"); | 5268 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Get"); |
| 5351 } | 5269 } |
| 5352 } | 5270 } |
| 5353 | 5271 |
| 5354 // static | 5272 // static |
| 5355 void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, | 5273 void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, |
| 5356 const CFX_ByteStringC& szFuncName, | 5274 const CFX_ByteStringC& szFuncName, |
| 5357 CFXJSE_Arguments& args) { | 5275 CFXJSE_Arguments& args) { |
| 5358 CXFA_FM2JSContext* pContext = | 5276 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5359 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5360 int32_t argc = args.GetLength(); | 5277 int32_t argc = args.GetLength(); |
| 5361 if ((argc >= 2) && (argc <= 5)) { | 5278 if ((argc >= 2) && (argc <= 5)) { |
| 5362 CXFA_Document* pDoc = pContext->GetDocument(); | 5279 CXFA_Document* pDoc = pContext->GetDocument(); |
| 5363 if (!pDoc) { | 5280 if (!pDoc) { |
| 5364 return; | 5281 return; |
| 5365 } | 5282 } |
| 5366 IXFA_AppProvider* pAppProvider = | 5283 IXFA_AppProvider* pAppProvider = |
| 5367 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5284 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
| 5368 if (!pAppProvider) { | 5285 if (!pAppProvider) { |
| 5369 return; | 5286 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5406 } | 5323 } |
| 5407 } else { | 5324 } else { |
| 5408 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Post"); | 5325 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Post"); |
| 5409 } | 5326 } |
| 5410 } | 5327 } |
| 5411 | 5328 |
| 5412 // static | 5329 // static |
| 5413 void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, | 5330 void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, |
| 5414 const CFX_ByteStringC& szFuncName, | 5331 const CFX_ByteStringC& szFuncName, |
| 5415 CFXJSE_Arguments& args) { | 5332 CFXJSE_Arguments& args) { |
| 5416 CXFA_FM2JSContext* pContext = | 5333 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5417 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5418 int32_t argc = args.GetLength(); | 5334 int32_t argc = args.GetLength(); |
| 5419 if ((argc == 2) || (argc == 3)) { | 5335 if ((argc == 2) || (argc == 3)) { |
| 5420 CXFA_Document* pDoc = pContext->GetDocument(); | 5336 CXFA_Document* pDoc = pContext->GetDocument(); |
| 5421 if (!pDoc) { | 5337 if (!pDoc) { |
| 5422 return; | 5338 return; |
| 5423 } | 5339 } |
| 5424 IXFA_AppProvider* pAppProvider = | 5340 IXFA_AppProvider* pAppProvider = |
| 5425 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5341 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
| 5426 if (!pAppProvider) { | 5342 if (!pAppProvider) { |
| 5427 return; | 5343 return; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5448 } | 5364 } |
| 5449 } else { | 5365 } else { |
| 5450 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Put"); | 5366 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Put"); |
| 5451 } | 5367 } |
| 5452 } | 5368 } |
| 5453 | 5369 |
| 5454 // static | 5370 // static |
| 5455 void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, | 5371 void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, |
| 5456 const CFX_ByteStringC& szFuncName, | 5372 const CFX_ByteStringC& szFuncName, |
| 5457 CFXJSE_Arguments& args) { | 5373 CFXJSE_Arguments& args) { |
| 5458 CXFA_FM2JSContext* pContext = | 5374 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5459 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5460 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5375 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 5461 if (args.GetLength() == 2) { | 5376 if (args.GetLength() == 2) { |
| 5462 std::unique_ptr<CFXJSE_Value> lValue = args.GetValue(0); | 5377 std::unique_ptr<CFXJSE_Value> lValue = args.GetValue(0); |
| 5463 std::unique_ptr<CFXJSE_Value> rValue = GetSimpleValue(pThis, args, 1); | 5378 std::unique_ptr<CFXJSE_Value> rValue = GetSimpleValue(pThis, args, 1); |
| 5464 FX_BOOL bSetStatus = TRUE; | 5379 FX_BOOL bSetStatus = TRUE; |
| 5465 if (FXJSE_Value_IsArray(lValue.get())) { | 5380 if (FXJSE_Value_IsArray(lValue.get())) { |
| 5466 std::unique_ptr<CFXJSE_Value> leftLengthValue(new CFXJSE_Value(pIsolate)); | 5381 std::unique_ptr<CFXJSE_Value> leftLengthValue(new CFXJSE_Value(pIsolate)); |
| 5467 FXJSE_Value_GetObjectProp(lValue.get(), "length", leftLengthValue.get()); | 5382 FXJSE_Value_GetObjectProp(lValue.get(), "length", leftLengthValue.get()); |
| 5468 int32_t iLeftLength = FXJSE_Value_ToInteger(leftLengthValue.get()); | 5383 int32_t iLeftLength = FXJSE_Value_ToInteger(leftLengthValue.get()); |
| 5469 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 5384 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5508 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5423 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5509 if (FXJSE_Value_IsNull(argFirst.get()) && | 5424 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5510 FXJSE_Value_IsNull(argSecond.get())) { | 5425 FXJSE_Value_IsNull(argSecond.get())) { |
| 5511 FXJSE_Value_SetNull(args.GetReturnValue()); | 5426 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5512 } else { | 5427 } else { |
| 5513 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); | 5428 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); |
| 5514 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); | 5429 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); |
| 5515 FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); | 5430 FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); |
| 5516 } | 5431 } |
| 5517 } else { | 5432 } else { |
| 5518 CXFA_FM2JSContext* pContext = | 5433 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5519 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5520 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5521 } | 5434 } |
| 5522 } | 5435 } |
| 5523 | 5436 |
| 5524 // static | 5437 // static |
| 5525 void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, | 5438 void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, |
| 5526 const CFX_ByteStringC& szFuncName, | 5439 const CFX_ByteStringC& szFuncName, |
| 5527 CFXJSE_Arguments& args) { | 5440 CFXJSE_Arguments& args) { |
| 5528 if (args.GetLength() == 2) { | 5441 if (args.GetLength() == 2) { |
| 5529 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5442 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5530 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5443 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5531 if (FXJSE_Value_IsNull(argFirst.get()) && | 5444 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5532 FXJSE_Value_IsNull(argSecond.get())) { | 5445 FXJSE_Value_IsNull(argSecond.get())) { |
| 5533 FXJSE_Value_SetNull(args.GetReturnValue()); | 5446 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5534 } else { | 5447 } else { |
| 5535 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); | 5448 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); |
| 5536 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); | 5449 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); |
| 5537 FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); | 5450 FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); |
| 5538 } | 5451 } |
| 5539 } else { | 5452 } else { |
| 5540 CXFA_FM2JSContext* pContext = | 5453 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5541 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5542 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5543 } | 5454 } |
| 5544 } | 5455 } |
| 5545 | 5456 |
| 5546 // static | 5457 // static |
| 5547 void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, | 5458 void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, |
| 5548 const CFX_ByteStringC& szFuncName, | 5459 const CFX_ByteStringC& szFuncName, |
| 5549 CFXJSE_Arguments& args) { | 5460 CFXJSE_Arguments& args) { |
| 5550 if (args.GetLength() == 2) { | 5461 if (args.GetLength() == 2) { |
| 5551 if (fm_ref_equal(pThis, args)) { | 5462 if (fm_ref_equal(pThis, args)) { |
| 5552 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); | 5463 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 5569 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5480 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 5570 firstOutput == secondOutput); | 5481 firstOutput == secondOutput); |
| 5571 } else { | 5482 } else { |
| 5572 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5483 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5573 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5484 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5574 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5485 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 5575 (first == second) ? 1 : 0); | 5486 (first == second) ? 1 : 0); |
| 5576 } | 5487 } |
| 5577 } | 5488 } |
| 5578 } else { | 5489 } else { |
| 5579 CXFA_FM2JSContext* pContext = | 5490 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5580 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5581 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5582 } | 5491 } |
| 5583 } | 5492 } |
| 5584 | 5493 |
| 5585 // static | 5494 // static |
| 5586 void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, | 5495 void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, |
| 5587 const CFX_ByteStringC& szFuncName, | 5496 const CFX_ByteStringC& szFuncName, |
| 5588 CFXJSE_Arguments& args) { | 5497 CFXJSE_Arguments& args) { |
| 5589 if (args.GetLength() == 2) { | 5498 if (args.GetLength() == 2) { |
| 5590 if (fm_ref_equal(pThis, args)) { | 5499 if (fm_ref_equal(pThis, args)) { |
| 5591 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5500 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5607 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5516 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5608 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5517 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 5609 firstOutput != secondOutput); | 5518 firstOutput != secondOutput); |
| 5610 } else { | 5519 } else { |
| 5611 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5520 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5612 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5521 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5613 FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); | 5522 FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); |
| 5614 } | 5523 } |
| 5615 } | 5524 } |
| 5616 } else { | 5525 } else { |
| 5617 CXFA_FM2JSContext* pContext = | 5526 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5618 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5619 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5620 } | 5527 } |
| 5621 } | 5528 } |
| 5622 | 5529 |
| 5623 // static | 5530 // static |
| 5624 FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, | 5531 FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, |
| 5625 CFXJSE_Arguments& args) { | 5532 CFXJSE_Arguments& args) { |
| 5626 FX_BOOL bRet = FALSE; | 5533 FX_BOOL bRet = FALSE; |
| 5627 CXFA_FM2JSContext* pContext = | 5534 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 5628 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5629 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 5630 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); | 5535 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); |
| 5631 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); | 5536 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); |
| 5632 if (FXJSE_Value_IsArray(argFirst.get()) && | 5537 if (FXJSE_Value_IsArray(argFirst.get()) && |
| 5633 FXJSE_Value_IsArray(argSecond.get())) { | 5538 FXJSE_Value_IsArray(argSecond.get())) { |
| 5634 std::unique_ptr<CFXJSE_Value> firstFlagValue(new CFXJSE_Value(pIsolate)); | 5539 std::unique_ptr<CFXJSE_Value> firstFlagValue(new CFXJSE_Value(pIsolate)); |
| 5635 std::unique_ptr<CFXJSE_Value> secondFlagValue(new CFXJSE_Value(pIsolate)); | 5540 std::unique_ptr<CFXJSE_Value> secondFlagValue(new CFXJSE_Value(pIsolate)); |
| 5636 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 0, firstFlagValue.get()); | 5541 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 0, firstFlagValue.get()); |
| 5637 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 0, secondFlagValue.get()); | 5542 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 0, secondFlagValue.get()); |
| 5638 if ((FXJSE_Value_ToInteger(firstFlagValue.get()) == 3) && | 5543 if ((FXJSE_Value_ToInteger(firstFlagValue.get()) == 3) && |
| 5639 (FXJSE_Value_ToInteger(secondFlagValue.get()) == 3)) { | 5544 (FXJSE_Value_ToInteger(secondFlagValue.get()) == 3)) { |
| 5640 std::unique_ptr<CFXJSE_Value> firstJSObject(new CFXJSE_Value(pIsolate)); | 5545 std::unique_ptr<CFXJSE_Value> firstJSObject(new CFXJSE_Value(pIsolate)); |
| 5641 std::unique_ptr<CFXJSE_Value> secondJSObject(new CFXJSE_Value(pIsolate)); | 5546 std::unique_ptr<CFXJSE_Value> secondJSObject(new CFXJSE_Value(pIsolate)); |
| 5642 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 2, firstJSObject.get()); | 5547 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 2, firstJSObject.get()); |
| 5643 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 2, secondJSObject.get()); | 5548 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 2, secondJSObject.get()); |
| 5644 if (!FXJSE_Value_IsNull(firstJSObject.get()) && | 5549 if (!FXJSE_Value_IsNull(firstJSObject.get()) && |
| 5645 !FXJSE_Value_IsNull(secondJSObject.get())) { | 5550 !FXJSE_Value_IsNull(secondJSObject.get())) { |
| 5646 bRet = (FXJSE_Value_ToObject(firstJSObject.get(), nullptr) == | 5551 bRet = (firstJSObject->ToHostObject(nullptr) == |
| 5647 FXJSE_Value_ToObject(secondJSObject.get(), nullptr)); | 5552 secondJSObject->ToHostObject(nullptr)); |
| 5648 } | 5553 } |
| 5649 } | 5554 } |
| 5650 } | 5555 } |
| 5651 return bRet; | 5556 return bRet; |
| 5652 } | 5557 } |
| 5653 | 5558 |
| 5654 // static | 5559 // static |
| 5655 void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, | 5560 void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, |
| 5656 const CFX_ByteStringC& szFuncName, | 5561 const CFX_ByteStringC& szFuncName, |
| 5657 CFXJSE_Arguments& args) { | 5562 CFXJSE_Arguments& args) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5669 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5574 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5670 FXJSE_Value_SetInteger( | 5575 FXJSE_Value_SetInteger( |
| 5671 args.GetReturnValue(), | 5576 args.GetReturnValue(), |
| 5672 firstOutput.Compare(secondOutput.AsStringC()) == -1); | 5577 firstOutput.Compare(secondOutput.AsStringC()) == -1); |
| 5673 } else { | 5578 } else { |
| 5674 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5579 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5675 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5580 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5676 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); | 5581 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); |
| 5677 } | 5582 } |
| 5678 } else { | 5583 } else { |
| 5679 CXFA_FM2JSContext* pContext = | 5584 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5680 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5681 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5682 } | 5585 } |
| 5683 } | 5586 } |
| 5684 | 5587 |
| 5685 // static | 5588 // static |
| 5686 void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, | 5589 void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, |
| 5687 const CFX_ByteStringC& szFuncName, | 5590 const CFX_ByteStringC& szFuncName, |
| 5688 CFXJSE_Arguments& args) { | 5591 CFXJSE_Arguments& args) { |
| 5689 if (args.GetLength() == 2) { | 5592 if (args.GetLength() == 2) { |
| 5690 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5593 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5691 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5594 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5704 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5607 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5705 FXJSE_Value_SetInteger( | 5608 FXJSE_Value_SetInteger( |
| 5706 args.GetReturnValue(), | 5609 args.GetReturnValue(), |
| 5707 firstOutput.Compare(secondOutput.AsStringC()) != 1); | 5610 firstOutput.Compare(secondOutput.AsStringC()) != 1); |
| 5708 } else { | 5611 } else { |
| 5709 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5612 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5710 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5613 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5711 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); | 5614 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); |
| 5712 } | 5615 } |
| 5713 } else { | 5616 } else { |
| 5714 CXFA_FM2JSContext* pContext = | 5617 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5715 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5716 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5717 } | 5618 } |
| 5718 } | 5619 } |
| 5719 | 5620 |
| 5720 // static | 5621 // static |
| 5721 void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, | 5622 void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, |
| 5722 const CFX_ByteStringC& szFuncName, | 5623 const CFX_ByteStringC& szFuncName, |
| 5723 CFXJSE_Arguments& args) { | 5624 CFXJSE_Arguments& args) { |
| 5724 if (args.GetLength() == 2) { | 5625 if (args.GetLength() == 2) { |
| 5725 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5626 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5726 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5627 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5727 if (FXJSE_Value_IsNull(argFirst.get()) || | 5628 if (FXJSE_Value_IsNull(argFirst.get()) || |
| 5728 FXJSE_Value_IsNull(argSecond.get())) { | 5629 FXJSE_Value_IsNull(argSecond.get())) { |
| 5729 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5630 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 5730 } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && | 5631 } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && |
| 5731 FXJSE_Value_IsUTF8String(argSecond.get())) { | 5632 FXJSE_Value_IsUTF8String(argSecond.get())) { |
| 5732 CFX_ByteString firstOutput; | 5633 CFX_ByteString firstOutput; |
| 5733 CFX_ByteString secondOutput; | 5634 CFX_ByteString secondOutput; |
| 5734 FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); | 5635 FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); |
| 5735 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5636 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5736 FXJSE_Value_SetInteger( | 5637 FXJSE_Value_SetInteger( |
| 5737 args.GetReturnValue(), | 5638 args.GetReturnValue(), |
| 5738 firstOutput.Compare(secondOutput.AsStringC()) == 1); | 5639 firstOutput.Compare(secondOutput.AsStringC()) == 1); |
| 5739 } else { | 5640 } else { |
| 5740 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5641 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5741 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5642 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5742 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); | 5643 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); |
| 5743 } | 5644 } |
| 5744 } else { | 5645 } else { |
| 5745 CXFA_FM2JSContext* pContext = | 5646 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5746 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5747 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5748 } | 5647 } |
| 5749 } | 5648 } |
| 5750 | 5649 |
| 5751 // static | 5650 // static |
| 5752 void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, | 5651 void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, |
| 5753 const CFX_ByteStringC& szFuncName, | 5652 const CFX_ByteStringC& szFuncName, |
| 5754 CFXJSE_Arguments& args) { | 5653 CFXJSE_Arguments& args) { |
| 5755 if (args.GetLength() == 2) { | 5654 if (args.GetLength() == 2) { |
| 5756 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5655 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5757 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5656 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5770 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5669 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5771 FXJSE_Value_SetInteger( | 5670 FXJSE_Value_SetInteger( |
| 5772 args.GetReturnValue(), | 5671 args.GetReturnValue(), |
| 5773 firstOutput.Compare(secondOutput.AsStringC()) != -1); | 5672 firstOutput.Compare(secondOutput.AsStringC()) != -1); |
| 5774 } else { | 5673 } else { |
| 5775 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5674 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5776 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5675 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5777 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); | 5676 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); |
| 5778 } | 5677 } |
| 5779 } else { | 5678 } else { |
| 5780 CXFA_FM2JSContext* pContext = | 5679 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5781 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5782 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5783 } | 5680 } |
| 5784 } | 5681 } |
| 5785 | 5682 |
| 5786 // static | 5683 // static |
| 5787 void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, | 5684 void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, |
| 5788 const CFX_ByteStringC& szFuncName, | 5685 const CFX_ByteStringC& szFuncName, |
| 5789 CFXJSE_Arguments& args) { | 5686 CFXJSE_Arguments& args) { |
| 5790 if (args.GetLength() == 2) { | 5687 if (args.GetLength() == 2) { |
| 5791 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); | 5688 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); |
| 5792 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); | 5689 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); |
| 5793 if (ValueIsNull(pThis, argFirst.get()) && | 5690 if (ValueIsNull(pThis, argFirst.get()) && |
| 5794 ValueIsNull(pThis, argSecond.get())) { | 5691 ValueIsNull(pThis, argSecond.get())) { |
| 5795 FXJSE_Value_SetNull(args.GetReturnValue()); | 5692 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5796 } else { | 5693 } else { |
| 5797 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5694 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5798 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5695 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5799 FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); | 5696 FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); |
| 5800 } | 5697 } |
| 5801 } else { | 5698 } else { |
| 5802 CXFA_FM2JSContext* pContext = | 5699 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5803 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5804 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5805 } | 5700 } |
| 5806 } | 5701 } |
| 5807 | 5702 |
| 5808 // static | 5703 // static |
| 5809 void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, | 5704 void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, |
| 5810 const CFX_ByteStringC& szFuncName, | 5705 const CFX_ByteStringC& szFuncName, |
| 5811 CFXJSE_Arguments& args) { | 5706 CFXJSE_Arguments& args) { |
| 5812 if (args.GetLength() == 2) { | 5707 if (args.GetLength() == 2) { |
| 5813 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5708 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5814 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5709 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5815 if (FXJSE_Value_IsNull(argFirst.get()) && | 5710 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5816 FXJSE_Value_IsNull(argSecond.get())) { | 5711 FXJSE_Value_IsNull(argSecond.get())) { |
| 5817 FXJSE_Value_SetNull(args.GetReturnValue()); | 5712 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5818 } else { | 5713 } else { |
| 5819 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5714 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5820 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5715 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5821 FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); | 5716 FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); |
| 5822 } | 5717 } |
| 5823 } else { | 5718 } else { |
| 5824 CXFA_FM2JSContext* pContext = | 5719 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5825 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5826 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5827 } | 5720 } |
| 5828 } | 5721 } |
| 5829 | 5722 |
| 5830 // static | 5723 // static |
| 5831 void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, | 5724 void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, |
| 5832 const CFX_ByteStringC& szFuncName, | 5725 const CFX_ByteStringC& szFuncName, |
| 5833 CFXJSE_Arguments& args) { | 5726 CFXJSE_Arguments& args) { |
| 5834 if (args.GetLength() == 2) { | 5727 if (args.GetLength() == 2) { |
| 5835 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5728 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5836 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5729 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5837 if (FXJSE_Value_IsNull(argFirst.get()) && | 5730 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5838 FXJSE_Value_IsNull(argSecond.get())) { | 5731 FXJSE_Value_IsNull(argSecond.get())) { |
| 5839 FXJSE_Value_SetNull(args.GetReturnValue()); | 5732 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5840 } else { | 5733 } else { |
| 5841 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5734 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5842 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5735 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5843 FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); | 5736 FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); |
| 5844 } | 5737 } |
| 5845 } else { | 5738 } else { |
| 5846 CXFA_FM2JSContext* pContext = | 5739 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5847 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5848 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5849 } | 5740 } |
| 5850 } | 5741 } |
| 5851 | 5742 |
| 5852 // static | 5743 // static |
| 5853 void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, | 5744 void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, |
| 5854 const CFX_ByteStringC& szFuncName, | 5745 const CFX_ByteStringC& szFuncName, |
| 5855 CFXJSE_Arguments& args) { | 5746 CFXJSE_Arguments& args) { |
| 5856 CXFA_FM2JSContext* pContext = | 5747 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5857 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5858 if (args.GetLength() == 2) { | 5748 if (args.GetLength() == 2) { |
| 5859 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5749 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5860 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5750 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5861 if (FXJSE_Value_IsNull(argFirst.get()) && | 5751 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5862 FXJSE_Value_IsNull(argSecond.get())) { | 5752 FXJSE_Value_IsNull(argSecond.get())) { |
| 5863 FXJSE_Value_SetNull(args.GetReturnValue()); | 5753 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5864 } else { | 5754 } else { |
| 5865 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5755 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5866 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5756 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5867 if (second == 0.0) { | 5757 if (second == 0.0) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5881 CFXJSE_Arguments& args) { | 5771 CFXJSE_Arguments& args) { |
| 5882 if (args.GetLength() == 1) { | 5772 if (args.GetLength() == 1) { |
| 5883 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 5773 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 5884 if (FXJSE_Value_IsNull(argOne.get())) { | 5774 if (FXJSE_Value_IsNull(argOne.get())) { |
| 5885 FXJSE_Value_SetNull(args.GetReturnValue()); | 5775 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5886 } else { | 5776 } else { |
| 5887 FXJSE_Value_SetDouble(args.GetReturnValue(), | 5777 FXJSE_Value_SetDouble(args.GetReturnValue(), |
| 5888 0.0 + ValueToDouble(pThis, argOne.get())); | 5778 0.0 + ValueToDouble(pThis, argOne.get())); |
| 5889 } | 5779 } |
| 5890 } else { | 5780 } else { |
| 5891 CXFA_FM2JSContext* pContext = | 5781 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5892 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5893 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5894 } | 5782 } |
| 5895 } | 5783 } |
| 5896 | 5784 |
| 5897 // static | 5785 // static |
| 5898 void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, | 5786 void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, |
| 5899 const CFX_ByteStringC& szFuncName, | 5787 const CFX_ByteStringC& szFuncName, |
| 5900 CFXJSE_Arguments& args) { | 5788 CFXJSE_Arguments& args) { |
| 5901 if (args.GetLength() == 1) { | 5789 if (args.GetLength() == 1) { |
| 5902 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 5790 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 5903 if (FXJSE_Value_IsNull(argOne.get())) { | 5791 if (FXJSE_Value_IsNull(argOne.get())) { |
| 5904 FXJSE_Value_SetNull(args.GetReturnValue()); | 5792 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5905 } else { | 5793 } else { |
| 5906 FXJSE_Value_SetDouble(args.GetReturnValue(), | 5794 FXJSE_Value_SetDouble(args.GetReturnValue(), |
| 5907 0.0 - ValueToDouble(pThis, argOne.get())); | 5795 0.0 - ValueToDouble(pThis, argOne.get())); |
| 5908 } | 5796 } |
| 5909 } else { | 5797 } else { |
| 5910 CXFA_FM2JSContext* pContext = | 5798 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5911 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5912 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5913 } | 5799 } |
| 5914 } | 5800 } |
| 5915 | 5801 |
| 5916 // static | 5802 // static |
| 5917 void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, | 5803 void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, |
| 5918 const CFX_ByteStringC& szFuncName, | 5804 const CFX_ByteStringC& szFuncName, |
| 5919 CFXJSE_Arguments& args) { | 5805 CFXJSE_Arguments& args) { |
| 5920 if (args.GetLength() == 1) { | 5806 if (args.GetLength() == 1) { |
| 5921 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 5807 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 5922 if (FXJSE_Value_IsNull(argOne.get())) { | 5808 if (FXJSE_Value_IsNull(argOne.get())) { |
| 5923 FXJSE_Value_SetNull(args.GetReturnValue()); | 5809 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5924 } else { | 5810 } else { |
| 5925 FX_DOUBLE first = ValueToDouble(pThis, argOne.get()); | 5811 FX_DOUBLE first = ValueToDouble(pThis, argOne.get()); |
| 5926 FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); | 5812 FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); |
| 5927 } | 5813 } |
| 5928 } else { | 5814 } else { |
| 5929 CXFA_FM2JSContext* pContext = | 5815 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5930 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5931 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5932 } | 5816 } |
| 5933 } | 5817 } |
| 5934 | 5818 |
| 5935 // static | 5819 // static |
| 5936 void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, | 5820 void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, |
| 5937 const CFX_ByteStringC& szFuncName, | 5821 const CFX_ByteStringC& szFuncName, |
| 5938 CFXJSE_Arguments& args) { | 5822 CFXJSE_Arguments& args) { |
| 5939 CXFA_FM2JSContext* pContext = | 5823 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5940 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5941 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5824 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 5942 int32_t argc = args.GetLength(); | 5825 int32_t argc = args.GetLength(); |
| 5943 if ((argc == 4) || (argc == 5)) { | 5826 if ((argc == 4) || (argc == 5)) { |
| 5944 FX_BOOL bIsStar = TRUE; | 5827 FX_BOOL bIsStar = TRUE; |
| 5945 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); | 5828 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); |
| 5946 CFX_ByteString bsAccessorName = args.GetUTF8String(1); | 5829 CFX_ByteString bsAccessorName = args.GetUTF8String(1); |
| 5947 CFX_ByteString szName = args.GetUTF8String(2); | 5830 CFX_ByteString szName = args.GetUTF8String(2); |
| 5948 int32_t iIndexFlags = args.GetInt32(3); | 5831 int32_t iIndexFlags = args.GetInt32(3); |
| 5949 int32_t iIndexValue = 0; | 5832 int32_t iIndexValue = 0; |
| 5950 if (argc == 5) { | 5833 if (argc == 5) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6078 } | 5961 } |
| 6079 } else { | 5962 } else { |
| 6080 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 5963 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6081 } | 5964 } |
| 6082 } | 5965 } |
| 6083 | 5966 |
| 6084 // static | 5967 // static |
| 6085 void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, | 5968 void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, |
| 6086 const CFX_ByteStringC& szFuncName, | 5969 const CFX_ByteStringC& szFuncName, |
| 6087 CFXJSE_Arguments& args) { | 5970 CFXJSE_Arguments& args) { |
| 6088 CXFA_FM2JSContext* pContext = | 5971 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6089 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6090 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5972 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6091 int32_t argc = args.GetLength(); | 5973 int32_t argc = args.GetLength(); |
| 6092 if ((argc == 4) || (argc == 5)) { | 5974 if ((argc == 4) || (argc == 5)) { |
| 6093 FX_BOOL bIsStar = TRUE; | 5975 FX_BOOL bIsStar = TRUE; |
| 6094 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); | 5976 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); |
| 6095 CFX_ByteString bsAccessorName = args.GetUTF8String(1); | 5977 CFX_ByteString bsAccessorName = args.GetUTF8String(1); |
| 6096 CFX_ByteString szName = args.GetUTF8String(2); | 5978 CFX_ByteString szName = args.GetUTF8String(2); |
| 6097 int32_t iIndexFlags = args.GetInt32(3); | 5979 int32_t iIndexFlags = args.GetInt32(3); |
| 6098 int32_t iIndexValue = 0; | 5980 int32_t iIndexValue = 0; |
| 6099 if (argc == 5) { | 5981 if (argc == 5) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6222 } | 6104 } |
| 6223 } else { | 6105 } else { |
| 6224 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 6106 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6225 } | 6107 } |
| 6226 } | 6108 } |
| 6227 | 6109 |
| 6228 // static | 6110 // static |
| 6229 void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, | 6111 void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, |
| 6230 const CFX_ByteStringC& szFuncName, | 6112 const CFX_ByteStringC& szFuncName, |
| 6231 CFXJSE_Arguments& args) { | 6113 CFXJSE_Arguments& args) { |
| 6232 CXFA_FM2JSContext* pContext = | 6114 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6233 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6234 if (args.GetLength() == 1) { | 6115 if (args.GetLength() == 1) { |
| 6235 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 6116 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 6236 CFX_ByteString argString; | 6117 CFX_ByteString argString; |
| 6237 ValueToUTF8String(argOne.get(), argString); | 6118 ValueToUTF8String(argOne.get(), argString); |
| 6238 if (argString.IsEmpty()) { | 6119 if (argString.IsEmpty()) { |
| 6239 pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); | 6120 pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); |
| 6240 } else { | 6121 } else { |
| 6241 CFX_WideString scriptString = | 6122 CFX_WideString scriptString = |
| 6242 CFX_WideString::FromUTF8(argString.AsStringC()); | 6123 CFX_WideString::FromUTF8(argString.AsStringC()); |
| 6243 CFX_WideTextBuf wsJavaScriptBuf; | 6124 CFX_WideTextBuf wsJavaScriptBuf; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6282 FXJSE_Value_SetBoolean(args.GetReturnValue(), bIsArray); | 6163 FXJSE_Value_SetBoolean(args.GetReturnValue(), bIsArray); |
| 6283 } else { | 6164 } else { |
| 6284 FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); | 6165 FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); |
| 6285 } | 6166 } |
| 6286 } | 6167 } |
| 6287 | 6168 |
| 6288 // static | 6169 // static |
| 6289 void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, | 6170 void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, |
| 6290 const CFX_ByteStringC& szFuncName, | 6171 const CFX_ByteStringC& szFuncName, |
| 6291 CFXJSE_Arguments& args) { | 6172 CFXJSE_Arguments& args) { |
| 6292 CXFA_FM2JSContext* pContext = | 6173 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6293 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6294 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6174 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6295 if (args.GetLength() == 1) { | 6175 if (args.GetLength() == 1) { |
| 6296 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 6176 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 6297 if (FXJSE_Value_IsArray(argOne.get())) { | 6177 if (FXJSE_Value_IsArray(argOne.get())) { |
| 6298 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6178 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6299 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6179 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6300 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 1, propertyValue.get()); | 6180 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 1, propertyValue.get()); |
| 6301 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, jsObjectValue.get()); | 6181 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, jsObjectValue.get()); |
| 6302 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6182 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6303 GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue()); | 6183 GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6318 } | 6198 } |
| 6319 | 6199 |
| 6320 // static | 6200 // static |
| 6321 void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, | 6201 void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, |
| 6322 const CFX_ByteStringC& szFuncName, | 6202 const CFX_ByteStringC& szFuncName, |
| 6323 CFXJSE_Arguments& args) { | 6203 CFXJSE_Arguments& args) { |
| 6324 if (args.GetLength() == 1) { | 6204 if (args.GetLength() == 1) { |
| 6325 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 6205 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 6326 if (FXJSE_Value_IsArray(argOne.get())) { | 6206 if (FXJSE_Value_IsArray(argOne.get())) { |
| 6327 #ifndef NDEBUG | 6207 #ifndef NDEBUG |
| 6328 CXFA_FM2JSContext* pContext = | 6208 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6329 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6330 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6209 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6331 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6210 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6332 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); | 6211 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); |
| 6333 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); | 6212 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); |
| 6334 #endif | 6213 #endif |
| 6335 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, args.GetReturnValue()); | 6214 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, args.GetReturnValue()); |
| 6336 } else { | 6215 } else { |
| 6337 FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); | 6216 FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); |
| 6338 } | 6217 } |
| 6339 } else { | 6218 } else { |
| 6340 CXFA_FM2JSContext* pContext = | 6219 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6341 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6342 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 6220 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6343 } | 6221 } |
| 6344 } | 6222 } |
| 6345 | 6223 |
| 6346 // static | 6224 // static |
| 6347 void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, | 6225 void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, |
| 6348 const CFX_ByteStringC& szFuncName, | 6226 const CFX_ByteStringC& szFuncName, |
| 6349 CFXJSE_Arguments& args) { | 6227 CFXJSE_Arguments& args) { |
| 6350 CXFA_FM2JSContext* pContext = | 6228 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6351 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6352 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6229 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6353 if (args.GetLength() == 1) { | 6230 if (args.GetLength() == 1) { |
| 6354 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 6231 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 6355 if (FXJSE_Value_IsArray(argOne.get())) { | 6232 if (FXJSE_Value_IsArray(argOne.get())) { |
| 6356 #ifndef NDEBUG | 6233 #ifndef NDEBUG |
| 6357 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6234 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6358 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); | 6235 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); |
| 6359 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); | 6236 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); |
| 6360 #endif | 6237 #endif |
| 6361 std::unique_ptr<CFXJSE_Value> flagsValue(new CFXJSE_Value(pIsolate)); | 6238 std::unique_ptr<CFXJSE_Value> flagsValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6392 } | 6269 } |
| 6393 } else { | 6270 } else { |
| 6394 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 6271 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6395 } | 6272 } |
| 6396 } | 6273 } |
| 6397 | 6274 |
| 6398 // static | 6275 // static |
| 6399 void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, | 6276 void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, |
| 6400 const CFX_ByteStringC& szFuncName, | 6277 const CFX_ByteStringC& szFuncName, |
| 6401 CFXJSE_Arguments& args) { | 6278 CFXJSE_Arguments& args) { |
| 6402 CXFA_FM2JSContext* pContext = | 6279 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6403 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6404 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6405 uint32_t iLength = 0; | 6280 uint32_t iLength = 0; |
| 6406 int32_t argc = args.GetLength(); | 6281 int32_t argc = args.GetLength(); |
| 6407 std::vector<std::unique_ptr<CFXJSE_Value>> argValues; | 6282 std::vector<std::unique_ptr<CFXJSE_Value>> argValues; |
| 6408 for (int32_t i = 0; i < argc; i++) { | 6283 for (int32_t i = 0; i < argc; i++) { |
| 6409 argValues.push_back(args.GetValue(i)); | 6284 argValues.push_back(args.GetValue(i)); |
| 6410 if (FXJSE_Value_IsArray(argValues[i].get())) { | 6285 if (FXJSE_Value_IsArray(argValues[i].get())) { |
| 6411 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6286 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6412 FXJSE_Value_GetObjectProp(argValues[i].get(), "length", | 6287 FXJSE_Value_GetObjectProp(argValues[i].get(), "length", |
| 6413 lengthValue.get()); | 6288 lengthValue.get()); |
| 6414 int32_t length = FXJSE_Value_ToInteger(lengthValue.get()); | 6289 int32_t length = FXJSE_Value_ToInteger(lengthValue.get()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6441 delete returnValues[i]; | 6316 delete returnValues[i]; |
| 6442 | 6317 |
| 6443 FX_Free(returnValues); | 6318 FX_Free(returnValues); |
| 6444 } | 6319 } |
| 6445 | 6320 |
| 6446 // static | 6321 // static |
| 6447 std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( | 6322 std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( |
| 6448 CFXJSE_Value* pThis, | 6323 CFXJSE_Value* pThis, |
| 6449 CFXJSE_Arguments& args, | 6324 CFXJSE_Arguments& args, |
| 6450 uint32_t index) { | 6325 uint32_t index) { |
| 6451 CXFA_FM2JSContext* pContext = | 6326 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6452 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6453 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6454 ASSERT(index < (uint32_t)args.GetLength()); | 6327 ASSERT(index < (uint32_t)args.GetLength()); |
| 6455 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); | 6328 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); |
| 6456 if (FXJSE_Value_IsArray(argIndex.get())) { | 6329 if (FXJSE_Value_IsArray(argIndex.get())) { |
| 6457 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6330 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6458 FXJSE_Value_GetObjectProp(argIndex.get(), "length", lengthValue.get()); | 6331 FXJSE_Value_GetObjectProp(argIndex.get(), "length", lengthValue.get()); |
| 6459 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6332 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| 6460 std::unique_ptr<CFXJSE_Value> simpleValue(new CFXJSE_Value(pIsolate)); | 6333 std::unique_ptr<CFXJSE_Value> simpleValue(new CFXJSE_Value(pIsolate)); |
| 6461 if (iLength > 2) { | 6334 if (iLength > 2) { |
| 6462 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6335 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6463 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6336 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6479 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate)); | 6352 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate)); |
| 6480 GetObjectDefaultValue(argIndex.get(), defaultValue.get()); | 6353 GetObjectDefaultValue(argIndex.get(), defaultValue.get()); |
| 6481 return defaultValue; | 6354 return defaultValue; |
| 6482 } else { | 6355 } else { |
| 6483 return argIndex; | 6356 return argIndex; |
| 6484 } | 6357 } |
| 6485 } | 6358 } |
| 6486 | 6359 |
| 6487 // static | 6360 // static |
| 6488 FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { | 6361 FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { |
| 6489 CXFA_FM2JSContext* pContext = | 6362 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6490 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6491 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6492 FX_BOOL isNull = FALSE; | 6363 FX_BOOL isNull = FALSE; |
| 6493 if (FXJSE_Value_IsNull(arg)) { | 6364 if (FXJSE_Value_IsNull(arg)) { |
| 6494 isNull = TRUE; | 6365 isNull = TRUE; |
| 6495 } else if (FXJSE_Value_IsArray(arg)) { | 6366 } else if (FXJSE_Value_IsArray(arg)) { |
| 6496 int32_t iLength = hvalue_get_array_length(pThis, arg); | 6367 int32_t iLength = hvalue_get_array_length(pThis, arg); |
| 6497 if (iLength > 2) { | 6368 if (iLength > 2) { |
| 6498 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6369 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6499 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6370 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6500 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); | 6371 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); |
| 6501 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); | 6372 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6525 if (FXJSE_Value_IsNull(defaultValue.get())) { | 6396 if (FXJSE_Value_IsNull(defaultValue.get())) { |
| 6526 isNull = TRUE; | 6397 isNull = TRUE; |
| 6527 } | 6398 } |
| 6528 } | 6399 } |
| 6529 return isNull; | 6400 return isNull; |
| 6530 } | 6401 } |
| 6531 | 6402 |
| 6532 // static | 6403 // static |
| 6533 int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, | 6404 int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, |
| 6534 CFXJSE_Value* arg) { | 6405 CFXJSE_Value* arg) { |
| 6535 CXFA_FM2JSContext* pContext = | 6406 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6536 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6537 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6538 int32_t iLength = 0; | 6407 int32_t iLength = 0; |
| 6539 if (FXJSE_Value_IsArray(arg)) { | 6408 if (FXJSE_Value_IsArray(arg)) { |
| 6540 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6409 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6541 FXJSE_Value_GetObjectProp(arg, "length", lengthValue.get()); | 6410 FXJSE_Value_GetObjectProp(arg, "length", lengthValue.get()); |
| 6542 iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6411 iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| 6543 } | 6412 } |
| 6544 return iLength; | 6413 return iLength; |
| 6545 } | 6414 } |
| 6546 | 6415 |
| 6547 // static | 6416 // static |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6567 } | 6436 } |
| 6568 return bReturn; | 6437 return bReturn; |
| 6569 } | 6438 } |
| 6570 | 6439 |
| 6571 // static | 6440 // static |
| 6572 void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, | 6441 void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, |
| 6573 CFXJSE_Arguments& args, | 6442 CFXJSE_Arguments& args, |
| 6574 CFXJSE_Value**& resultValues, | 6443 CFXJSE_Value**& resultValues, |
| 6575 int32_t& iCount, | 6444 int32_t& iCount, |
| 6576 int32_t iStart) { | 6445 int32_t iStart) { |
| 6577 CXFA_FM2JSContext* pContext = | 6446 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6578 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6579 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6580 iCount = 0; | 6447 iCount = 0; |
| 6581 int32_t argc = args.GetLength(); | 6448 int32_t argc = args.GetLength(); |
| 6582 std::vector<std::unique_ptr<CFXJSE_Value>> argsValue; | 6449 std::vector<std::unique_ptr<CFXJSE_Value>> argsValue; |
| 6583 for (int32_t i = 0; i < argc - iStart; i++) { | 6450 for (int32_t i = 0; i < argc - iStart; i++) { |
| 6584 argsValue.push_back(args.GetValue(i + iStart)); | 6451 argsValue.push_back(args.GetValue(i + iStart)); |
| 6585 if (FXJSE_Value_IsArray(argsValue[i].get())) { | 6452 if (FXJSE_Value_IsArray(argsValue[i].get())) { |
| 6586 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6453 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6587 FXJSE_Value_GetObjectProp(argsValue[i].get(), "length", | 6454 FXJSE_Value_GetObjectProp(argsValue[i].get(), "length", |
| 6588 lengthValue.get()); | 6455 lengthValue.get()); |
| 6589 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6456 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6632 GetObjectDefaultValue(argsValue[i].get(), resultValues[index]); | 6499 GetObjectDefaultValue(argsValue[i].get(), resultValues[index]); |
| 6633 index++; | 6500 index++; |
| 6634 } else { | 6501 } else { |
| 6635 FXJSE_Value_Set(resultValues[index], argsValue[i].get()); | 6502 FXJSE_Value_Set(resultValues[index], argsValue[i].get()); |
| 6636 index++; | 6503 index++; |
| 6637 } | 6504 } |
| 6638 } | 6505 } |
| 6639 } | 6506 } |
| 6640 | 6507 |
| 6641 // static | 6508 // static |
| 6642 void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pObjectValue, | 6509 void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pValue, |
| 6643 CFXJSE_Value* pDefaultValue) { | 6510 CFXJSE_Value* pDefaultValue) { |
| 6644 CXFA_Node* pNode = | 6511 CXFA_Node* pNode = ToNode(CXFA_ScriptContext::ToObject(pValue, nullptr)); |
| 6645 ToNode((CXFA_Object*)FXJSE_Value_ToObject(pObjectValue, nullptr)); | 6512 if (!pNode) { |
| 6646 if (pNode) { | |
| 6647 pNode->Script_Som_DefaultValue(pDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); | |
| 6648 } else { | |
| 6649 FXJSE_Value_SetNull(pDefaultValue); | 6513 FXJSE_Value_SetNull(pDefaultValue); |
| 6514 return; |
| 6650 } | 6515 } |
| 6516 pNode->Script_Som_DefaultValue(pDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); |
| 6651 } | 6517 } |
| 6652 | 6518 |
| 6653 // static | 6519 // static |
| 6654 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pObjectValue, | 6520 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pValue, |
| 6655 CFXJSE_Value* hNewValue) { | 6521 CFXJSE_Value* hNewValue) { |
| 6656 CXFA_Node* pNode = | 6522 CXFA_Node* pNode = ToNode(CXFA_ScriptContext::ToObject(pValue, nullptr)); |
| 6657 ToNode((CXFA_Object*)FXJSE_Value_ToObject(pObjectValue, nullptr)); | 6523 if (!pNode) |
| 6658 if (pNode) { | 6524 return FALSE; |
| 6659 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); | 6525 |
| 6660 return TRUE; | 6526 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); |
| 6661 } | 6527 return TRUE; |
| 6662 return FALSE; | |
| 6663 } | 6528 } |
| 6664 | 6529 |
| 6665 // static | 6530 // static |
| 6666 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, | 6531 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, |
| 6667 int32_t iIndexFlags, | 6532 int32_t iIndexFlags, |
| 6668 int32_t iIndexValue, | 6533 int32_t iIndexValue, |
| 6669 FX_BOOL bIsStar, | 6534 FX_BOOL bIsStar, |
| 6670 CFX_ByteString& szSomExp) { | 6535 CFX_ByteString& szSomExp) { |
| 6671 if (bIsStar) { | 6536 if (bIsStar) { |
| 6672 szSomExp = szName + "[*]"; | 6537 szSomExp = szName + "[*]"; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6692 szSomExp += "]"; | 6557 szSomExp += "]"; |
| 6693 } | 6558 } |
| 6694 } | 6559 } |
| 6695 | 6560 |
| 6696 // static | 6561 // static |
| 6697 FX_BOOL CXFA_FM2JSContext::GetObjectByName( | 6562 FX_BOOL CXFA_FM2JSContext::GetObjectByName( |
| 6698 CFXJSE_Value* pThis, | 6563 CFXJSE_Value* pThis, |
| 6699 CFXJSE_Value* accessorValue, | 6564 CFXJSE_Value* accessorValue, |
| 6700 const CFX_ByteStringC& szAccessorName) { | 6565 const CFX_ByteStringC& szAccessorName) { |
| 6701 FX_BOOL bFlags = FALSE; | 6566 FX_BOOL bFlags = FALSE; |
| 6702 CXFA_FM2JSContext* pContext = | 6567 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 6703 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6704 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 6705 if (!pDoc) { | 6568 if (!pDoc) { |
| 6706 return bFlags; | 6569 return bFlags; |
| 6707 } | 6570 } |
| 6708 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); | 6571 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); |
| 6709 XFA_RESOLVENODE_RS resoveNodeRS; | 6572 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6710 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 6573 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 6711 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6574 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 6712 int32_t iRet = pScriptContext->ResolveObjects( | 6575 int32_t iRet = pScriptContext->ResolveObjects( |
| 6713 pScriptContext->GetThisObject(), | 6576 pScriptContext->GetThisObject(), |
| 6714 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, | 6577 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, |
| 6715 dwFlags); | 6578 dwFlags); |
| 6716 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 6579 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
| 6717 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( | 6580 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( |
| 6718 resoveNodeRS.nodes.GetAt(0))); | 6581 resoveNodeRS.nodes.GetAt(0))); |
| 6719 bFlags = TRUE; | 6582 bFlags = TRUE; |
| 6720 } | 6583 } |
| 6721 return bFlags; | 6584 return bFlags; |
| 6722 } | 6585 } |
| 6723 | 6586 |
| 6724 // static | 6587 // static |
| 6725 int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, | 6588 int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, |
| 6726 CFXJSE_Value* pRefValue, | 6589 CFXJSE_Value* pRefValue, |
| 6727 const CFX_ByteStringC& bsSomExp, | 6590 const CFX_ByteStringC& bsSomExp, |
| 6728 XFA_RESOLVENODE_RS& resoveNodeRS, | 6591 XFA_RESOLVENODE_RS& resoveNodeRS, |
| 6729 FX_BOOL bdotAccessor, | 6592 FX_BOOL bdotAccessor, |
| 6730 FX_BOOL bHasNoResolveName) { | 6593 FX_BOOL bHasNoResolveName) { |
| 6731 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); | 6594 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); |
| 6732 int32_t iRet = -1; | 6595 int32_t iRet = -1; |
| 6733 CXFA_FM2JSContext* pContext = | 6596 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 6734 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6735 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 6736 if (!pDoc) { | 6597 if (!pDoc) { |
| 6737 return iRet; | 6598 return iRet; |
| 6738 } | 6599 } |
| 6739 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); | 6600 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); |
| 6740 CXFA_Object* pNode = nullptr; | 6601 CXFA_Object* pNode = nullptr; |
| 6741 uint32_t dFlags = 0UL; | 6602 uint32_t dFlags = 0UL; |
| 6742 if (bdotAccessor) { | 6603 if (bdotAccessor) { |
| 6743 if (FXJSE_Value_IsNull(pRefValue)) { | 6604 if (FXJSE_Value_IsNull(pRefValue)) { |
| 6744 pNode = pScriptContext->GetThisObject(); | 6605 pNode = pScriptContext->GetThisObject(); |
| 6745 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6606 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 6746 } else { | 6607 } else { |
| 6747 pNode = (CXFA_Object*)FXJSE_Value_ToObject(pRefValue, nullptr); | 6608 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); |
| 6748 ASSERT(pNode); | 6609 ASSERT(pNode); |
| 6749 if (bHasNoResolveName) { | 6610 if (bHasNoResolveName) { |
| 6750 CFX_WideString wsName; | 6611 CFX_WideString wsName; |
| 6751 if (CXFA_Node* pXFANode = pNode->AsNode()) { | 6612 if (CXFA_Node* pXFANode = pNode->AsNode()) { |
| 6752 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); | 6613 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); |
| 6753 } | 6614 } |
| 6754 if (wsName.IsEmpty()) { | 6615 if (wsName.IsEmpty()) { |
| 6755 CFX_WideStringC className; | 6616 CFX_WideStringC className; |
| 6756 pNode->GetClassName(className); | 6617 pNode->GetClassName(className); |
| 6757 wsName = FX_WSTRC(L"#") + className; | 6618 wsName = FX_WSTRC(L"#") + className; |
| 6758 } | 6619 } |
| 6759 wsSomExpression = wsName + wsSomExpression; | 6620 wsSomExpression = wsName + wsSomExpression; |
| 6760 dFlags = XFA_RESOLVENODE_Siblings; | 6621 dFlags = XFA_RESOLVENODE_Siblings; |
| 6761 } else { | 6622 } else { |
| 6762 dFlags = (bsSomExp == "*") | 6623 dFlags = (bsSomExp == "*") |
| 6763 ? (XFA_RESOLVENODE_Children) | 6624 ? (XFA_RESOLVENODE_Children) |
| 6764 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 6625 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
| 6765 XFA_RESOLVENODE_Properties); | 6626 XFA_RESOLVENODE_Properties); |
| 6766 } | 6627 } |
| 6767 } | 6628 } |
| 6768 } else { | 6629 } else { |
| 6769 pNode = (CXFA_Object*)FXJSE_Value_ToObject(pRefValue, nullptr); | 6630 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); |
| 6770 dFlags = XFA_RESOLVENODE_AnyChild; | 6631 dFlags = XFA_RESOLVENODE_AnyChild; |
| 6771 } | 6632 } |
| 6772 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), | 6633 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), |
| 6773 resoveNodeRS, dFlags); | 6634 resoveNodeRS, dFlags); |
| 6774 return iRet; | 6635 return iRet; |
| 6775 } | 6636 } |
| 6776 | 6637 |
| 6777 // static | 6638 // static |
| 6778 void CXFA_FM2JSContext::ParseResolveResult( | 6639 void CXFA_FM2JSContext::ParseResolveResult( |
| 6779 CFXJSE_Value* pThis, | 6640 CFXJSE_Value* pThis, |
| 6780 const XFA_RESOLVENODE_RS& resoveNodeRS, | 6641 const XFA_RESOLVENODE_RS& resoveNodeRS, |
| 6781 CFXJSE_Value* pParentValue, | 6642 CFXJSE_Value* pParentValue, |
| 6782 CFXJSE_Value**& resultValues, | 6643 CFXJSE_Value**& resultValues, |
| 6783 int32_t& iSize, | 6644 int32_t& iSize, |
| 6784 FX_BOOL& bAttribute) { | 6645 FX_BOOL& bAttribute) { |
| 6785 CXFA_FM2JSContext* pContext = | 6646 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6786 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6787 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6647 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6788 iSize = 0; | 6648 iSize = 0; |
| 6789 resultValues = nullptr; | 6649 resultValues = nullptr; |
| 6790 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 6650 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
| 6791 bAttribute = FALSE; | 6651 bAttribute = FALSE; |
| 6792 iSize = resoveNodeRS.nodes.GetSize(); | 6652 iSize = resoveNodeRS.nodes.GetSize(); |
| 6793 resultValues = FX_Alloc(CFXJSE_Value*, iSize); | 6653 resultValues = FX_Alloc(CFXJSE_Value*, iSize); |
| 6794 for (int32_t i = 0; i < iSize; i++) { | 6654 for (int32_t i = 0; i < iSize; i++) { |
| 6795 resultValues[i] = new CFXJSE_Value(pIsolate); | 6655 resultValues[i] = new CFXJSE_Value(pIsolate); |
| 6796 FXJSE_Value_Set( | 6656 FXJSE_Value_Set( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6816 resultValues[i] = new CFXJSE_Value(pIsolate); | 6676 resultValues[i] = new CFXJSE_Value(pIsolate); |
| 6817 FXJSE_Value_Set(resultValues[i], objectProperties[i]); | 6677 FXJSE_Value_Set(resultValues[i], objectProperties[i]); |
| 6818 } | 6678 } |
| 6819 } | 6679 } |
| 6820 } | 6680 } |
| 6821 } | 6681 } |
| 6822 | 6682 |
| 6823 // static | 6683 // static |
| 6824 int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, | 6684 int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, |
| 6825 CFXJSE_Value* pValue) { | 6685 CFXJSE_Value* pValue) { |
| 6826 CXFA_FM2JSContext* pContext = | 6686 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6827 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6828 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6829 int32_t iValue = 0; | 6687 int32_t iValue = 0; |
| 6830 if (FXJSE_Value_IsArray(pValue)) { | 6688 if (FXJSE_Value_IsArray(pValue)) { |
| 6831 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6689 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6832 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6690 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6833 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); | 6691 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); |
| 6834 FXJSE_Value_GetObjectPropByIdx(pValue, 1, propertyValue.get()); | 6692 FXJSE_Value_GetObjectPropByIdx(pValue, 1, propertyValue.get()); |
| 6835 FXJSE_Value_GetObjectPropByIdx(pValue, 2, jsObjectValue.get()); | 6693 FXJSE_Value_GetObjectPropByIdx(pValue, 2, jsObjectValue.get()); |
| 6836 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6694 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6837 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); | 6695 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
| 6838 } else { | 6696 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6854 iValue = FXSYS_atoi(szValue.c_str()); | 6712 iValue = FXSYS_atoi(szValue.c_str()); |
| 6855 } else { | 6713 } else { |
| 6856 iValue = FXJSE_Value_ToInteger(pValue); | 6714 iValue = FXJSE_Value_ToInteger(pValue); |
| 6857 } | 6715 } |
| 6858 return iValue; | 6716 return iValue; |
| 6859 } | 6717 } |
| 6860 | 6718 |
| 6861 // static | 6719 // static |
| 6862 FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, | 6720 FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, |
| 6863 CFXJSE_Value* arg) { | 6721 CFXJSE_Value* arg) { |
| 6864 CXFA_FM2JSContext* pContext = | 6722 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6865 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6866 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6867 FX_FLOAT fRet = 0.0f; | 6723 FX_FLOAT fRet = 0.0f; |
| 6868 if (FXJSE_Value_IsArray(arg)) { | 6724 if (FXJSE_Value_IsArray(arg)) { |
| 6869 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6725 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6870 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6726 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6871 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); | 6727 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); |
| 6872 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); | 6728 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); |
| 6873 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); | 6729 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); |
| 6874 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6730 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6875 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); | 6731 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
| 6876 } else { | 6732 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6892 fRet = 0; | 6748 fRet = 0; |
| 6893 } else { | 6749 } else { |
| 6894 fRet = FXJSE_Value_ToFloat(arg); | 6750 fRet = FXJSE_Value_ToFloat(arg); |
| 6895 } | 6751 } |
| 6896 return fRet; | 6752 return fRet; |
| 6897 } | 6753 } |
| 6898 | 6754 |
| 6899 // static | 6755 // static |
| 6900 FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, | 6756 FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, |
| 6901 CFXJSE_Value* arg) { | 6757 CFXJSE_Value* arg) { |
| 6902 CXFA_FM2JSContext* pContext = | 6758 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6903 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6904 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6905 FX_DOUBLE dRet = 0; | 6759 FX_DOUBLE dRet = 0; |
| 6906 if (FXJSE_Value_IsArray(arg)) { | 6760 if (FXJSE_Value_IsArray(arg)) { |
| 6907 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6761 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6908 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6762 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6909 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); | 6763 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); |
| 6910 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); | 6764 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); |
| 6911 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); | 6765 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); |
| 6912 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6766 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6913 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); | 6767 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
| 6914 } else { | 6768 } else { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 6933 } | 6787 } |
| 6934 return dRet; | 6788 return dRet; |
| 6935 } | 6789 } |
| 6936 | 6790 |
| 6937 // static. | 6791 // static. |
| 6938 double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, | 6792 double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, |
| 6939 CFXJSE_Value* src, | 6793 CFXJSE_Value* src, |
| 6940 bool* ret) { | 6794 bool* ret) { |
| 6941 ASSERT(ret); | 6795 ASSERT(ret); |
| 6942 | 6796 |
| 6943 CXFA_FM2JSContext* pContext = | 6797 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6944 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6945 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6946 | |
| 6947 *ret = true; | 6798 *ret = true; |
| 6948 | 6799 |
| 6949 if (FXJSE_Value_IsArray(src)) { | 6800 if (FXJSE_Value_IsArray(src)) { |
| 6950 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6801 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6951 FXJSE_Value_GetObjectProp(src, "length", lengthValue.get()); | 6802 FXJSE_Value_GetObjectProp(src, "length", lengthValue.get()); |
| 6952 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6803 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| 6953 if (iLength <= 2) { | 6804 if (iLength <= 2) { |
| 6954 *ret = false; | 6805 *ret = false; |
| 6955 return 0.0; | 6806 return 0.0; |
| 6956 } | 6807 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7033 CFX_WideString wsFormat; | 6884 CFX_WideString wsFormat; |
| 7034 pAppProvider->LoadString(iStringID, wsFormat); | 6885 pAppProvider->LoadString(iStringID, wsFormat); |
| 7035 CFX_WideString wsMessage; | 6886 CFX_WideString wsMessage; |
| 7036 va_list arg_ptr; | 6887 va_list arg_ptr; |
| 7037 va_start(arg_ptr, iStringID); | 6888 va_start(arg_ptr, iStringID); |
| 7038 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); | 6889 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); |
| 7039 va_end(arg_ptr); | 6890 va_end(arg_ptr); |
| 7040 FXJSE_ThrowMessage( | 6891 FXJSE_ThrowMessage( |
| 7041 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 6892 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
| 7042 } | 6893 } |
| OLD | NEW |