summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-02 17:45:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-02 17:45:25 -0700
commit8f3074bef53ed941daef3f32981b1449db7bcc26 (patch)
tree3d2aaca633cf24117bf2b3bfde236ec4047927d3 /xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
parentdb444d2063df6c574882d9263e885c4fe1134133 (diff)
downloadpdfium-8f3074bef53ed941daef3f32981b1449db7bcc26.tar.xz
Remove FXJSE_Value_ToObject and call methods directly
This Cl removes the global FXJSE_Value_ToObject method and adds individual methods on CXFA_Value to do the needed conversions. Review-Url: https://codereview.chromium.org/2026993003
Diffstat (limited to 'xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
index 3b5f681a0f..3adabe6a6e 100644
--- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
@@ -19,6 +19,14 @@
#include "xfa/fxfa/parser/xfa_utils.h"
#include "xfa/fxjse/cfxjse_arguments.h"
+namespace {
+
+CXFA_Node* ToNode(CFXJSE_Value* pValue, CFXJSE_Class* pClass) {
+ return static_cast<CXFA_Node*>(pValue->ToHostObject(pClass));
+}
+
+} // namespace
+
CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument)
: CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) {
m_uScriptHash = XFA_HASHCODE_Host;
@@ -309,8 +317,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList(
if (iLength >= 1) {
std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
if (FXJSE_Value_IsObject(pValue.get())) {
- pNode =
- static_cast<CXFA_Node*>(FXJSE_Value_ToObject(pValue.get(), nullptr));
+ pNode = ToNode(pValue.get(), nullptr);
} else if (FXJSE_Value_IsUTF8String(pValue.get())) {
CFX_ByteString bsString;
FXJSE_Value_ToUTF8String(pValue.get(), bsString);
@@ -507,8 +514,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus(
if (iLength >= 1) {
std::unique_ptr<CFXJSE_Value> pValue(pArguments->GetValue(0));
if (FXJSE_Value_IsObject(pValue.get())) {
- pNode =
- static_cast<CXFA_Node*>(FXJSE_Value_ToObject(pValue.get(), nullptr));
+ pNode = ToNode(pValue.get(), nullptr);
} else if (FXJSE_Value_IsUTF8String(pValue.get())) {
CFX_ByteString bsString;
FXJSE_Value_ToUTF8String(pValue.get(), bsString);