summaryrefslogtreecommitdiff
path: root/fxjs/cjx_node.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-30 20:33:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-30 20:33:20 +0000
commitb58bf90755050e1bb6c5d33c329cdaf6cdde36ae (patch)
tree00845c6e65f41a6717c94f51e98866a32914d79d /fxjs/cjx_node.cpp
parent21b08271e32f3142fb840b04adc5d2adb15f4f78 (diff)
downloadpdfium-b58bf90755050e1bb6c5d33c329cdaf6cdde36ae.tar.xz
Rename GetAttributeEnumById to CXFA_Node::AttributeEnumToName
This is more consistent with the attribute and element to name methods. Change-Id: I3a7f9246d6fbaffa27a0068d8f93e717f5801d2a Reviewed-on: https://pdfium-review.googlesource.com/19851 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjx_node.cpp')
-rw-r--r--fxjs/cjx_node.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index fe1612d022..338a160e77 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -244,7 +244,7 @@ pdfium::Optional<WideString> CJX_Node::TryAttribute(XFA_Attribute eAttr,
if (!value)
return {};
- return {GetAttributeEnumByID(*value)->pName};
+ return {CXFA_Node::AttributeEnumToName(*value)};
}
case XFA_AttributeType::CData:
return TryCData(eAttr, bUseDefault);
@@ -1756,13 +1756,8 @@ void CJX_Node::Script_Som_Mandatory(CFXJSE_Value* pValue,
return;
}
- const XFA_ATTRIBUTEENUMINFO* pInfo =
- GetAttributeEnumByID(validateData.GetNullTest());
- if (!pInfo) {
- pValue->SetString("");
- return;
- }
- pValue->SetString(WideString(pInfo->pName).UTF8Encode().AsStringView());
+ WideString str = CXFA_Node::AttributeEnumToName(validateData.GetNullTest());
+ pValue->SetString(str.UTF8Encode().AsStringView());
}
void CJX_Node::Script_Som_MandatoryMessage(CFXJSE_Value* pValue,
@@ -3202,7 +3197,8 @@ bool CJX_Node::SetValue(XFA_Attribute eAttr,
case XFA_AttributeType::Enum:
elem->SetString(
CXFA_Node::AttributeToName(eAttr),
- GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue)->pName);
+ CXFA_Node::AttributeEnumToName(static_cast<XFA_ATTRIBUTEENUM>(
+ reinterpret_cast<uintptr_t>(pValue))));
break;
case XFA_AttributeType::Boolean:
elem->SetString(CXFA_Node::AttributeToName(eAttr), pValue ? L"1" : L"0");