summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-30 20:50:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-30 20:50:20 +0000
commit0ae8e03cc2d310ba0ba19b878ea448f17a577cdb (patch)
treee52a04144fd4945e3c90aadaeb11f4892f52baa2 /fxjs
parent9a2267d2531f4e75a6bcafb48abacfefe8a4a555 (diff)
downloadpdfium-0ae8e03cc2d310ba0ba19b878ea448f17a577cdb.tar.xz
Create CXFA_Node::NameToAttributeEnum
This CL removes XFA_GetAttributeEnumByName and moves the functionality into CXFA_Node::NameToAttriuteEnum. Change-Id: Id1484103c62bf7728d5406c22fb9d83fc0e032e1 Reviewed-on: https://pdfium-review.googlesource.com/19791 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cjx_node.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index 6b717f2d9d..3442b35b9d 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -193,10 +193,11 @@ bool CJX_Node::SetAttribute(XFA_Attribute eAttr,
XFA_AttributeType eType = GetXFANode()->GetAttributeType(eAttr);
switch (eType) {
case XFA_AttributeType::Enum: {
- const XFA_ATTRIBUTEENUMINFO* pEnum = XFA_GetAttributeEnumByName(wsValue);
- return SetEnum(
- eAttr, pEnum ? pEnum->eName : *(GetXFANode()->GetDefaultEnum(eAttr)),
- bNotify);
+ pdfium::Optional<XFA_ATTRIBUTEENUM> item =
+ CXFA_Node::NameToAttributeEnum(wsValue);
+ return SetEnum(eAttr,
+ item ? *item : *(GetXFANode()->GetDefaultEnum(eAttr)),
+ bNotify);
}
case XFA_AttributeType::CData:
return SetCData(eAttr, WideString(wsValue), bNotify, false);