summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-04 16:27:53 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-05 15:29:57 +0000
commita63f992c043bc64a11c1eee5c8e7c9af1860650e (patch)
tree01b87dc31244f752b579ebc9e50f658edf6e4d9c
parent9aeb0caba4cda9c6bd39ed079f88000a712f9890 (diff)
downloadpdfium-a63f992c043bc64a11c1eee5c8e7c9af1860650e.tar.xz
Convert CXFA_NodeHelper::GetNameExpression to return WideString
Change-Id: Id762e195632a691c392873113f01852686bbb55f Reviewed-on: https://pdfium-review.googlesource.com/22262 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--fxjs/cfxjse_engine.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.cpp26
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.h8
3 files changed, 17 insertions, 21 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 224cb25fd7..b9cd502e96 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -741,8 +741,8 @@ int32_t CFXJSE_Engine::GetIndexByClassName(CXFA_Node* refNode) {
void CFXJSE_Engine::GetSomExpression(CXFA_Node* refNode,
WideString& wsExpression) {
CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper();
- lpNodeHelper->GetNameExpression(refNode, wsExpression, true,
- XFA_LOGIC_Transparent);
+ wsExpression =
+ lpNodeHelper->GetNameExpression(refNode, true, XFA_LOGIC_Transparent);
}
void CFXJSE_Engine::SetNodesOfRunScript(std::vector<CXFA_Node*>* pArray) {
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp
index 2c3c46dbb5..98e4bdce42 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -230,24 +230,23 @@ int32_t CXFA_NodeHelper::GetIndex(CXFA_Node* pNode,
return 0;
}
-void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode,
- WideString& wsName,
- bool bIsAllPath,
- XFA_LOGIC_TYPE eLogicType) {
- wsName.clear();
+WideString CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode,
+ bool bIsAllPath,
+ XFA_LOGIC_TYPE eLogicType) {
+ WideString wsName;
if (bIsAllPath) {
- GetNameExpression(refNode, wsName, false, eLogicType);
+ wsName = GetNameExpression(refNode, false, eLogicType);
WideString wsParent;
CXFA_Node* parent =
ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent);
while (parent) {
- GetNameExpression(parent, wsParent, false, eLogicType);
+ wsParent = GetNameExpression(parent, false, eLogicType);
wsParent += L".";
wsParent += wsName;
wsName = wsParent;
parent = ResolveNodes_GetParent(parent, XFA_LOGIC_NoTransparent);
}
- return;
+ return wsName;
}
WideString ws;
@@ -255,16 +254,13 @@ void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode,
if (refNode->IsUnnamed() ||
(bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) {
ws = refNode->GetClassName();
- wsName =
- WideString::Format(L"#%ls[%d]", ws.c_str(),
- GetIndex(refNode, eLogicType, bIsProperty, true));
- return;
+ return WideString::Format(L"#%ls[%d]", ws.c_str(),
+ GetIndex(refNode, eLogicType, bIsProperty, true));
}
ws = refNode->JSObject()->GetCData(XFA_Attribute::Name);
ws.Replace(L".", L"\\.");
- wsName =
- WideString::Format(L"%ls[%d]", ws.c_str(),
- GetIndex(refNode, eLogicType, bIsProperty, false));
+ return WideString::Format(L"%ls[%d]", ws.c_str(),
+ GetIndex(refNode, eLogicType, bIsProperty, false));
}
bool CXFA_NodeHelper::NodeIsTransparent(CXFA_Node* refNode) {
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h
index 394259e53d..e13387ec9e 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.h
+++ b/xfa/fxfa/parser/cxfa_nodehelper.h
@@ -48,10 +48,10 @@ class CXFA_NodeHelper {
XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent,
bool bIsProperty = false,
bool bIsClassIndex = false);
- void GetNameExpression(CXFA_Node* refNode,
- WideString& wsName,
- bool bIsAllPath,
- XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent);
+ WideString GetNameExpression(
+ CXFA_Node* refNode,
+ bool bIsAllPath,
+ XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent);
bool NodeIsTransparent(CXFA_Node* refNode);
bool ResolveNodes_CreateNode(WideString wsName,
WideString wsCondition,