| 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_PARSER_XFA_SCRIPT_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
| 8 #define XFA_FXFA_PARSER_XFA_SCRIPT_H_ | 8 #define XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
| 9 | 9 |
| 10 #include "xfa/fxfa/include/fxfa.h" | 10 #include "xfa/fxfa/include/fxfa.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class CXFA_HVALUEArray : public CFX_ArrayTemplate<FXJSE_HVALUE> { | 38 class CXFA_HVALUEArray : public CFX_ArrayTemplate<FXJSE_HVALUE> { |
| 39 public: | 39 public: |
| 40 CXFA_HVALUEArray(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} | 40 CXFA_HVALUEArray(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} |
| 41 ~CXFA_HVALUEArray() { | 41 ~CXFA_HVALUEArray() { |
| 42 for (int32_t i = 0; i < GetSize(); i++) { | 42 for (int32_t i = 0; i < GetSize(); i++) { |
| 43 FXJSE_Value_Release(GetAt(i)); | 43 FXJSE_Value_Release(GetAt(i)); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 void GetAttributeObject(CXFA_ObjArray& objArray) { | 46 void GetAttributeObject(CXFA_ObjArray& objArray) { |
| 47 for (int32_t i = 0; i < GetSize(); i++) { | 47 for (int32_t i = 0; i < GetSize(); i++) { |
| 48 CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(GetAt(i)); | 48 CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(GetAt(i), NULL); |
| 49 objArray.Add(pObject); | 49 objArray.Add(pObject); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 v8::Isolate* m_pIsolate; | 52 v8::Isolate* m_pIsolate; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 struct XFA_RESOLVENODE_RS { | 55 struct XFA_RESOLVENODE_RS { |
| 56 XFA_RESOLVENODE_RS() | 56 XFA_RESOLVENODE_RS() |
| 57 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} | 57 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} |
| 58 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } | 58 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } |
| 59 int32_t GetAttributeResult(CXFA_HVALUEArray& hValueArray) const { | 59 int32_t GetAttributeResult(CXFA_HVALUEArray& hValueArray) const { |
| 60 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { | 60 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { |
| 61 v8::Isolate* pIsolate = hValueArray.m_pIsolate; | 61 v8::Isolate* pIsolate = hValueArray.m_pIsolate; |
| 62 for (int32_t i = 0; i < nodes.GetSize(); i++) { | 62 for (int32_t i = 0; i < nodes.GetSize(); i++) { |
| 63 FXJSE_HVALUE hValue = FXJSE_Value_Create(pIsolate); | 63 FXJSE_HVALUE hValue = FXJSE_Value_Create(pIsolate); |
| 64 (nodes[i]->*(pScriptAttribute->lpfnCallback))( | 64 (nodes[i]->*(pScriptAttribute->lpfnCallback))( |
| 65 hValue, FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); | 65 hValue, FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); |
| 66 hValueArray.Add(hValue); | 66 hValueArray.Add(hValue); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 return hValueArray.GetSize(); | 69 return hValueArray.GetSize(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 CXFA_ObjArray nodes; | 72 CXFA_ObjArray nodes; |
| 73 XFA_RESOVENODE_RSTYPE dwFlags; | 73 XFA_RESOVENODE_RSTYPE dwFlags; |
| 74 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; | 74 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ | 77 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
| OLD | NEW |