summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_hostpseudomodel.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-17 19:28:52 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-17 19:28:52 +0000
commit3a6d058740a9908a06efb9e9362df01acdee6ff8 (patch)
tree9bc645b0cb3442749458fc63e2feb04c0cb813ef /fxjs/xfa/cjx_hostpseudomodel.cpp
parent0a2328e0eff7a11aa49b7da8f013e658153a7b1a (diff)
downloadpdfium-3a6d058740a9908a06efb9e9362df01acdee6ff8.tar.xz
Rename CJS_Return to CJS_Result.
"Return" is a verb, and "return" is a reserved-word at that, so avoid using it as part of a class name. Fully mechanical change apart from rename. Change-Id: I120e453e8ba001c4ab74a39e2da6aa6eb590835f Reviewed-on: https://pdfium-review.googlesource.com/40532 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_hostpseudomodel.cpp')
-rw-r--r--fxjs/xfa/cjx_hostpseudomodel.cpp146
1 files changed, 73 insertions, 73 deletions
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index 8cf82b30d4..748641ab8a 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -239,37 +239,37 @@ void CJX_HostPseudoModel::name(CFXJSE_Value* pValue,
pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringView());
}
-CJS_Return CJX_HostPseudoModel::gotoURL(
+CJS_Result CJX_HostPseudoModel::gotoURL(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (!GetDocument()->GetScriptContext()->IsRunAtClient())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
WideString URL = runtime->ToWideString(params[0]);
hDoc->GetDocEnvironment()->GotoURL(hDoc, URL);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::openList(
+CJS_Result CJX_HostPseudoModel::openList(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (!GetDocument()->GetScriptContext()->IsRunAtClient())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_Node* pNode = nullptr;
if (params[0]->IsObject()) {
@@ -278,11 +278,11 @@ CJS_Return CJX_HostPseudoModel::openList(
} else if (params[0]->IsString()) {
CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
if (!pScriptContext)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_Object* pObject = pScriptContext->GetThisObject();
if (!pObject)
- return CJS_Return::Success();
+ return CJS_Result::Success();
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
@@ -291,35 +291,35 @@ CJS_Return CJX_HostPseudoModel::openList(
pObject, runtime->ToWideString(params[0]).AsStringView(),
&resolveNodeRS, dwFlag, nullptr);
if (!iRet || !resolveNodeRS.objects.front()->IsNode())
- return CJS_Return::Success();
+ return CJS_Result::Success();
pNode = resolveNodeRS.objects.front()->AsNode();
}
CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
if (!pDocLayout)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_FFWidget* hWidget =
XFA_GetWidgetFromLayoutItem(pDocLayout->GetLayoutItem(pNode));
if (!hWidget)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
hDoc->GetDocEnvironment()->SetFocusWidget(hDoc, hWidget);
pNotify->OpenDropDownList(hWidget);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::response(
+CJS_Result CJX_HostPseudoModel::response(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.empty() || params.size() > 4)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
WideString question;
if (params.size() >= 1)
@@ -339,25 +339,25 @@ CJS_Return CJX_HostPseudoModel::response(
WideString answer =
pNotify->GetAppProvider()->Response(question, title, defaultAnswer, mark);
- return CJS_Return::Success(
+ return CJS_Result::Success(
runtime->NewString(answer.UTF8Encode().AsStringView()));
}
-CJS_Return CJX_HostPseudoModel::documentInBatch(
+CJS_Result CJX_HostPseudoModel::documentInBatch(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
- return CJS_Return::Success(runtime->NewNumber(0));
+ return CJS_Result::Success(runtime->NewNumber(0));
}
-CJS_Return CJX_HostPseudoModel::resetData(
+CJS_Result CJX_HostPseudoModel::resetData(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() > 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
WideString expression;
if (params.size() >= 1)
@@ -365,7 +365,7 @@ CJS_Return CJX_HostPseudoModel::resetData(
if (expression.IsEmpty()) {
pNotify->ResetData(nullptr);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
int32_t iStart = 0;
@@ -376,11 +376,11 @@ CJS_Return CJX_HostPseudoModel::resetData(
iStart = FilterName(expression.AsStringView(), iStart, wsName);
CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
if (!pScriptContext)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_Object* pObject = pScriptContext->GetThisObject();
if (!pObject)
- return CJS_Return::Success();
+ return CJS_Result::Success();
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
@@ -396,42 +396,42 @@ CJS_Return CJX_HostPseudoModel::resetData(
if (!pNode)
pNotify->ResetData(nullptr);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::beep(
+CJS_Result CJX_HostPseudoModel::beep(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (!GetDocument()->GetScriptContext()->IsRunAtClient())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (params.size() > 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
uint32_t dwType = 4;
if (params.size() >= 1)
dwType = runtime->ToInt32(params[0]);
pNotify->GetAppProvider()->Beep(dwType);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::setFocus(
+CJS_Result CJX_HostPseudoModel::setFocus(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (!GetDocument()->GetScriptContext()->IsRunAtClient())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_Node* pNode = nullptr;
if (params.size() >= 1) {
@@ -441,11 +441,11 @@ CJS_Return CJX_HostPseudoModel::setFocus(
} else if (params[0]->IsString()) {
CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
if (!pScriptContext)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_Object* pObject = pScriptContext->GetThisObject();
if (!pObject)
- return CJS_Return::Success();
+ return CJS_Result::Success();
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
@@ -454,47 +454,47 @@ CJS_Return CJX_HostPseudoModel::setFocus(
pObject, runtime->ToWideString(params[0]).AsStringView(),
&resolveNodeRS, dwFlag, nullptr);
if (!iRet || !resolveNodeRS.objects.front()->IsNode())
- return CJS_Return::Success();
+ return CJS_Result::Success();
pNode = resolveNodeRS.objects.front()->AsNode();
}
}
pNotify->SetFocusWidgetNode(pNode);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::getFocus(
+CJS_Result CJX_HostPseudoModel::getFocus(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_Node* pNode = pNotify->GetFocusWidgetNode();
if (!pNode)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CFXJSE_Value* value =
GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode);
if (!value)
- return CJS_Return::Success(runtime->NewNull());
+ return CJS_Result::Success(runtime->NewNull());
- return CJS_Return::Success(
+ return CJS_Result::Success(
value->DirectGetValue().Get(runtime->GetIsolate()));
}
-CJS_Return CJX_HostPseudoModel::messageBox(
+CJS_Result CJX_HostPseudoModel::messageBox(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (!GetDocument()->GetScriptContext()->IsRunAtClient())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (params.empty() || params.size() > 4)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
WideString message;
if (params.size() >= 1)
@@ -520,27 +520,27 @@ CJS_Return CJX_HostPseudoModel::messageBox(
int32_t iValue = pNotify->GetAppProvider()->MsgBox(message, title,
messageType, buttonType);
- return CJS_Return::Success(runtime->NewNumber(iValue));
+ return CJS_Result::Success(runtime->NewNumber(iValue));
}
-CJS_Return CJX_HostPseudoModel::documentCountInBatch(
+CJS_Result CJX_HostPseudoModel::documentCountInBatch(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
- return CJS_Return::Success(runtime->NewNumber(0));
+ return CJS_Result::Success(runtime->NewNumber(0));
}
-CJS_Return CJX_HostPseudoModel::print(
+CJS_Result CJX_HostPseudoModel::print(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (!GetDocument()->GetScriptContext()->IsRunAtClient())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (params.size() != 8)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
uint32_t dwOptions = 0;
if (runtime->ToBoolean(params[0]))
@@ -561,27 +561,27 @@ CJS_Return CJX_HostPseudoModel::print(
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
hDoc->GetDocEnvironment()->Print(hDoc, nStartPage, nEndPage, dwOptions);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::importData(
+CJS_Result CJX_HostPseudoModel::importData(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.empty() || params.size() > 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::exportData(
+CJS_Result CJX_HostPseudoModel::exportData(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.empty() || params.size() > 2)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
WideString filePath;
if (params.size() >= 1)
@@ -593,39 +593,39 @@ CJS_Return CJX_HostPseudoModel::exportData(
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
hDoc->GetDocEnvironment()->ExportData(hDoc, filePath, XDP);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::pageUp(
+CJS_Result CJX_HostPseudoModel::pageUp(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc);
int32_t nNewPage = 0;
if (nCurPage <= 1)
- return CJS_Return::Success();
+ return CJS_Result::Success();
nNewPage = nCurPage - 1;
hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJX_HostPseudoModel::pageDown(
+CJS_Result CJX_HostPseudoModel::pageDown(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (!pNotify)
- return CJS_Return::Success();
+ return CJS_Result::Success();
CXFA_FFDoc* hDoc = pNotify->GetHDOC();
int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc);
int32_t nPageCount = hDoc->GetDocEnvironment()->CountPages(hDoc);
if (!nPageCount || nCurPage == nPageCount)
- return CJS_Return::Success();
+ return CJS_Result::Success();
int32_t nNewPage = 0;
if (nCurPage >= nPageCount)
@@ -634,5 +634,5 @@ CJS_Return CJX_HostPseudoModel::pageDown(
nNewPage = nCurPage + 1;
hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}