summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-28 07:43:51 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-28 07:43:51 -0700
commit017052a077d8f900e3098b8f9115078a037ee805 (patch)
tree849af68a530e45ba66d9333393789dcec0f6561c
parent2d6dda170d84564f6ca5845ea934a886ac9bf746 (diff)
downloadpdfium-chromium/2786.tar.xz
Change CXFA_Node::GetClassName to returnchromium/2786chromium/2784
CXFA_Node::GetClassName currently takes an out parameter and returns void. This CL updates the signature to return the value and require no parameters. Review-Url: https://codereview.chromium.org/2104963002
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp7
-rw-r--r--xfa/fxfa/parser/xfa_document_serialize.cpp6
-rw-r--r--xfa/fxfa/parser/xfa_object.h2
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp20
-rw-r--r--xfa/fxfa/parser/xfa_script_nodehelper.cpp4
5 files changed, 14 insertions, 25 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 88e3527b94..37d52a9d4d 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -6258,12 +6258,9 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis,
CFX_WideString wsName;
if (CXFA_Node* pXFANode = pNode->AsNode())
pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
+ if (wsName.IsEmpty())
+ wsName = FX_WSTRC(L"#") + pNode->GetClassName();
- if (wsName.IsEmpty()) {
- CFX_WideStringC className;
- pNode->GetClassName(className);
- wsName = FX_WSTRC(L"#") + className;
- }
wsSomExpression = wsName + wsSomExpression;
dFlags = XFA_RESOLVENODE_Siblings;
} else {
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index 52aa58530e..febfa3e827 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -347,8 +347,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed(
}
if (!wsChildren.IsEmpty() || !wsAttrs.IsEmpty() ||
pNode->HasAttribute(XFA_ATTRIBUTE_Name)) {
- CFX_WideStringC wsElement;
- pNode->GetClassName(wsElement);
+ CFX_WideStringC wsElement = pNode->GetClassName();
CFX_WideString wsName;
XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE,
wsName);
@@ -382,8 +381,7 @@ static void XFA_DataExporter_RegenerateFormFile_Container(
}
return;
}
- CFX_WideStringC wsElement;
- pNode->GetClassName(wsElement);
+ CFX_WideStringC wsElement = pNode->GetClassName();
pStream->WriteString(L"<", 1);
pStream->WriteString(wsElement.c_str(), wsElement.GetLength());
CFX_WideString wsOutput;
diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h
index fd73d8bb2e..a838b17578 100644
--- a/xfa/fxfa/parser/xfa_object.h
+++ b/xfa/fxfa/parser/xfa_object.h
@@ -84,7 +84,7 @@ class CXFA_Object : public CFXJSE_HostObject {
const CXFA_NodeList* AsNodeList() const;
XFA_Element GetElementType() const;
- void GetClassName(CFX_WideStringC& wsName) const;
+ CFX_WideStringC GetClassName() const;
uint32_t GetClassHashCode() const;
void Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
FX_BOOL bSetting,
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 04b33b47c9..99198d24f5 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -61,8 +61,8 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument,
CXFA_Object::~CXFA_Object() {}
-void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const {
- wsName = XFA_GetElementByID(GetElementType())->pName;
+CFX_WideStringC CXFA_Object::GetClassName() const {
+ return XFA_GetElementByID(GetElementType())->pName;
}
uint32_t CXFA_Object::GetClassHashCode() const {
@@ -77,8 +77,7 @@ void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
FX_BOOL bSetting,
XFA_ATTRIBUTE eAttribute) {
if (!bSetting) {
- CFX_WideStringC className;
- GetClassName(className);
+ CFX_WideStringC className = GetClassName();
pValue->SetString(
FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC());
} else {
@@ -751,9 +750,8 @@ void CXFA_Node::Script_TreeClass_ClassAll(CFXJSE_Value* pValue,
ThrowException(XFA_IDS_INVAlID_PROP_SET);
} else {
uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL;
- CFX_WideStringC wsName;
- GetClassName(wsName);
- CFX_WideString wsExpression = FX_WSTRC(L"#") + wsName + FX_WSTRC(L"[*]");
+ CFX_WideString wsExpression =
+ FX_WSTRC(L"#") + GetClassName() + FX_WSTRC(L"[*]");
Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag);
}
}
@@ -965,11 +963,9 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode();
pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : nullptr;
}
- if (!pFakeXMLRoot) {
- CFX_WideStringC wsClassName;
- GetClassName(wsClassName);
- pFakeXMLRoot = new CFDE_XMLElement(CFX_WideString(wsClassName));
- }
+ if (!pFakeXMLRoot)
+ pFakeXMLRoot = new CFDE_XMLElement(CFX_WideString(GetClassName()));
+
if (bIgnoreRoot) {
CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
while (pXMLChild) {
diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
index e866a1923d..3a80d89a94 100644
--- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp
+++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
@@ -284,13 +284,11 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode,
return;
}
- CFX_WideStringC wsTagName;
CFX_WideString ws;
FX_BOOL bIsProperty = XFA_NodeIsProperty(refNode);
if (refNode->IsUnnamed() ||
(bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) {
- refNode->GetClassName(wsTagName);
- ws = wsTagName;
+ ws = refNode->GetClassName();
wsName.Format(L"#%s[%d]", ws.c_str(),
XFA_GetIndex(refNode, eLogicType, bIsProperty, TRUE));
return;