| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 delete static_cast<CXFA_NodeArray*>(pData); | 47 delete static_cast<CXFA_NodeArray*>(pData); |
| 48 } | 48 } |
| 49 | 49 |
| 50 XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { | 50 XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { |
| 51 XFA_DataNodeDeleteBindItem, nullptr}; | 51 XFA_DataNodeDeleteBindItem, nullptr}; |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, | 55 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, |
| 56 XFA_ObjectType objectType, | 56 XFA_ObjectType objectType, |
| 57 XFA_Element elementType) | 57 XFA_Element elementType, |
| 58 uint32_t elementNameHash, |
| 59 const CFX_WideStringC& elementName) |
| 58 : m_pDocument(pDocument), | 60 : m_pDocument(pDocument), |
| 59 m_objectType(objectType), | 61 m_objectType(objectType), |
| 60 m_elementType(elementType) {} | 62 m_elementType(elementType), |
| 63 m_elementNameHash(elementNameHash), |
| 64 m_elementName(elementName) {} |
| 61 | 65 |
| 62 CXFA_Object::~CXFA_Object() {} | 66 CXFA_Object::~CXFA_Object() {} |
| 63 | 67 |
| 64 CFX_WideStringC CXFA_Object::GetClassName() const { | 68 const CFX_WideStringC CXFA_Object::GetClassName() const { |
| 65 return XFA_GetElementByID(GetElementType())->pName; | 69 return m_elementName; |
| 66 } | 70 } |
| 67 | 71 |
| 68 uint32_t CXFA_Object::GetClassHashCode() const { | 72 uint32_t CXFA_Object::GetClassHashCode() const { |
| 69 return XFA_GetElementByID(GetElementType())->uHash; | 73 return m_elementNameHash; |
| 70 } | 74 } |
| 71 | 75 |
| 72 XFA_Element CXFA_Object::GetElementType() const { | 76 XFA_Element CXFA_Object::GetElementType() const { |
| 73 return m_elementType; | 77 return m_elementType; |
| 74 } | 78 } |
| 75 | 79 |
| 76 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, | 80 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, |
| 77 FX_BOOL bSetting, | 81 FX_BOOL bSetting, |
| 78 XFA_ATTRIBUTE eAttribute) { | 82 XFA_ATTRIBUTE eAttribute) { |
| 79 if (!bSetting) { | 83 if (!bSetting) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 99 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 103 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
| 100 } | 104 } |
| 101 | 105 |
| 102 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} | 106 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} |
| 103 | 107 |
| 104 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} | 108 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} |
| 105 | 109 |
| 106 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, | 110 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, |
| 107 uint16_t ePacket, | 111 uint16_t ePacket, |
| 108 XFA_ObjectType oType, | 112 XFA_ObjectType oType, |
| 109 XFA_Element eType) | 113 XFA_Element eType, |
| 110 : CXFA_Object(pDoc, oType, eType), | 114 uint32_t elementNameHash, |
| 115 const CFX_WideStringC& elementName) |
| 116 : CXFA_Object(pDoc, oType, eType, elementNameHash, elementName), |
| 111 m_pNext(nullptr), | 117 m_pNext(nullptr), |
| 112 m_pChild(nullptr), | 118 m_pChild(nullptr), |
| 113 m_pLastChild(nullptr), | 119 m_pLastChild(nullptr), |
| 114 m_pParent(nullptr), | 120 m_pParent(nullptr), |
| 115 m_pXMLNode(nullptr), | 121 m_pXMLNode(nullptr), |
| 116 m_ePacket(ePacket), | 122 m_ePacket(ePacket), |
| 117 m_uNodeFlags(XFA_NodeFlag_None), | 123 m_uNodeFlags(XFA_NodeFlag_None), |
| 118 m_dwNameHash(0), | 124 m_dwNameHash(0), |
| 119 m_pAuxNode(nullptr), | 125 m_pAuxNode(nullptr), |
| 120 m_pMapModuleData(nullptr) { | 126 m_pMapModuleData(nullptr) { |
| (...skipping 4942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5063 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 5069 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 5064 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); | 5070 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); |
| 5065 } | 5071 } |
| 5066 } | 5072 } |
| 5067 pSrcModule->MoveBufferMapData(pDstModule, pKey); | 5073 pSrcModule->MoveBufferMapData(pDstModule, pKey); |
| 5068 } | 5074 } |
| 5069 | 5075 |
| 5070 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) | 5076 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) |
| 5071 : CXFA_Object(pThisNode->GetDocument(), | 5077 : CXFA_Object(pThisNode->GetDocument(), |
| 5072 XFA_ObjectType::VariablesThis, | 5078 XFA_ObjectType::VariablesThis, |
| 5073 XFA_Element::Unknown), | 5079 XFA_Element::Unknown, |
| 5080 0, |
| 5081 CFX_WideStringC()), |
| 5074 m_pThisNode(nullptr), | 5082 m_pThisNode(nullptr), |
| 5075 m_pScriptNode(nullptr) { | 5083 m_pScriptNode(nullptr) { |
| 5076 m_pThisNode = pThisNode; | 5084 m_pThisNode = pThisNode; |
| 5077 m_pScriptNode = pScriptNode; | 5085 m_pScriptNode = pScriptNode; |
| 5078 } | 5086 } |
| 5079 | 5087 |
| 5080 CXFA_ThisProxy::~CXFA_ThisProxy() {} | 5088 CXFA_ThisProxy::~CXFA_ThisProxy() {} |
| 5081 | 5089 |
| 5082 CXFA_Node* CXFA_ThisProxy::GetThisNode() const { | 5090 CXFA_Node* CXFA_ThisProxy::GetThisNode() const { |
| 5083 return m_pThisNode; | 5091 return m_pThisNode; |
| 5084 } | 5092 } |
| 5085 | 5093 |
| 5086 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { | 5094 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { |
| 5087 return m_pScriptNode; | 5095 return m_pScriptNode; |
| 5088 } | 5096 } |
| 5089 | 5097 |
| 5090 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) | 5098 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) |
| 5091 : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList) { | 5099 : CXFA_Object(pDocument, |
| 5100 XFA_ObjectType::NodeList, |
| 5101 XFA_Element::NodeList, |
| 5102 0xa8c7d5e2, |
| 5103 CFX_WideStringC(L"nodeList")) { |
| 5092 m_pDocument->GetScriptContext()->AddToCacheList( | 5104 m_pDocument->GetScriptContext()->AddToCacheList( |
| 5093 std::unique_ptr<CXFA_NodeList>(this)); | 5105 std::unique_ptr<CXFA_NodeList>(this)); |
| 5094 } | 5106 } |
| 5095 | 5107 |
| 5096 CXFA_NodeList::~CXFA_NodeList() {} | 5108 CXFA_NodeList::~CXFA_NodeList() {} |
| 5097 | 5109 |
| 5098 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { | 5110 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { |
| 5099 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); | 5111 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); |
| 5100 int32_t iCount = GetLength(); | 5112 int32_t iCount = GetLength(); |
| 5101 for (int32_t i = 0; i < iCount; i++) { | 5113 for (int32_t i = 0; i < iCount; i++) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5259 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5271 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 5260 } | 5272 } |
| 5261 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5273 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 5262 return m_pAttachNode->RemoveChild(pNode); | 5274 return m_pAttachNode->RemoveChild(pNode); |
| 5263 } | 5275 } |
| 5264 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5276 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 5265 return m_pAttachNode->GetChild( | 5277 return m_pAttachNode->GetChild( |
| 5266 iIndex, XFA_Element::Unknown, | 5278 iIndex, XFA_Element::Unknown, |
| 5267 m_pAttachNode->GetElementType() == XFA_Element::Subform); | 5279 m_pAttachNode->GetElementType() == XFA_Element::Subform); |
| 5268 } | 5280 } |
| OLD | NEW |