| 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 int32_t argc = args.GetLength(); | 2986 int32_t argc = args.GetLength(); |
| 3037 if (argc > 1) { | 2987 if (argc > 1) { |
| 3038 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 2988 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 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 if (args.GetLength() == 1) { | 3190 if (args.GetLength() == 1) { |
| 3249 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 3191 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5311 } break; | 5230 } break; |
| 5312 default: | 5231 default: |
| 5313 break; | 5232 break; |
| 5314 } | 5233 } |
| 5315 } | 5234 } |
| 5316 | 5235 |
| 5317 // static | 5236 // static |
| 5318 void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, | 5237 void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, |
| 5319 const CFX_ByteStringC& szFuncName, | 5238 const CFX_ByteStringC& szFuncName, |
| 5320 CFXJSE_Arguments& args) { | 5239 CFXJSE_Arguments& args) { |
| 5321 CXFA_FM2JSContext* pContext = | 5240 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5322 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5323 if (args.GetLength() == 1) { | 5241 if (args.GetLength() == 1) { |
| 5324 CXFA_Document* pDoc = pContext->GetDocument(); | 5242 CXFA_Document* pDoc = pContext->GetDocument(); |
| 5325 if (!pDoc) { | 5243 if (!pDoc) { |
| 5326 return; | 5244 return; |
| 5327 } | 5245 } |
| 5328 IXFA_AppProvider* pAppProvider = | 5246 IXFA_AppProvider* pAppProvider = |
| 5329 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5247 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
| 5330 if (!pAppProvider) { | 5248 if (!pAppProvider) { |
| 5331 return; | 5249 return; |
| 5332 } | 5250 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5346 } | 5264 } |
| 5347 } else { | 5265 } else { |
| 5348 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Get"); | 5266 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Get"); |
| 5349 } | 5267 } |
| 5350 } | 5268 } |
| 5351 | 5269 |
| 5352 // static | 5270 // static |
| 5353 void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, | 5271 void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, |
| 5354 const CFX_ByteStringC& szFuncName, | 5272 const CFX_ByteStringC& szFuncName, |
| 5355 CFXJSE_Arguments& args) { | 5273 CFXJSE_Arguments& args) { |
| 5356 CXFA_FM2JSContext* pContext = | 5274 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5357 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5358 int32_t argc = args.GetLength(); | 5275 int32_t argc = args.GetLength(); |
| 5359 if ((argc >= 2) && (argc <= 5)) { | 5276 if ((argc >= 2) && (argc <= 5)) { |
| 5360 CXFA_Document* pDoc = pContext->GetDocument(); | 5277 CXFA_Document* pDoc = pContext->GetDocument(); |
| 5361 if (!pDoc) { | 5278 if (!pDoc) { |
| 5362 return; | 5279 return; |
| 5363 } | 5280 } |
| 5364 IXFA_AppProvider* pAppProvider = | 5281 IXFA_AppProvider* pAppProvider = |
| 5365 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5282 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
| 5366 if (!pAppProvider) { | 5283 if (!pAppProvider) { |
| 5367 return; | 5284 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5404 } | 5321 } |
| 5405 } else { | 5322 } else { |
| 5406 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Post"); | 5323 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Post"); |
| 5407 } | 5324 } |
| 5408 } | 5325 } |
| 5409 | 5326 |
| 5410 // static | 5327 // static |
| 5411 void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, | 5328 void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, |
| 5412 const CFX_ByteStringC& szFuncName, | 5329 const CFX_ByteStringC& szFuncName, |
| 5413 CFXJSE_Arguments& args) { | 5330 CFXJSE_Arguments& args) { |
| 5414 CXFA_FM2JSContext* pContext = | 5331 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5415 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5416 int32_t argc = args.GetLength(); | 5332 int32_t argc = args.GetLength(); |
| 5417 if ((argc == 2) || (argc == 3)) { | 5333 if ((argc == 2) || (argc == 3)) { |
| 5418 CXFA_Document* pDoc = pContext->GetDocument(); | 5334 CXFA_Document* pDoc = pContext->GetDocument(); |
| 5419 if (!pDoc) { | 5335 if (!pDoc) { |
| 5420 return; | 5336 return; |
| 5421 } | 5337 } |
| 5422 IXFA_AppProvider* pAppProvider = | 5338 IXFA_AppProvider* pAppProvider = |
| 5423 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5339 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
| 5424 if (!pAppProvider) { | 5340 if (!pAppProvider) { |
| 5425 return; | 5341 return; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5446 } | 5362 } |
| 5447 } else { | 5363 } else { |
| 5448 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Put"); | 5364 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Put"); |
| 5449 } | 5365 } |
| 5450 } | 5366 } |
| 5451 | 5367 |
| 5452 // static | 5368 // static |
| 5453 void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, | 5369 void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, |
| 5454 const CFX_ByteStringC& szFuncName, | 5370 const CFX_ByteStringC& szFuncName, |
| 5455 CFXJSE_Arguments& args) { | 5371 CFXJSE_Arguments& args) { |
| 5456 CXFA_FM2JSContext* pContext = | 5372 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5457 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5458 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5373 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 5459 if (args.GetLength() == 2) { | 5374 if (args.GetLength() == 2) { |
| 5460 std::unique_ptr<CFXJSE_Value> lValue = args.GetValue(0); | 5375 std::unique_ptr<CFXJSE_Value> lValue = args.GetValue(0); |
| 5461 std::unique_ptr<CFXJSE_Value> rValue = GetSimpleValue(pThis, args, 1); | 5376 std::unique_ptr<CFXJSE_Value> rValue = GetSimpleValue(pThis, args, 1); |
| 5462 FX_BOOL bSetStatus = TRUE; | 5377 FX_BOOL bSetStatus = TRUE; |
| 5463 if (FXJSE_Value_IsArray(lValue.get())) { | 5378 if (FXJSE_Value_IsArray(lValue.get())) { |
| 5464 std::unique_ptr<CFXJSE_Value> leftLengthValue(new CFXJSE_Value(pIsolate)); | 5379 std::unique_ptr<CFXJSE_Value> leftLengthValue(new CFXJSE_Value(pIsolate)); |
| 5465 FXJSE_Value_GetObjectProp(lValue.get(), "length", leftLengthValue.get()); | 5380 FXJSE_Value_GetObjectProp(lValue.get(), "length", leftLengthValue.get()); |
| 5466 int32_t iLeftLength = FXJSE_Value_ToInteger(leftLengthValue.get()); | 5381 int32_t iLeftLength = FXJSE_Value_ToInteger(leftLengthValue.get()); |
| 5467 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 5382 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5506 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5421 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5507 if (FXJSE_Value_IsNull(argFirst.get()) && | 5422 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5508 FXJSE_Value_IsNull(argSecond.get())) { | 5423 FXJSE_Value_IsNull(argSecond.get())) { |
| 5509 FXJSE_Value_SetNull(args.GetReturnValue()); | 5424 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5510 } else { | 5425 } else { |
| 5511 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); | 5426 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); |
| 5512 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); | 5427 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); |
| 5513 FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); | 5428 FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); |
| 5514 } | 5429 } |
| 5515 } else { | 5430 } else { |
| 5516 CXFA_FM2JSContext* pContext = | 5431 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5517 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5518 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5519 } | 5432 } |
| 5520 } | 5433 } |
| 5521 | 5434 |
| 5522 // static | 5435 // static |
| 5523 void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, | 5436 void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, |
| 5524 const CFX_ByteStringC& szFuncName, | 5437 const CFX_ByteStringC& szFuncName, |
| 5525 CFXJSE_Arguments& args) { | 5438 CFXJSE_Arguments& args) { |
| 5526 if (args.GetLength() == 2) { | 5439 if (args.GetLength() == 2) { |
| 5527 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5440 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5528 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5441 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5529 if (FXJSE_Value_IsNull(argFirst.get()) && | 5442 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5530 FXJSE_Value_IsNull(argSecond.get())) { | 5443 FXJSE_Value_IsNull(argSecond.get())) { |
| 5531 FXJSE_Value_SetNull(args.GetReturnValue()); | 5444 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5532 } else { | 5445 } else { |
| 5533 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); | 5446 FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); |
| 5534 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); | 5447 FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); |
| 5535 FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); | 5448 FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); |
| 5536 } | 5449 } |
| 5537 } else { | 5450 } else { |
| 5538 CXFA_FM2JSContext* pContext = | 5451 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5539 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5540 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5541 } | 5452 } |
| 5542 } | 5453 } |
| 5543 | 5454 |
| 5544 // static | 5455 // static |
| 5545 void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, | 5456 void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, |
| 5546 const CFX_ByteStringC& szFuncName, | 5457 const CFX_ByteStringC& szFuncName, |
| 5547 CFXJSE_Arguments& args) { | 5458 CFXJSE_Arguments& args) { |
| 5548 if (args.GetLength() == 2) { | 5459 if (args.GetLength() == 2) { |
| 5549 if (fm_ref_equal(pThis, args)) { | 5460 if (fm_ref_equal(pThis, args)) { |
| 5550 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); | 5461 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 5567 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5478 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 5568 firstOutput == secondOutput); | 5479 firstOutput == secondOutput); |
| 5569 } else { | 5480 } else { |
| 5570 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5481 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5571 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5482 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5572 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5483 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 5573 (first == second) ? 1 : 0); | 5484 (first == second) ? 1 : 0); |
| 5574 } | 5485 } |
| 5575 } | 5486 } |
| 5576 } else { | 5487 } else { |
| 5577 CXFA_FM2JSContext* pContext = | 5488 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5578 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5579 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5580 } | 5489 } |
| 5581 } | 5490 } |
| 5582 | 5491 |
| 5583 // static | 5492 // static |
| 5584 void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, | 5493 void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, |
| 5585 const CFX_ByteStringC& szFuncName, | 5494 const CFX_ByteStringC& szFuncName, |
| 5586 CFXJSE_Arguments& args) { | 5495 CFXJSE_Arguments& args) { |
| 5587 if (args.GetLength() == 2) { | 5496 if (args.GetLength() == 2) { |
| 5588 if (fm_ref_equal(pThis, args)) { | 5497 if (fm_ref_equal(pThis, args)) { |
| 5589 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5498 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5605 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5514 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5606 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5515 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 5607 firstOutput != secondOutput); | 5516 firstOutput != secondOutput); |
| 5608 } else { | 5517 } else { |
| 5609 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5518 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5610 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5519 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5611 FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); | 5520 FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); |
| 5612 } | 5521 } |
| 5613 } | 5522 } |
| 5614 } else { | 5523 } else { |
| 5615 CXFA_FM2JSContext* pContext = | 5524 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5616 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5617 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5618 } | 5525 } |
| 5619 } | 5526 } |
| 5620 | 5527 |
| 5621 // static | 5528 // static |
| 5622 FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, | 5529 FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, |
| 5623 CFXJSE_Arguments& args) { | 5530 CFXJSE_Arguments& args) { |
| 5624 FX_BOOL bRet = FALSE; | 5531 FX_BOOL bRet = FALSE; |
| 5625 CXFA_FM2JSContext* pContext = | 5532 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 5626 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5627 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 5628 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); | 5533 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); |
| 5629 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); | 5534 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); |
| 5630 if (FXJSE_Value_IsArray(argFirst.get()) && | 5535 if (FXJSE_Value_IsArray(argFirst.get()) && |
| 5631 FXJSE_Value_IsArray(argSecond.get())) { | 5536 FXJSE_Value_IsArray(argSecond.get())) { |
| 5632 std::unique_ptr<CFXJSE_Value> firstFlagValue(new CFXJSE_Value(pIsolate)); | 5537 std::unique_ptr<CFXJSE_Value> firstFlagValue(new CFXJSE_Value(pIsolate)); |
| 5633 std::unique_ptr<CFXJSE_Value> secondFlagValue(new CFXJSE_Value(pIsolate)); | 5538 std::unique_ptr<CFXJSE_Value> secondFlagValue(new CFXJSE_Value(pIsolate)); |
| 5634 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 0, firstFlagValue.get()); | 5539 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 0, firstFlagValue.get()); |
| 5635 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 0, secondFlagValue.get()); | 5540 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 0, secondFlagValue.get()); |
| 5636 if ((FXJSE_Value_ToInteger(firstFlagValue.get()) == 3) && | 5541 if ((FXJSE_Value_ToInteger(firstFlagValue.get()) == 3) && |
| 5637 (FXJSE_Value_ToInteger(secondFlagValue.get()) == 3)) { | 5542 (FXJSE_Value_ToInteger(secondFlagValue.get()) == 3)) { |
| 5638 std::unique_ptr<CFXJSE_Value> firstJSObject(new CFXJSE_Value(pIsolate)); | 5543 std::unique_ptr<CFXJSE_Value> firstJSObject(new CFXJSE_Value(pIsolate)); |
| 5639 std::unique_ptr<CFXJSE_Value> secondJSObject(new CFXJSE_Value(pIsolate)); | 5544 std::unique_ptr<CFXJSE_Value> secondJSObject(new CFXJSE_Value(pIsolate)); |
| 5640 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 2, firstJSObject.get()); | 5545 FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 2, firstJSObject.get()); |
| 5641 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 2, secondJSObject.get()); | 5546 FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 2, secondJSObject.get()); |
| 5642 if (!FXJSE_Value_IsNull(firstJSObject.get()) && | 5547 if (!FXJSE_Value_IsNull(firstJSObject.get()) && |
| 5643 !FXJSE_Value_IsNull(secondJSObject.get())) { | 5548 !FXJSE_Value_IsNull(secondJSObject.get())) { |
| 5644 bRet = (FXJSE_Value_ToObject(firstJSObject.get(), nullptr) == | 5549 bRet = (firstJSObject->ToHostObject(nullptr) == |
| 5645 FXJSE_Value_ToObject(secondJSObject.get(), nullptr)); | 5550 secondJSObject->ToHostObject(nullptr)); |
| 5646 } | 5551 } |
| 5647 } | 5552 } |
| 5648 } | 5553 } |
| 5649 return bRet; | 5554 return bRet; |
| 5650 } | 5555 } |
| 5651 | 5556 |
| 5652 // static | 5557 // static |
| 5653 void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, | 5558 void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, |
| 5654 const CFX_ByteStringC& szFuncName, | 5559 const CFX_ByteStringC& szFuncName, |
| 5655 CFXJSE_Arguments& args) { | 5560 CFXJSE_Arguments& args) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5667 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5572 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5668 FXJSE_Value_SetInteger( | 5573 FXJSE_Value_SetInteger( |
| 5669 args.GetReturnValue(), | 5574 args.GetReturnValue(), |
| 5670 firstOutput.Compare(secondOutput.AsStringC()) == -1); | 5575 firstOutput.Compare(secondOutput.AsStringC()) == -1); |
| 5671 } else { | 5576 } else { |
| 5672 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5577 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5673 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5578 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5674 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); | 5579 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); |
| 5675 } | 5580 } |
| 5676 } else { | 5581 } else { |
| 5677 CXFA_FM2JSContext* pContext = | 5582 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5678 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5679 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5680 } | 5583 } |
| 5681 } | 5584 } |
| 5682 | 5585 |
| 5683 // static | 5586 // static |
| 5684 void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, | 5587 void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, |
| 5685 const CFX_ByteStringC& szFuncName, | 5588 const CFX_ByteStringC& szFuncName, |
| 5686 CFXJSE_Arguments& args) { | 5589 CFXJSE_Arguments& args) { |
| 5687 if (args.GetLength() == 2) { | 5590 if (args.GetLength() == 2) { |
| 5688 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5591 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5689 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5592 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5702 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5605 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5703 FXJSE_Value_SetInteger( | 5606 FXJSE_Value_SetInteger( |
| 5704 args.GetReturnValue(), | 5607 args.GetReturnValue(), |
| 5705 firstOutput.Compare(secondOutput.AsStringC()) != 1); | 5608 firstOutput.Compare(secondOutput.AsStringC()) != 1); |
| 5706 } else { | 5609 } else { |
| 5707 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5610 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5708 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5611 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5709 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); | 5612 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); |
| 5710 } | 5613 } |
| 5711 } else { | 5614 } else { |
| 5712 CXFA_FM2JSContext* pContext = | 5615 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5713 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5714 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5715 } | 5616 } |
| 5716 } | 5617 } |
| 5717 | 5618 |
| 5718 // static | 5619 // static |
| 5719 void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, | 5620 void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, |
| 5720 const CFX_ByteStringC& szFuncName, | 5621 const CFX_ByteStringC& szFuncName, |
| 5721 CFXJSE_Arguments& args) { | 5622 CFXJSE_Arguments& args) { |
| 5722 if (args.GetLength() == 2) { | 5623 if (args.GetLength() == 2) { |
| 5723 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5624 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5724 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5625 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5725 if (FXJSE_Value_IsNull(argFirst.get()) || | 5626 if (FXJSE_Value_IsNull(argFirst.get()) || |
| 5726 FXJSE_Value_IsNull(argSecond.get())) { | 5627 FXJSE_Value_IsNull(argSecond.get())) { |
| 5727 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5628 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 5728 } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && | 5629 } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && |
| 5729 FXJSE_Value_IsUTF8String(argSecond.get())) { | 5630 FXJSE_Value_IsUTF8String(argSecond.get())) { |
| 5730 CFX_ByteString firstOutput; | 5631 CFX_ByteString firstOutput; |
| 5731 CFX_ByteString secondOutput; | 5632 CFX_ByteString secondOutput; |
| 5732 FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); | 5633 FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); |
| 5733 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5634 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5734 FXJSE_Value_SetInteger( | 5635 FXJSE_Value_SetInteger( |
| 5735 args.GetReturnValue(), | 5636 args.GetReturnValue(), |
| 5736 firstOutput.Compare(secondOutput.AsStringC()) == 1); | 5637 firstOutput.Compare(secondOutput.AsStringC()) == 1); |
| 5737 } else { | 5638 } else { |
| 5738 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5639 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5739 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5640 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5740 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); | 5641 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); |
| 5741 } | 5642 } |
| 5742 } else { | 5643 } else { |
| 5743 CXFA_FM2JSContext* pContext = | 5644 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5744 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5745 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5746 } | 5645 } |
| 5747 } | 5646 } |
| 5748 | 5647 |
| 5749 // static | 5648 // static |
| 5750 void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, | 5649 void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, |
| 5751 const CFX_ByteStringC& szFuncName, | 5650 const CFX_ByteStringC& szFuncName, |
| 5752 CFXJSE_Arguments& args) { | 5651 CFXJSE_Arguments& args) { |
| 5753 if (args.GetLength() == 2) { | 5652 if (args.GetLength() == 2) { |
| 5754 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5653 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5755 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5654 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5768 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); | 5667 FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); |
| 5769 FXJSE_Value_SetInteger( | 5668 FXJSE_Value_SetInteger( |
| 5770 args.GetReturnValue(), | 5669 args.GetReturnValue(), |
| 5771 firstOutput.Compare(secondOutput.AsStringC()) != -1); | 5670 firstOutput.Compare(secondOutput.AsStringC()) != -1); |
| 5772 } else { | 5671 } else { |
| 5773 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5672 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5774 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5673 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5775 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); | 5674 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); |
| 5776 } | 5675 } |
| 5777 } else { | 5676 } else { |
| 5778 CXFA_FM2JSContext* pContext = | 5677 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5779 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5780 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5781 } | 5678 } |
| 5782 } | 5679 } |
| 5783 | 5680 |
| 5784 // static | 5681 // static |
| 5785 void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, | 5682 void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, |
| 5786 const CFX_ByteStringC& szFuncName, | 5683 const CFX_ByteStringC& szFuncName, |
| 5787 CFXJSE_Arguments& args) { | 5684 CFXJSE_Arguments& args) { |
| 5788 if (args.GetLength() == 2) { | 5685 if (args.GetLength() == 2) { |
| 5789 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); | 5686 std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); |
| 5790 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); | 5687 std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); |
| 5791 if (ValueIsNull(pThis, argFirst.get()) && | 5688 if (ValueIsNull(pThis, argFirst.get()) && |
| 5792 ValueIsNull(pThis, argSecond.get())) { | 5689 ValueIsNull(pThis, argSecond.get())) { |
| 5793 FXJSE_Value_SetNull(args.GetReturnValue()); | 5690 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5794 } else { | 5691 } else { |
| 5795 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5692 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5796 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5693 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5797 FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); | 5694 FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); |
| 5798 } | 5695 } |
| 5799 } else { | 5696 } else { |
| 5800 CXFA_FM2JSContext* pContext = | 5697 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5801 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5802 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5803 } | 5698 } |
| 5804 } | 5699 } |
| 5805 | 5700 |
| 5806 // static | 5701 // static |
| 5807 void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, | 5702 void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, |
| 5808 const CFX_ByteStringC& szFuncName, | 5703 const CFX_ByteStringC& szFuncName, |
| 5809 CFXJSE_Arguments& args) { | 5704 CFXJSE_Arguments& args) { |
| 5810 if (args.GetLength() == 2) { | 5705 if (args.GetLength() == 2) { |
| 5811 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5706 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5812 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5707 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5813 if (FXJSE_Value_IsNull(argFirst.get()) && | 5708 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5814 FXJSE_Value_IsNull(argSecond.get())) { | 5709 FXJSE_Value_IsNull(argSecond.get())) { |
| 5815 FXJSE_Value_SetNull(args.GetReturnValue()); | 5710 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5816 } else { | 5711 } else { |
| 5817 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5712 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5818 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5713 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5819 FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); | 5714 FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); |
| 5820 } | 5715 } |
| 5821 } else { | 5716 } else { |
| 5822 CXFA_FM2JSContext* pContext = | 5717 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5823 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5824 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5825 } | 5718 } |
| 5826 } | 5719 } |
| 5827 | 5720 |
| 5828 // static | 5721 // static |
| 5829 void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, | 5722 void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, |
| 5830 const CFX_ByteStringC& szFuncName, | 5723 const CFX_ByteStringC& szFuncName, |
| 5831 CFXJSE_Arguments& args) { | 5724 CFXJSE_Arguments& args) { |
| 5832 if (args.GetLength() == 2) { | 5725 if (args.GetLength() == 2) { |
| 5833 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5726 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5834 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5727 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5835 if (FXJSE_Value_IsNull(argFirst.get()) && | 5728 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5836 FXJSE_Value_IsNull(argSecond.get())) { | 5729 FXJSE_Value_IsNull(argSecond.get())) { |
| 5837 FXJSE_Value_SetNull(args.GetReturnValue()); | 5730 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5838 } else { | 5731 } else { |
| 5839 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5732 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5840 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5733 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5841 FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); | 5734 FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); |
| 5842 } | 5735 } |
| 5843 } else { | 5736 } else { |
| 5844 CXFA_FM2JSContext* pContext = | 5737 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5845 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5846 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5847 } | 5738 } |
| 5848 } | 5739 } |
| 5849 | 5740 |
| 5850 // static | 5741 // static |
| 5851 void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, | 5742 void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, |
| 5852 const CFX_ByteStringC& szFuncName, | 5743 const CFX_ByteStringC& szFuncName, |
| 5853 CFXJSE_Arguments& args) { | 5744 CFXJSE_Arguments& args) { |
| 5854 CXFA_FM2JSContext* pContext = | 5745 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5855 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5856 if (args.GetLength() == 2) { | 5746 if (args.GetLength() == 2) { |
| 5857 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); | 5747 std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| 5858 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); | 5748 std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| 5859 if (FXJSE_Value_IsNull(argFirst.get()) && | 5749 if (FXJSE_Value_IsNull(argFirst.get()) && |
| 5860 FXJSE_Value_IsNull(argSecond.get())) { | 5750 FXJSE_Value_IsNull(argSecond.get())) { |
| 5861 FXJSE_Value_SetNull(args.GetReturnValue()); | 5751 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5862 } else { | 5752 } else { |
| 5863 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); | 5753 FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); |
| 5864 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); | 5754 FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); |
| 5865 if (second == 0.0) { | 5755 if (second == 0.0) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5879 CFXJSE_Arguments& args) { | 5769 CFXJSE_Arguments& args) { |
| 5880 if (args.GetLength() == 1) { | 5770 if (args.GetLength() == 1) { |
| 5881 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 5771 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 5882 if (FXJSE_Value_IsNull(argOne.get())) { | 5772 if (FXJSE_Value_IsNull(argOne.get())) { |
| 5883 FXJSE_Value_SetNull(args.GetReturnValue()); | 5773 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5884 } else { | 5774 } else { |
| 5885 FXJSE_Value_SetDouble(args.GetReturnValue(), | 5775 FXJSE_Value_SetDouble(args.GetReturnValue(), |
| 5886 0.0 + ValueToDouble(pThis, argOne.get())); | 5776 0.0 + ValueToDouble(pThis, argOne.get())); |
| 5887 } | 5777 } |
| 5888 } else { | 5778 } else { |
| 5889 CXFA_FM2JSContext* pContext = | 5779 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5890 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5891 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5892 } | 5780 } |
| 5893 } | 5781 } |
| 5894 | 5782 |
| 5895 // static | 5783 // static |
| 5896 void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, | 5784 void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, |
| 5897 const CFX_ByteStringC& szFuncName, | 5785 const CFX_ByteStringC& szFuncName, |
| 5898 CFXJSE_Arguments& args) { | 5786 CFXJSE_Arguments& args) { |
| 5899 if (args.GetLength() == 1) { | 5787 if (args.GetLength() == 1) { |
| 5900 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 5788 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 5901 if (FXJSE_Value_IsNull(argOne.get())) { | 5789 if (FXJSE_Value_IsNull(argOne.get())) { |
| 5902 FXJSE_Value_SetNull(args.GetReturnValue()); | 5790 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5903 } else { | 5791 } else { |
| 5904 FXJSE_Value_SetDouble(args.GetReturnValue(), | 5792 FXJSE_Value_SetDouble(args.GetReturnValue(), |
| 5905 0.0 - ValueToDouble(pThis, argOne.get())); | 5793 0.0 - ValueToDouble(pThis, argOne.get())); |
| 5906 } | 5794 } |
| 5907 } else { | 5795 } else { |
| 5908 CXFA_FM2JSContext* pContext = | 5796 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5909 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5910 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5911 } | 5797 } |
| 5912 } | 5798 } |
| 5913 | 5799 |
| 5914 // static | 5800 // static |
| 5915 void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, | 5801 void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, |
| 5916 const CFX_ByteStringC& szFuncName, | 5802 const CFX_ByteStringC& szFuncName, |
| 5917 CFXJSE_Arguments& args) { | 5803 CFXJSE_Arguments& args) { |
| 5918 if (args.GetLength() == 1) { | 5804 if (args.GetLength() == 1) { |
| 5919 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 5805 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 5920 if (FXJSE_Value_IsNull(argOne.get())) { | 5806 if (FXJSE_Value_IsNull(argOne.get())) { |
| 5921 FXJSE_Value_SetNull(args.GetReturnValue()); | 5807 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5922 } else { | 5808 } else { |
| 5923 FX_DOUBLE first = ValueToDouble(pThis, argOne.get()); | 5809 FX_DOUBLE first = ValueToDouble(pThis, argOne.get()); |
| 5924 FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); | 5810 FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); |
| 5925 } | 5811 } |
| 5926 } else { | 5812 } else { |
| 5927 CXFA_FM2JSContext* pContext = | 5813 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 5928 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5929 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | |
| 5930 } | 5814 } |
| 5931 } | 5815 } |
| 5932 | 5816 |
| 5933 // static | 5817 // static |
| 5934 void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, | 5818 void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, |
| 5935 const CFX_ByteStringC& szFuncName, | 5819 const CFX_ByteStringC& szFuncName, |
| 5936 CFXJSE_Arguments& args) { | 5820 CFXJSE_Arguments& args) { |
| 5937 CXFA_FM2JSContext* pContext = | 5821 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 5938 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 5939 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5822 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 5940 int32_t argc = args.GetLength(); | 5823 int32_t argc = args.GetLength(); |
| 5941 if ((argc == 4) || (argc == 5)) { | 5824 if ((argc == 4) || (argc == 5)) { |
| 5942 FX_BOOL bIsStar = TRUE; | 5825 FX_BOOL bIsStar = TRUE; |
| 5943 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); | 5826 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); |
| 5944 CFX_ByteString bsAccessorName = args.GetUTF8String(1); | 5827 CFX_ByteString bsAccessorName = args.GetUTF8String(1); |
| 5945 CFX_ByteString szName = args.GetUTF8String(2); | 5828 CFX_ByteString szName = args.GetUTF8String(2); |
| 5946 int32_t iIndexFlags = args.GetInt32(3); | 5829 int32_t iIndexFlags = args.GetInt32(3); |
| 5947 int32_t iIndexValue = 0; | 5830 int32_t iIndexValue = 0; |
| 5948 if (argc == 5) { | 5831 if (argc == 5) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6076 } | 5959 } |
| 6077 } else { | 5960 } else { |
| 6078 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 5961 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6079 } | 5962 } |
| 6080 } | 5963 } |
| 6081 | 5964 |
| 6082 // static | 5965 // static |
| 6083 void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, | 5966 void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, |
| 6084 const CFX_ByteStringC& szFuncName, | 5967 const CFX_ByteStringC& szFuncName, |
| 6085 CFXJSE_Arguments& args) { | 5968 CFXJSE_Arguments& args) { |
| 6086 CXFA_FM2JSContext* pContext = | 5969 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6087 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6088 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5970 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6089 int32_t argc = args.GetLength(); | 5971 int32_t argc = args.GetLength(); |
| 6090 if ((argc == 4) || (argc == 5)) { | 5972 if ((argc == 4) || (argc == 5)) { |
| 6091 FX_BOOL bIsStar = TRUE; | 5973 FX_BOOL bIsStar = TRUE; |
| 6092 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); | 5974 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); |
| 6093 CFX_ByteString bsAccessorName = args.GetUTF8String(1); | 5975 CFX_ByteString bsAccessorName = args.GetUTF8String(1); |
| 6094 CFX_ByteString szName = args.GetUTF8String(2); | 5976 CFX_ByteString szName = args.GetUTF8String(2); |
| 6095 int32_t iIndexFlags = args.GetInt32(3); | 5977 int32_t iIndexFlags = args.GetInt32(3); |
| 6096 int32_t iIndexValue = 0; | 5978 int32_t iIndexValue = 0; |
| 6097 if (argc == 5) { | 5979 if (argc == 5) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6220 } | 6102 } |
| 6221 } else { | 6103 } else { |
| 6222 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 6104 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6223 } | 6105 } |
| 6224 } | 6106 } |
| 6225 | 6107 |
| 6226 // static | 6108 // static |
| 6227 void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, | 6109 void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, |
| 6228 const CFX_ByteStringC& szFuncName, | 6110 const CFX_ByteStringC& szFuncName, |
| 6229 CFXJSE_Arguments& args) { | 6111 CFXJSE_Arguments& args) { |
| 6230 CXFA_FM2JSContext* pContext = | 6112 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6231 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6232 if (args.GetLength() == 1) { | 6113 if (args.GetLength() == 1) { |
| 6233 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); | 6114 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| 6234 CFX_ByteString argString; | 6115 CFX_ByteString argString; |
| 6235 ValueToUTF8String(argOne.get(), argString); | 6116 ValueToUTF8String(argOne.get(), argString); |
| 6236 if (argString.IsEmpty()) { | 6117 if (argString.IsEmpty()) { |
| 6237 pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); | 6118 pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); |
| 6238 } else { | 6119 } else { |
| 6239 CFX_WideString scriptString = | 6120 CFX_WideString scriptString = |
| 6240 CFX_WideString::FromUTF8(argString.AsStringC()); | 6121 CFX_WideString::FromUTF8(argString.AsStringC()); |
| 6241 CFX_WideTextBuf wsJavaScriptBuf; | 6122 CFX_WideTextBuf wsJavaScriptBuf; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6280 FXJSE_Value_SetBoolean(args.GetReturnValue(), bIsArray); | 6161 FXJSE_Value_SetBoolean(args.GetReturnValue(), bIsArray); |
| 6281 } else { | 6162 } else { |
| 6282 FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); | 6163 FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); |
| 6283 } | 6164 } |
| 6284 } | 6165 } |
| 6285 | 6166 |
| 6286 // static | 6167 // static |
| 6287 void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, | 6168 void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, |
| 6288 const CFX_ByteStringC& szFuncName, | 6169 const CFX_ByteStringC& szFuncName, |
| 6289 CFXJSE_Arguments& args) { | 6170 CFXJSE_Arguments& args) { |
| 6290 CXFA_FM2JSContext* pContext = | 6171 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6291 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6292 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6172 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6293 if (args.GetLength() == 1) { | 6173 if (args.GetLength() == 1) { |
| 6294 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 6174 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 6295 if (FXJSE_Value_IsArray(argOne.get())) { | 6175 if (FXJSE_Value_IsArray(argOne.get())) { |
| 6296 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6176 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6297 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6177 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6298 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 1, propertyValue.get()); | 6178 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 1, propertyValue.get()); |
| 6299 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, jsObjectValue.get()); | 6179 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, jsObjectValue.get()); |
| 6300 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6180 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6301 GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue()); | 6181 GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6316 } | 6196 } |
| 6317 | 6197 |
| 6318 // static | 6198 // static |
| 6319 void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, | 6199 void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, |
| 6320 const CFX_ByteStringC& szFuncName, | 6200 const CFX_ByteStringC& szFuncName, |
| 6321 CFXJSE_Arguments& args) { | 6201 CFXJSE_Arguments& args) { |
| 6322 if (args.GetLength() == 1) { | 6202 if (args.GetLength() == 1) { |
| 6323 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 6203 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 6324 if (FXJSE_Value_IsArray(argOne.get())) { | 6204 if (FXJSE_Value_IsArray(argOne.get())) { |
| 6325 #ifndef NDEBUG | 6205 #ifndef NDEBUG |
| 6326 CXFA_FM2JSContext* pContext = | 6206 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6327 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6328 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6207 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6329 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6208 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6330 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); | 6209 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); |
| 6331 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); | 6210 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); |
| 6332 #endif | 6211 #endif |
| 6333 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, args.GetReturnValue()); | 6212 FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, args.GetReturnValue()); |
| 6334 } else { | 6213 } else { |
| 6335 FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); | 6214 FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); |
| 6336 } | 6215 } |
| 6337 } else { | 6216 } else { |
| 6338 CXFA_FM2JSContext* pContext = | 6217 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6339 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6340 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 6218 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6341 } | 6219 } |
| 6342 } | 6220 } |
| 6343 | 6221 |
| 6344 // static | 6222 // static |
| 6345 void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, | 6223 void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, |
| 6346 const CFX_ByteStringC& szFuncName, | 6224 const CFX_ByteStringC& szFuncName, |
| 6347 CFXJSE_Arguments& args) { | 6225 CFXJSE_Arguments& args) { |
| 6348 CXFA_FM2JSContext* pContext = | 6226 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6349 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6350 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6227 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6351 if (args.GetLength() == 1) { | 6228 if (args.GetLength() == 1) { |
| 6352 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); | 6229 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| 6353 if (FXJSE_Value_IsArray(argOne.get())) { | 6230 if (FXJSE_Value_IsArray(argOne.get())) { |
| 6354 #ifndef NDEBUG | 6231 #ifndef NDEBUG |
| 6355 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6232 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6356 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); | 6233 FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); |
| 6357 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); | 6234 ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); |
| 6358 #endif | 6235 #endif |
| 6359 std::unique_ptr<CFXJSE_Value> flagsValue(new CFXJSE_Value(pIsolate)); | 6236 std::unique_ptr<CFXJSE_Value> flagsValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6390 } | 6267 } |
| 6391 } else { | 6268 } else { |
| 6392 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); | 6269 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); |
| 6393 } | 6270 } |
| 6394 } | 6271 } |
| 6395 | 6272 |
| 6396 // static | 6273 // static |
| 6397 void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, | 6274 void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, |
| 6398 const CFX_ByteStringC& szFuncName, | 6275 const CFX_ByteStringC& szFuncName, |
| 6399 CFXJSE_Arguments& args) { | 6276 CFXJSE_Arguments& args) { |
| 6400 CXFA_FM2JSContext* pContext = | 6277 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6401 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6402 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6403 uint32_t iLength = 0; | 6278 uint32_t iLength = 0; |
| 6404 int32_t argc = args.GetLength(); | 6279 int32_t argc = args.GetLength(); |
| 6405 std::vector<std::unique_ptr<CFXJSE_Value>> argValues; | 6280 std::vector<std::unique_ptr<CFXJSE_Value>> argValues; |
| 6406 for (int32_t i = 0; i < argc; i++) { | 6281 for (int32_t i = 0; i < argc; i++) { |
| 6407 argValues.push_back(args.GetValue(i)); | 6282 argValues.push_back(args.GetValue(i)); |
| 6408 if (FXJSE_Value_IsArray(argValues[i].get())) { | 6283 if (FXJSE_Value_IsArray(argValues[i].get())) { |
| 6409 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6284 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6410 FXJSE_Value_GetObjectProp(argValues[i].get(), "length", | 6285 FXJSE_Value_GetObjectProp(argValues[i].get(), "length", |
| 6411 lengthValue.get()); | 6286 lengthValue.get()); |
| 6412 int32_t length = FXJSE_Value_ToInteger(lengthValue.get()); | 6287 int32_t length = FXJSE_Value_ToInteger(lengthValue.get()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6439 delete returnValues[i]; | 6314 delete returnValues[i]; |
| 6440 | 6315 |
| 6441 FX_Free(returnValues); | 6316 FX_Free(returnValues); |
| 6442 } | 6317 } |
| 6443 | 6318 |
| 6444 // static | 6319 // static |
| 6445 std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( | 6320 std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( |
| 6446 CFXJSE_Value* pThis, | 6321 CFXJSE_Value* pThis, |
| 6447 CFXJSE_Arguments& args, | 6322 CFXJSE_Arguments& args, |
| 6448 uint32_t index) { | 6323 uint32_t index) { |
| 6449 CXFA_FM2JSContext* pContext = | 6324 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6450 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6451 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6452 ASSERT(index < (uint32_t)args.GetLength()); | 6325 ASSERT(index < (uint32_t)args.GetLength()); |
| 6453 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); | 6326 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); |
| 6454 if (FXJSE_Value_IsArray(argIndex.get())) { | 6327 if (FXJSE_Value_IsArray(argIndex.get())) { |
| 6455 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6328 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6456 FXJSE_Value_GetObjectProp(argIndex.get(), "length", lengthValue.get()); | 6329 FXJSE_Value_GetObjectProp(argIndex.get(), "length", lengthValue.get()); |
| 6457 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6330 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| 6458 std::unique_ptr<CFXJSE_Value> simpleValue(new CFXJSE_Value(pIsolate)); | 6331 std::unique_ptr<CFXJSE_Value> simpleValue(new CFXJSE_Value(pIsolate)); |
| 6459 if (iLength > 2) { | 6332 if (iLength > 2) { |
| 6460 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6333 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6461 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6334 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6477 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate)); | 6350 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate)); |
| 6478 GetObjectDefaultValue(argIndex.get(), defaultValue.get()); | 6351 GetObjectDefaultValue(argIndex.get(), defaultValue.get()); |
| 6479 return defaultValue; | 6352 return defaultValue; |
| 6480 } else { | 6353 } else { |
| 6481 return argIndex; | 6354 return argIndex; |
| 6482 } | 6355 } |
| 6483 } | 6356 } |
| 6484 | 6357 |
| 6485 // static | 6358 // static |
| 6486 FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { | 6359 FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { |
| 6487 CXFA_FM2JSContext* pContext = | 6360 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6488 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6489 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6490 FX_BOOL isNull = FALSE; | 6361 FX_BOOL isNull = FALSE; |
| 6491 if (FXJSE_Value_IsNull(arg)) { | 6362 if (FXJSE_Value_IsNull(arg)) { |
| 6492 isNull = TRUE; | 6363 isNull = TRUE; |
| 6493 } else if (FXJSE_Value_IsArray(arg)) { | 6364 } else if (FXJSE_Value_IsArray(arg)) { |
| 6494 int32_t iLength = hvalue_get_array_length(pThis, arg); | 6365 int32_t iLength = hvalue_get_array_length(pThis, arg); |
| 6495 if (iLength > 2) { | 6366 if (iLength > 2) { |
| 6496 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6367 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6497 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6368 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6498 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); | 6369 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); |
| 6499 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); | 6370 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6523 if (FXJSE_Value_IsNull(defaultValue.get())) { | 6394 if (FXJSE_Value_IsNull(defaultValue.get())) { |
| 6524 isNull = TRUE; | 6395 isNull = TRUE; |
| 6525 } | 6396 } |
| 6526 } | 6397 } |
| 6527 return isNull; | 6398 return isNull; |
| 6528 } | 6399 } |
| 6529 | 6400 |
| 6530 // static | 6401 // static |
| 6531 int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, | 6402 int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, |
| 6532 CFXJSE_Value* arg) { | 6403 CFXJSE_Value* arg) { |
| 6533 CXFA_FM2JSContext* pContext = | 6404 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6534 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6535 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6536 int32_t iLength = 0; | 6405 int32_t iLength = 0; |
| 6537 if (FXJSE_Value_IsArray(arg)) { | 6406 if (FXJSE_Value_IsArray(arg)) { |
| 6538 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6407 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6539 FXJSE_Value_GetObjectProp(arg, "length", lengthValue.get()); | 6408 FXJSE_Value_GetObjectProp(arg, "length", lengthValue.get()); |
| 6540 iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6409 iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| 6541 } | 6410 } |
| 6542 return iLength; | 6411 return iLength; |
| 6543 } | 6412 } |
| 6544 | 6413 |
| 6545 // static | 6414 // static |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6565 } | 6434 } |
| 6566 return bReturn; | 6435 return bReturn; |
| 6567 } | 6436 } |
| 6568 | 6437 |
| 6569 // static | 6438 // static |
| 6570 void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, | 6439 void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, |
| 6571 CFXJSE_Arguments& args, | 6440 CFXJSE_Arguments& args, |
| 6572 CFXJSE_Value**& resultValues, | 6441 CFXJSE_Value**& resultValues, |
| 6573 int32_t& iCount, | 6442 int32_t& iCount, |
| 6574 int32_t iStart) { | 6443 int32_t iStart) { |
| 6575 CXFA_FM2JSContext* pContext = | 6444 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6576 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6577 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6578 iCount = 0; | 6445 iCount = 0; |
| 6579 int32_t argc = args.GetLength(); | 6446 int32_t argc = args.GetLength(); |
| 6580 std::vector<std::unique_ptr<CFXJSE_Value>> argsValue; | 6447 std::vector<std::unique_ptr<CFXJSE_Value>> argsValue; |
| 6581 for (int32_t i = 0; i < argc - iStart; i++) { | 6448 for (int32_t i = 0; i < argc - iStart; i++) { |
| 6582 argsValue.push_back(args.GetValue(i + iStart)); | 6449 argsValue.push_back(args.GetValue(i + iStart)); |
| 6583 if (FXJSE_Value_IsArray(argsValue[i].get())) { | 6450 if (FXJSE_Value_IsArray(argsValue[i].get())) { |
| 6584 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6451 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6585 FXJSE_Value_GetObjectProp(argsValue[i].get(), "length", | 6452 FXJSE_Value_GetObjectProp(argsValue[i].get(), "length", |
| 6586 lengthValue.get()); | 6453 lengthValue.get()); |
| 6587 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6454 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6630 GetObjectDefaultValue(argsValue[i].get(), resultValues[index]); | 6497 GetObjectDefaultValue(argsValue[i].get(), resultValues[index]); |
| 6631 index++; | 6498 index++; |
| 6632 } else { | 6499 } else { |
| 6633 FXJSE_Value_Set(resultValues[index], argsValue[i].get()); | 6500 FXJSE_Value_Set(resultValues[index], argsValue[i].get()); |
| 6634 index++; | 6501 index++; |
| 6635 } | 6502 } |
| 6636 } | 6503 } |
| 6637 } | 6504 } |
| 6638 | 6505 |
| 6639 // static | 6506 // static |
| 6640 void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pObjectValue, | 6507 void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pValue, |
| 6641 CFXJSE_Value* pDefaultValue) { | 6508 CFXJSE_Value* pDefaultValue) { |
| 6642 CXFA_Node* pNode = | 6509 CXFA_Node* pNode = ToNode(CXFA_ScriptContext::ToObject(pValue, nullptr)); |
| 6643 ToNode((CXFA_Object*)FXJSE_Value_ToObject(pObjectValue, nullptr)); | 6510 if (!pNode) { |
| 6644 if (pNode) { | |
| 6645 pNode->Script_Som_DefaultValue(pDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); | |
| 6646 } else { | |
| 6647 FXJSE_Value_SetNull(pDefaultValue); | 6511 FXJSE_Value_SetNull(pDefaultValue); |
| 6512 return; |
| 6648 } | 6513 } |
| 6514 pNode->Script_Som_DefaultValue(pDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); |
| 6649 } | 6515 } |
| 6650 | 6516 |
| 6651 // static | 6517 // static |
| 6652 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pObjectValue, | 6518 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pValue, |
| 6653 CFXJSE_Value* hNewValue) { | 6519 CFXJSE_Value* hNewValue) { |
| 6654 CXFA_Node* pNode = | 6520 CXFA_Node* pNode = ToNode(CXFA_ScriptContext::ToObject(pValue, nullptr)); |
| 6655 ToNode((CXFA_Object*)FXJSE_Value_ToObject(pObjectValue, nullptr)); | 6521 if (!pNode) |
| 6656 if (pNode) { | 6522 return FALSE; |
| 6657 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); | 6523 |
| 6658 return TRUE; | 6524 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); |
| 6659 } | 6525 return TRUE; |
| 6660 return FALSE; | |
| 6661 } | 6526 } |
| 6662 | 6527 |
| 6663 // static | 6528 // static |
| 6664 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, | 6529 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, |
| 6665 int32_t iIndexFlags, | 6530 int32_t iIndexFlags, |
| 6666 int32_t iIndexValue, | 6531 int32_t iIndexValue, |
| 6667 FX_BOOL bIsStar, | 6532 FX_BOOL bIsStar, |
| 6668 CFX_ByteString& szSomExp) { | 6533 CFX_ByteString& szSomExp) { |
| 6669 if (bIsStar) { | 6534 if (bIsStar) { |
| 6670 szSomExp = szName + "[*]"; | 6535 szSomExp = szName + "[*]"; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6690 szSomExp += "]"; | 6555 szSomExp += "]"; |
| 6691 } | 6556 } |
| 6692 } | 6557 } |
| 6693 | 6558 |
| 6694 // static | 6559 // static |
| 6695 FX_BOOL CXFA_FM2JSContext::GetObjectByName( | 6560 FX_BOOL CXFA_FM2JSContext::GetObjectByName( |
| 6696 CFXJSE_Value* pThis, | 6561 CFXJSE_Value* pThis, |
| 6697 CFXJSE_Value* accessorValue, | 6562 CFXJSE_Value* accessorValue, |
| 6698 const CFX_ByteStringC& szAccessorName) { | 6563 const CFX_ByteStringC& szAccessorName) { |
| 6699 FX_BOOL bFlags = FALSE; | 6564 FX_BOOL bFlags = FALSE; |
| 6700 CXFA_FM2JSContext* pContext = | 6565 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 6701 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6702 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 6703 if (!pDoc) { | 6566 if (!pDoc) { |
| 6704 return bFlags; | 6567 return bFlags; |
| 6705 } | 6568 } |
| 6706 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); | 6569 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); |
| 6707 XFA_RESOLVENODE_RS resoveNodeRS; | 6570 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6708 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 6571 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 6709 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6572 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 6710 int32_t iRet = pScriptContext->ResolveObjects( | 6573 int32_t iRet = pScriptContext->ResolveObjects( |
| 6711 pScriptContext->GetThisObject(), | 6574 pScriptContext->GetThisObject(), |
| 6712 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, | 6575 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, |
| 6713 dwFlags); | 6576 dwFlags); |
| 6714 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 6577 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
| 6715 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( | 6578 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( |
| 6716 resoveNodeRS.nodes.GetAt(0))); | 6579 resoveNodeRS.nodes.GetAt(0))); |
| 6717 bFlags = TRUE; | 6580 bFlags = TRUE; |
| 6718 } | 6581 } |
| 6719 return bFlags; | 6582 return bFlags; |
| 6720 } | 6583 } |
| 6721 | 6584 |
| 6722 // static | 6585 // static |
| 6723 int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, | 6586 int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, |
| 6724 CFXJSE_Value* pRefValue, | 6587 CFXJSE_Value* pRefValue, |
| 6725 const CFX_ByteStringC& bsSomExp, | 6588 const CFX_ByteStringC& bsSomExp, |
| 6726 XFA_RESOLVENODE_RS& resoveNodeRS, | 6589 XFA_RESOLVENODE_RS& resoveNodeRS, |
| 6727 FX_BOOL bdotAccessor, | 6590 FX_BOOL bdotAccessor, |
| 6728 FX_BOOL bHasNoResolveName) { | 6591 FX_BOOL bHasNoResolveName) { |
| 6729 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); | 6592 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); |
| 6730 int32_t iRet = -1; | 6593 int32_t iRet = -1; |
| 6731 CXFA_FM2JSContext* pContext = | 6594 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); |
| 6732 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6733 CXFA_Document* pDoc = pContext->GetDocument(); | |
| 6734 if (!pDoc) { | 6595 if (!pDoc) { |
| 6735 return iRet; | 6596 return iRet; |
| 6736 } | 6597 } |
| 6737 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); | 6598 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); |
| 6738 CXFA_Object* pNode = nullptr; | 6599 CXFA_Object* pNode = nullptr; |
| 6739 uint32_t dFlags = 0UL; | 6600 uint32_t dFlags = 0UL; |
| 6740 if (bdotAccessor) { | 6601 if (bdotAccessor) { |
| 6741 if (FXJSE_Value_IsNull(pRefValue)) { | 6602 if (FXJSE_Value_IsNull(pRefValue)) { |
| 6742 pNode = pScriptContext->GetThisObject(); | 6603 pNode = pScriptContext->GetThisObject(); |
| 6743 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6604 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 6744 } else { | 6605 } else { |
| 6745 pNode = (CXFA_Object*)FXJSE_Value_ToObject(pRefValue, nullptr); | 6606 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); |
| 6746 ASSERT(pNode); | 6607 ASSERT(pNode); |
| 6747 if (bHasNoResolveName) { | 6608 if (bHasNoResolveName) { |
| 6748 CFX_WideString wsName; | 6609 CFX_WideString wsName; |
| 6749 if (CXFA_Node* pXFANode = pNode->AsNode()) { | 6610 if (CXFA_Node* pXFANode = pNode->AsNode()) { |
| 6750 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); | 6611 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); |
| 6751 } | 6612 } |
| 6752 if (wsName.IsEmpty()) { | 6613 if (wsName.IsEmpty()) { |
| 6753 CFX_WideStringC className; | 6614 CFX_WideStringC className; |
| 6754 pNode->GetClassName(className); | 6615 pNode->GetClassName(className); |
| 6755 wsName = FX_WSTRC(L"#") + className; | 6616 wsName = FX_WSTRC(L"#") + className; |
| 6756 } | 6617 } |
| 6757 wsSomExpression = wsName + wsSomExpression; | 6618 wsSomExpression = wsName + wsSomExpression; |
| 6758 dFlags = XFA_RESOLVENODE_Siblings; | 6619 dFlags = XFA_RESOLVENODE_Siblings; |
| 6759 } else { | 6620 } else { |
| 6760 dFlags = (bsSomExp == "*") | 6621 dFlags = (bsSomExp == "*") |
| 6761 ? (XFA_RESOLVENODE_Children) | 6622 ? (XFA_RESOLVENODE_Children) |
| 6762 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 6623 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
| 6763 XFA_RESOLVENODE_Properties); | 6624 XFA_RESOLVENODE_Properties); |
| 6764 } | 6625 } |
| 6765 } | 6626 } |
| 6766 } else { | 6627 } else { |
| 6767 pNode = (CXFA_Object*)FXJSE_Value_ToObject(pRefValue, nullptr); | 6628 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); |
| 6768 dFlags = XFA_RESOLVENODE_AnyChild; | 6629 dFlags = XFA_RESOLVENODE_AnyChild; |
| 6769 } | 6630 } |
| 6770 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), | 6631 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), |
| 6771 resoveNodeRS, dFlags); | 6632 resoveNodeRS, dFlags); |
| 6772 return iRet; | 6633 return iRet; |
| 6773 } | 6634 } |
| 6774 | 6635 |
| 6775 // static | 6636 // static |
| 6776 void CXFA_FM2JSContext::ParseResolveResult( | 6637 void CXFA_FM2JSContext::ParseResolveResult( |
| 6777 CFXJSE_Value* pThis, | 6638 CFXJSE_Value* pThis, |
| 6778 const XFA_RESOLVENODE_RS& resoveNodeRS, | 6639 const XFA_RESOLVENODE_RS& resoveNodeRS, |
| 6779 CFXJSE_Value* pParentValue, | 6640 CFXJSE_Value* pParentValue, |
| 6780 CFXJSE_Value**& resultValues, | 6641 CFXJSE_Value**& resultValues, |
| 6781 int32_t& iSize, | 6642 int32_t& iSize, |
| 6782 FX_BOOL& bAttribute) { | 6643 FX_BOOL& bAttribute) { |
| 6783 CXFA_FM2JSContext* pContext = | 6644 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); |
| 6784 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6785 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6645 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| 6786 iSize = 0; | 6646 iSize = 0; |
| 6787 resultValues = nullptr; | 6647 resultValues = nullptr; |
| 6788 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 6648 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
| 6789 bAttribute = FALSE; | 6649 bAttribute = FALSE; |
| 6790 iSize = resoveNodeRS.nodes.GetSize(); | 6650 iSize = resoveNodeRS.nodes.GetSize(); |
| 6791 resultValues = FX_Alloc(CFXJSE_Value*, iSize); | 6651 resultValues = FX_Alloc(CFXJSE_Value*, iSize); |
| 6792 for (int32_t i = 0; i < iSize; i++) { | 6652 for (int32_t i = 0; i < iSize; i++) { |
| 6793 resultValues[i] = new CFXJSE_Value(pIsolate); | 6653 resultValues[i] = new CFXJSE_Value(pIsolate); |
| 6794 FXJSE_Value_Set( | 6654 FXJSE_Value_Set( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6814 resultValues[i] = new CFXJSE_Value(pIsolate); | 6674 resultValues[i] = new CFXJSE_Value(pIsolate); |
| 6815 FXJSE_Value_Set(resultValues[i], objectProperties[i]); | 6675 FXJSE_Value_Set(resultValues[i], objectProperties[i]); |
| 6816 } | 6676 } |
| 6817 } | 6677 } |
| 6818 } | 6678 } |
| 6819 } | 6679 } |
| 6820 | 6680 |
| 6821 // static | 6681 // static |
| 6822 int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, | 6682 int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, |
| 6823 CFXJSE_Value* pValue) { | 6683 CFXJSE_Value* pValue) { |
| 6824 CXFA_FM2JSContext* pContext = | 6684 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6825 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6826 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6827 int32_t iValue = 0; | 6685 int32_t iValue = 0; |
| 6828 if (FXJSE_Value_IsArray(pValue)) { | 6686 if (FXJSE_Value_IsArray(pValue)) { |
| 6829 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6687 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6830 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6688 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6831 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); | 6689 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); |
| 6832 FXJSE_Value_GetObjectPropByIdx(pValue, 1, propertyValue.get()); | 6690 FXJSE_Value_GetObjectPropByIdx(pValue, 1, propertyValue.get()); |
| 6833 FXJSE_Value_GetObjectPropByIdx(pValue, 2, jsObjectValue.get()); | 6691 FXJSE_Value_GetObjectPropByIdx(pValue, 2, jsObjectValue.get()); |
| 6834 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6692 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6835 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); | 6693 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
| 6836 } else { | 6694 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6852 iValue = FXSYS_atoi(szValue.c_str()); | 6710 iValue = FXSYS_atoi(szValue.c_str()); |
| 6853 } else { | 6711 } else { |
| 6854 iValue = FXJSE_Value_ToInteger(pValue); | 6712 iValue = FXJSE_Value_ToInteger(pValue); |
| 6855 } | 6713 } |
| 6856 return iValue; | 6714 return iValue; |
| 6857 } | 6715 } |
| 6858 | 6716 |
| 6859 // static | 6717 // static |
| 6860 FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, | 6718 FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, |
| 6861 CFXJSE_Value* arg) { | 6719 CFXJSE_Value* arg) { |
| 6862 CXFA_FM2JSContext* pContext = | 6720 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6863 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6864 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6865 FX_FLOAT fRet = 0.0f; | 6721 FX_FLOAT fRet = 0.0f; |
| 6866 if (FXJSE_Value_IsArray(arg)) { | 6722 if (FXJSE_Value_IsArray(arg)) { |
| 6867 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6723 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6868 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6724 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6869 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); | 6725 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); |
| 6870 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); | 6726 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); |
| 6871 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); | 6727 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); |
| 6872 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6728 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6873 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); | 6729 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
| 6874 } else { | 6730 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6890 fRet = 0; | 6746 fRet = 0; |
| 6891 } else { | 6747 } else { |
| 6892 fRet = FXJSE_Value_ToFloat(arg); | 6748 fRet = FXJSE_Value_ToFloat(arg); |
| 6893 } | 6749 } |
| 6894 return fRet; | 6750 return fRet; |
| 6895 } | 6751 } |
| 6896 | 6752 |
| 6897 // static | 6753 // static |
| 6898 FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, | 6754 FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, |
| 6899 CFXJSE_Value* arg) { | 6755 CFXJSE_Value* arg) { |
| 6900 CXFA_FM2JSContext* pContext = | 6756 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6901 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6902 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6903 FX_DOUBLE dRet = 0; | 6757 FX_DOUBLE dRet = 0; |
| 6904 if (FXJSE_Value_IsArray(arg)) { | 6758 if (FXJSE_Value_IsArray(arg)) { |
| 6905 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); | 6759 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| 6906 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); | 6760 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); |
| 6907 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); | 6761 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); |
| 6908 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); | 6762 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); |
| 6909 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); | 6763 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); |
| 6910 if (FXJSE_Value_IsNull(propertyValue.get())) { | 6764 if (FXJSE_Value_IsNull(propertyValue.get())) { |
| 6911 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); | 6765 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); |
| 6912 } else { | 6766 } else { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 6931 } | 6785 } |
| 6932 return dRet; | 6786 return dRet; |
| 6933 } | 6787 } |
| 6934 | 6788 |
| 6935 // static. | 6789 // static. |
| 6936 double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, | 6790 double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, |
| 6937 CFXJSE_Value* src, | 6791 CFXJSE_Value* src, |
| 6938 bool* ret) { | 6792 bool* ret) { |
| 6939 ASSERT(ret); | 6793 ASSERT(ret); |
| 6940 | 6794 |
| 6941 CXFA_FM2JSContext* pContext = | 6795 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); |
| 6942 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); | |
| 6943 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | |
| 6944 | |
| 6945 *ret = true; | 6796 *ret = true; |
| 6946 | 6797 |
| 6947 if (FXJSE_Value_IsArray(src)) { | 6798 if (FXJSE_Value_IsArray(src)) { |
| 6948 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); | 6799 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| 6949 FXJSE_Value_GetObjectProp(src, "length", lengthValue.get()); | 6800 FXJSE_Value_GetObjectProp(src, "length", lengthValue.get()); |
| 6950 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); | 6801 int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); |
| 6951 if (iLength <= 2) { | 6802 if (iLength <= 2) { |
| 6952 *ret = false; | 6803 *ret = false; |
| 6953 return 0.0; | 6804 return 0.0; |
| 6954 } | 6805 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7031 CFX_WideString wsFormat; | 6882 CFX_WideString wsFormat; |
| 7032 pAppProvider->LoadString(iStringID, wsFormat); | 6883 pAppProvider->LoadString(iStringID, wsFormat); |
| 7033 CFX_WideString wsMessage; | 6884 CFX_WideString wsMessage; |
| 7034 va_list arg_ptr; | 6885 va_list arg_ptr; |
| 7035 va_start(arg_ptr, iStringID); | 6886 va_start(arg_ptr, iStringID); |
| 7036 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); | 6887 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); |
| 7037 va_end(arg_ptr); | 6888 va_end(arg_ptr); |
| 7038 FXJSE_ThrowMessage( | 6889 FXJSE_ThrowMessage( |
| 7039 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 6890 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
| 7040 } | 6891 } |
| OLD | NEW |