| 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 #ifndef XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 7 #ifndef XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
| 8 #define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 8 #define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
| 9 | 9 |
| 10 #include "fxjse/include/cfxjse_arguments.h" | 10 #include "fxjse/include/cfxjse_arguments.h" |
| 11 #include "xfa/fxfa/parser/xfa_script.h" | 11 #include "xfa/fxfa/parser/xfa_script.h" |
| 12 | 12 |
| 13 class CXFA_FM2JSContext : public CFXJSE_HostObject { | 13 class CXFA_FM2JSContext : public CFXJSE_HostObject { |
| 14 public: | 14 public: |
| 15 CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, |
| 16 CFXJSE_Context* pScriptContext, |
| 17 CXFA_Document* pDoc); |
| 18 ~CXFA_FM2JSContext() override; |
| 19 |
| 15 static void Abs(CFXJSE_Value* pThis, | 20 static void Abs(CFXJSE_Value* pThis, |
| 16 const CFX_ByteStringC& szFuncName, | 21 const CFX_ByteStringC& szFuncName, |
| 17 CFXJSE_Arguments& args); | 22 CFXJSE_Arguments& args); |
| 18 static void Avg(CFXJSE_Value* pThis, | 23 static void Avg(CFXJSE_Value* pThis, |
| 19 const CFX_ByteStringC& szFuncName, | 24 const CFX_ByteStringC& szFuncName, |
| 20 CFXJSE_Arguments& args); | 25 CFXJSE_Arguments& args); |
| 21 static void Ceil(CFXJSE_Value* pThis, | 26 static void Ceil(CFXJSE_Value* pThis, |
| 22 const CFX_ByteStringC& szFuncName, | 27 const CFX_ByteStringC& szFuncName, |
| 23 CFXJSE_Arguments& args); | 28 CFXJSE_Arguments& args); |
| 24 static void Count(CFXJSE_Value* pThis, | 29 static void Count(CFXJSE_Value* pThis, |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 static void ValueToUTF8String(CFXJSE_Value* pValue, | 437 static void ValueToUTF8String(CFXJSE_Value* pValue, |
| 433 CFX_ByteString& outputValue); | 438 CFX_ByteString& outputValue); |
| 434 static double ExtractDouble(CFXJSE_Value* pThis, | 439 static double ExtractDouble(CFXJSE_Value* pThis, |
| 435 CFXJSE_Value* src, | 440 CFXJSE_Value* src, |
| 436 bool* ret); | 441 bool* ret); |
| 437 | 442 |
| 438 static int32_t Translate(const CFX_WideStringC& wsFormcalc, | 443 static int32_t Translate(const CFX_WideStringC& wsFormcalc, |
| 439 CFX_WideTextBuf& wsJavascript, | 444 CFX_WideTextBuf& wsJavascript, |
| 440 CFX_WideString& wsError); | 445 CFX_WideString& wsError); |
| 441 | 446 |
| 442 CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, | |
| 443 CFXJSE_Context* pScriptContext, | |
| 444 CXFA_Document* pDoc); | |
| 445 ~CXFA_FM2JSContext(); | |
| 446 | |
| 447 void GlobalPropertyGetter(CFXJSE_Value* pValue); | 447 void GlobalPropertyGetter(CFXJSE_Value* pValue); |
| 448 | 448 |
| 449 private: | 449 private: |
| 450 v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } | 450 v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } |
| 451 CXFA_Document* GetDocument() const { return m_pDocument; } | 451 CXFA_Document* GetDocument() const { return m_pDocument; } |
| 452 void ThrowException(int32_t iStringID, ...); | 452 void ThrowException(int32_t iStringID, ...); |
| 453 | 453 |
| 454 v8::Isolate* m_pIsolate; | 454 v8::Isolate* m_pIsolate; |
| 455 CFXJSE_Class* m_pFMClass; | 455 CFXJSE_Class* m_pFMClass; |
| 456 std::unique_ptr<CFXJSE_Value> m_pValue; | 456 std::unique_ptr<CFXJSE_Value> m_pValue; |
| 457 CXFA_Document* const m_pDocument; | 457 CXFA_Document* const m_pDocument; |
| 458 }; | 458 }; |
| 459 | 459 |
| 460 #endif // XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 460 #endif // XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
| OLD | NEW |