diff options
author | dsinclair <dsinclair@chromium.org> | 2016-06-09 11:48:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-09 11:48:23 -0700 |
commit | 2f5582f46dce2abfe9d75ea5f885a2ce0a4c10d2 (patch) | |
tree | 5e4d1dd72b8af7e887912e9f8bf764a9044eba89 /xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | |
parent | bd136fb1ad8faa377bee0982ee9ef09d150ce6ca (diff) | |
download | pdfium-2f5582f46dce2abfe9d75ea5f885a2ce0a4c10d2.tar.xz |
Convert CFXJSE_Value::ToString to return.
ThiS Cl updates CFXJSE_Value::ToString() to return a CFX_ByteString instead
of taking an out parameter. It also adds a ToStringC() and ToWideString()
to hide the common conversions that are done on the string value.
Review-Url: https://codereview.chromium.org/2044293004
Diffstat (limited to 'xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index 1a3ef8f151..ef2bafb81e 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -163,10 +163,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - CFX_ByteString bsValue; - pValue->ToString(bsValue); - pNotify->GetDocProvider()->SetTitle( - hDoc, CFX_WideString::FromUTF8(bsValue.AsStringC())); + pNotify->GetDocProvider()->SetTitle(hDoc, pValue->ToWideString()); return; } CFX_WideString wsTitle; @@ -314,10 +311,6 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( if (pValue->IsObject()) { pNode = ToNode(pValue.get(), nullptr); } else if (pValue->IsString()) { - CFX_ByteString bsString; - pValue->ToString(bsString); - CFX_WideString wsExpression = - CFX_WideString::FromUTF8(bsString.AsStringC()); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -330,7 +323,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( - pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); + pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) return; @@ -509,10 +502,6 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( if (pValue->IsObject()) { pNode = ToNode(pValue.get(), nullptr); } else if (pValue->IsString()) { - CFX_ByteString bsString; - pValue->ToString(bsString); - CFX_WideString wsExpression = - CFX_WideString::FromUTF8(bsString.AsStringC()); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -525,7 +514,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( - pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); + pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) return; @@ -613,9 +602,7 @@ FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( if (pValueArg->IsNull()) { wsValue = FX_WSTRC(L""); } else { - CFX_ByteString byMessage; - pValueArg->ToString(byMessage); - wsValue = CFX_WideString::FromUTF8(byMessage.AsStringC()); + wsValue = pValueArg->ToWideString(); } return TRUE; } |