summaryrefslogtreecommitdiff
path: root/fxjs/xfa
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-24 20:05:29 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-24 20:05:29 +0000
commitb657e87fa1e25997c8277fa49ed33ff245391f31 (patch)
treec95f75693ea9a03e82ac0b696ca992ef5bd714ac /fxjs/xfa
parent4327b48d249ad61020e353c794a08b2969949eba (diff)
downloadpdfium-b657e87fa1e25997c8277fa49ed33ff245391f31.tar.xz
Cleanup CreateUIChild node creation
This CL cleans up some of the code around creating the XML nodes related to the UI widgets. Change-Id: Ib91364439ab039f46e44690e92cc0cb93a8da203 Reviewed-on: https://pdfium-review.googlesource.com/23770 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/xfa')
-rw-r--r--fxjs/xfa/cjx_object.cpp8
-rw-r--r--fxjs/xfa/cjx_object.h7
2 files changed, 8 insertions, 7 deletions
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 46af66ae28..d663fcce70 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -377,7 +377,7 @@ Optional<int32_t> CJX_Object::TryInteger(XFA_Attribute eAttr,
}
Optional<XFA_AttributeEnum> CJX_Object::TryEnum(XFA_Attribute eAttr,
- bool bUseDefault) {
+ bool bUseDefault) const {
void* pKey = GetMapKey_Element(GetXFAObject()->GetElementType(), eAttr);
void* pValue = nullptr;
if (GetMapModuleValue(pKey, pValue)) {
@@ -402,7 +402,7 @@ bool CJX_Object::SetEnum(XFA_Attribute eAttr,
return true;
}
-XFA_AttributeEnum CJX_Object::GetEnum(XFA_Attribute eAttr) {
+XFA_AttributeEnum CJX_Object::GetEnum(XFA_Attribute eAttr) const {
return TryEnum(eAttr, true).value_or(XFA_AttributeEnum::Unknown);
}
@@ -969,8 +969,8 @@ void CJX_Object::SetMapModuleValue(void* pKey, void* pValue) {
CreateMapModuleData()->m_ValueMap[pKey] = pValue;
}
-bool CJX_Object::GetMapModuleValue(void* pKey, void*& pValue) {
- for (CXFA_Node* pNode = ToNode(GetXFAObject()); pNode;
+bool CJX_Object::GetMapModuleValue(void* pKey, void*& pValue) const {
+ for (const CXFA_Node* pNode = ToNode(GetXFAObject()); pNode;
pNode = pNode->GetTemplateNodeIfExists()) {
XFA_MAPMODULEDATA* pModule = pNode->JSObject()->GetMapModuleData();
if (pModule) {
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index c252b45036..deedebc8e5 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -187,9 +187,10 @@ class CJX_Object {
bool bScriptModify);
WideString GetCData(XFA_Attribute eAttr);
- Optional<XFA_AttributeEnum> TryEnum(XFA_Attribute eAttr, bool bUseDefault);
+ Optional<XFA_AttributeEnum> TryEnum(XFA_Attribute eAttr,
+ bool bUseDefault) const;
bool SetEnum(XFA_Attribute eAttr, XFA_AttributeEnum eValue, bool bNotify);
- XFA_AttributeEnum GetEnum(XFA_Attribute eAttr);
+ XFA_AttributeEnum GetEnum(XFA_Attribute eAttr) const;
Optional<bool> TryBoolean(XFA_Attribute eAttr, bool bUseDefault);
bool SetBoolean(XFA_Attribute eAttr, bool bValue, bool bNotify);
@@ -255,7 +256,7 @@ class CJX_Object {
XFA_MAPMODULEDATA* CreateMapModuleData();
XFA_MAPMODULEDATA* GetMapModuleData() const;
void SetMapModuleValue(void* pKey, void* pValue);
- bool GetMapModuleValue(void* pKey, void*& pValue);
+ bool GetMapModuleValue(void* pKey, void*& pValue) const;
bool GetMapModuleString(void* pKey, WideStringView& wsValue);
void SetMapModuleBuffer(void* pKey,
void* pValue,