summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_object_imp.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-07-18 06:36:51 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-18 06:36:51 -0700
commitc1df5d4375027aa9d0b88f456f95177c016e8cad (patch)
treea06026f0df134604b4cc8082b15a1875ddcc00a0 /xfa/fxfa/parser/xfa_object_imp.cpp
parente8a80664a888526ca4f0d08b4e6b290eb0aa0d76 (diff)
downloadpdfium-c1df5d4375027aa9d0b88f456f95177c016e8cad.tar.xz
Pass element hash and name into CXFA_Object constructor.
Providing the element hash and name in the constructor allows us to remove the calls to XFA_GetElementByID in the get methods. Review-Url: https://codereview.chromium.org/2101403002
Diffstat (limited to 'xfa/fxfa/parser/xfa_object_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index e3d9f6bcdf..a9a5b29458 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -53,19 +53,22 @@ XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = {
CXFA_Object::CXFA_Object(CXFA_Document* pDocument,
XFA_ObjectType objectType,
- XFA_Element elementType)
+ XFA_Element elementType,
+ const CFX_WideStringC& elementName)
: m_pDocument(pDocument),
m_objectType(objectType),
- m_elementType(elementType) {}
+ m_elementType(elementType),
+ m_elementNameHash(FX_HashCode_GetW(elementName, false)),
+ m_elementName(elementName) {}
CXFA_Object::~CXFA_Object() {}
CFX_WideStringC CXFA_Object::GetClassName() const {
- return XFA_GetElementByID(GetElementType())->pName;
+ return m_elementName;
}
uint32_t CXFA_Object::GetClassHashCode() const {
- return XFA_GetElementByID(GetElementType())->uHash;
+ return m_elementNameHash;
}
XFA_Element CXFA_Object::GetElementType() const {
@@ -105,8 +108,9 @@ XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {}
CXFA_Node::CXFA_Node(CXFA_Document* pDoc,
uint16_t ePacket,
XFA_ObjectType oType,
- XFA_Element eType)
- : CXFA_Object(pDoc, oType, eType),
+ XFA_Element eType,
+ const CFX_WideStringC& elementName)
+ : CXFA_Object(pDoc, oType, eType, elementName),
m_pNext(nullptr),
m_pChild(nullptr),
m_pLastChild(nullptr),
@@ -5066,7 +5070,8 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule,
CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode)
: CXFA_Object(pThisNode->GetDocument(),
XFA_ObjectType::VariablesThis,
- XFA_Element::Unknown),
+ XFA_Element::Unknown,
+ CFX_WideStringC()),
m_pThisNode(nullptr),
m_pScriptNode(nullptr) {
m_pThisNode = pThisNode;
@@ -5084,7 +5089,10 @@ CXFA_Node* CXFA_ThisProxy::GetScriptNode() const {
}
CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument)
- : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList) {
+ : CXFA_Object(pDocument,
+ XFA_ObjectType::NodeList,
+ XFA_Element::NodeList,
+ CFX_WideStringC(L"nodeList")) {
m_pDocument->GetScriptContext()->AddToCacheList(
std::unique_ptr<CXFA_NodeList>(this));
}