| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/parser/xfa_object.h" | 7 #include "xfa/fxfa/parser/xfa_object.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 delete static_cast<CXFA_NodeArray*>(pData); | 46 delete static_cast<CXFA_NodeArray*>(pData); |
| 47 } | 47 } |
| 48 | 48 |
| 49 XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { | 49 XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { |
| 50 XFA_DataNodeDeleteBindItem, nullptr}; | 50 XFA_DataNodeDeleteBindItem, nullptr}; |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, | 54 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, |
| 55 XFA_ObjectType objectType, | 55 XFA_ObjectType objectType, |
| 56 XFA_Element elementType) | 56 XFA_Element elementType, |
| 57 const CFX_WideStringC& elementName) |
| 57 : m_pDocument(pDocument), | 58 : m_pDocument(pDocument), |
| 58 m_objectType(objectType), | 59 m_objectType(objectType), |
| 59 m_elementType(elementType) {} | 60 m_elementType(elementType), |
| 61 m_elementNameHash(FX_HashCode_GetW(elementName, false)), |
| 62 m_elementName(elementName) {} |
| 60 | 63 |
| 61 CXFA_Object::~CXFA_Object() {} | 64 CXFA_Object::~CXFA_Object() {} |
| 62 | 65 |
| 63 CFX_WideStringC CXFA_Object::GetClassName() const { | 66 CFX_WideStringC CXFA_Object::GetClassName() const { |
| 64 return XFA_GetElementByID(GetElementType())->pName; | 67 return m_elementName; |
| 65 } | 68 } |
| 66 | 69 |
| 67 uint32_t CXFA_Object::GetClassHashCode() const { | 70 uint32_t CXFA_Object::GetClassHashCode() const { |
| 68 return XFA_GetElementByID(GetElementType())->uHash; | 71 return m_elementNameHash; |
| 69 } | 72 } |
| 70 | 73 |
| 71 XFA_Element CXFA_Object::GetElementType() const { | 74 XFA_Element CXFA_Object::GetElementType() const { |
| 72 return m_elementType; | 75 return m_elementType; |
| 73 } | 76 } |
| 74 | 77 |
| 75 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, | 78 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, |
| 76 FX_BOOL bSetting, | 79 FX_BOOL bSetting, |
| 77 XFA_ATTRIBUTE eAttribute) { | 80 XFA_ATTRIBUTE eAttribute) { |
| 78 if (!bSetting) { | 81 if (!bSetting) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 98 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 101 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
| 99 } | 102 } |
| 100 | 103 |
| 101 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} | 104 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} |
| 102 | 105 |
| 103 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} | 106 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} |
| 104 | 107 |
| 105 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, | 108 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, |
| 106 uint16_t ePacket, | 109 uint16_t ePacket, |
| 107 XFA_ObjectType oType, | 110 XFA_ObjectType oType, |
| 108 XFA_Element eType) | 111 XFA_Element eType, |
| 109 : CXFA_Object(pDoc, oType, eType), | 112 const CFX_WideStringC& elementName) |
| 113 : CXFA_Object(pDoc, oType, eType, elementName), |
| 110 m_pNext(nullptr), | 114 m_pNext(nullptr), |
| 111 m_pChild(nullptr), | 115 m_pChild(nullptr), |
| 112 m_pLastChild(nullptr), | 116 m_pLastChild(nullptr), |
| 113 m_pParent(nullptr), | 117 m_pParent(nullptr), |
| 114 m_pXMLNode(nullptr), | 118 m_pXMLNode(nullptr), |
| 115 m_ePacket(ePacket), | 119 m_ePacket(ePacket), |
| 116 m_uNodeFlags(XFA_NodeFlag_None), | 120 m_uNodeFlags(XFA_NodeFlag_None), |
| 117 m_dwNameHash(0), | 121 m_dwNameHash(0), |
| 118 m_pAuxNode(nullptr), | 122 m_pAuxNode(nullptr), |
| 119 m_pMapModuleData(nullptr) { | 123 m_pMapModuleData(nullptr) { |
| (...skipping 4939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5059 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 5063 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 5060 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); | 5064 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); |
| 5061 } | 5065 } |
| 5062 } | 5066 } |
| 5063 pSrcModule->MoveBufferMapData(pDstModule, pKey); | 5067 pSrcModule->MoveBufferMapData(pDstModule, pKey); |
| 5064 } | 5068 } |
| 5065 | 5069 |
| 5066 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) | 5070 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) |
| 5067 : CXFA_Object(pThisNode->GetDocument(), | 5071 : CXFA_Object(pThisNode->GetDocument(), |
| 5068 XFA_ObjectType::VariablesThis, | 5072 XFA_ObjectType::VariablesThis, |
| 5069 XFA_Element::Unknown), | 5073 XFA_Element::Unknown, |
| 5074 CFX_WideStringC()), |
| 5070 m_pThisNode(nullptr), | 5075 m_pThisNode(nullptr), |
| 5071 m_pScriptNode(nullptr) { | 5076 m_pScriptNode(nullptr) { |
| 5072 m_pThisNode = pThisNode; | 5077 m_pThisNode = pThisNode; |
| 5073 m_pScriptNode = pScriptNode; | 5078 m_pScriptNode = pScriptNode; |
| 5074 } | 5079 } |
| 5075 | 5080 |
| 5076 CXFA_ThisProxy::~CXFA_ThisProxy() {} | 5081 CXFA_ThisProxy::~CXFA_ThisProxy() {} |
| 5077 | 5082 |
| 5078 CXFA_Node* CXFA_ThisProxy::GetThisNode() const { | 5083 CXFA_Node* CXFA_ThisProxy::GetThisNode() const { |
| 5079 return m_pThisNode; | 5084 return m_pThisNode; |
| 5080 } | 5085 } |
| 5081 | 5086 |
| 5082 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { | 5087 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { |
| 5083 return m_pScriptNode; | 5088 return m_pScriptNode; |
| 5084 } | 5089 } |
| 5085 | 5090 |
| 5086 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) | 5091 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) |
| 5087 : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList) { | 5092 : CXFA_Object(pDocument, |
| 5093 XFA_ObjectType::NodeList, |
| 5094 XFA_Element::NodeList, |
| 5095 CFX_WideStringC(L"nodeList")) { |
| 5088 m_pDocument->GetScriptContext()->AddToCacheList( | 5096 m_pDocument->GetScriptContext()->AddToCacheList( |
| 5089 std::unique_ptr<CXFA_NodeList>(this)); | 5097 std::unique_ptr<CXFA_NodeList>(this)); |
| 5090 } | 5098 } |
| 5091 | 5099 |
| 5092 CXFA_NodeList::~CXFA_NodeList() {} | 5100 CXFA_NodeList::~CXFA_NodeList() {} |
| 5093 | 5101 |
| 5094 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { | 5102 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { |
| 5095 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); | 5103 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); |
| 5096 int32_t iCount = GetLength(); | 5104 int32_t iCount = GetLength(); |
| 5097 for (int32_t i = 0; i < iCount; i++) { | 5105 for (int32_t i = 0; i < iCount; i++) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5255 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5263 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 5256 } | 5264 } |
| 5257 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5265 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 5258 return m_pAttachNode->RemoveChild(pNode); | 5266 return m_pAttachNode->RemoveChild(pNode); |
| 5259 } | 5267 } |
| 5260 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5268 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 5261 return m_pAttachNode->GetChild( | 5269 return m_pAttachNode->GetChild( |
| 5262 iIndex, XFA_Element::Unknown, | 5270 iIndex, XFA_Element::Unknown, |
| 5263 m_pAttachNode->GetElementType() == XFA_Element::Subform); | 5271 m_pAttachNode->GetElementType() == XFA_Element::Subform); |
| 5264 } | 5272 } |
| OLD | NEW |