summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-06 18:17:41 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-06 18:17:41 +0000
commit472bb7f919736ae58461f653597eb6854119cca9 (patch)
treefb7a694e41bba43a7be04b3d7790b0872fee68bf /fxjs
parentd19aa7c572c252dd0398f277d13ec1733f1c7098 (diff)
downloadpdfium-472bb7f919736ae58461f653597eb6854119cca9.tar.xz
Call CJX methods directly instead of proxying
This CL updates the XFA JS code to call the methods on the CJX objects directly instead of proxying through the CXFA objects. The script methods have been removed from the CXFA objects. Change-Id: I2d7b502473a8e88a7af88b10aa0da602d4998394 Reviewed-on: https://pdfium-review.googlesource.com/17851 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cfxjse_engine.cpp29
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp64
-rw-r--r--fxjs/cfxjse_formcalc_context.h4
-rw-r--r--fxjs/cfxjse_resolveprocessor.cpp4
-rw-r--r--fxjs/cfxjse_resolveprocessor.h2
-rw-r--r--fxjs/cjx_hostpseudomodel.cpp26
-rw-r--r--fxjs/cjx_node.cpp31
-rw-r--r--fxjs/cjx_object.cpp1
-rw-r--r--fxjs/cjx_object.h2
9 files changed, 87 insertions, 76 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 6d990f66fb..8ed88d4fab 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -213,14 +213,15 @@ bool CFXJSE_Engine::QueryNodeByFlag(CXFA_Node* refNode,
XFA_RESOLVENODE_RS resolveRs;
if (ResolveObjects(refNode, propname, resolveRs, dwFlag) <= 0)
return false;
- if (resolveRs.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
+ if (resolveRs.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
pValue->Assign(GetJSValueFromMap(resolveRs.objects.front()));
return true;
}
- if (resolveRs.dwFlags == XFA_RESOVENODE_RSTYPE_Attribute) {
+ if (resolveRs.dwFlags == XFA_RESOLVENODE_RSTYPE_Attribute) {
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = resolveRs.pScriptAttribute;
if (lpAttributeInfo) {
- (resolveRs.objects.front()->*(lpAttributeInfo->lpfnCallback))(
+ CJX_Object* jsObject = resolveRs.objects.front()->JSObject();
+ (jsObject->*(lpAttributeInfo->callback))(
pValue, bSetting, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
}
}
@@ -338,7 +339,8 @@ void CFXJSE_Engine::NormalPropertySetter(CFXJSE_Value* pOriginalValue,
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(
pObject->GetElementType(), wsPropName.AsStringView());
if (lpAttributeInfo) {
- (pObject->*(lpAttributeInfo->lpfnCallback))(
+ CJX_Object* jsObject = pObject->JSObject();
+ (jsObject->*(lpAttributeInfo->callback))(
pReturnValue, true, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
} else {
if (pObject->IsNode()) {
@@ -359,7 +361,8 @@ void CFXJSE_Engine::NormalPropertySetter(CFXJSE_Value* pOriginalValue,
XFA_GetScriptAttributeByName(pPropOrChild->GetElementType(),
wsDefaultName.AsStringView());
if (lpAttrInfo) {
- (pPropOrChild->*(lpAttrInfo->lpfnCallback))(
+ CJX_Node* jsObject = pPropOrChild->JSNode();
+ (jsObject->*(lpAttrInfo->callback))(
pReturnValue, true, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute);
return;
}
@@ -418,13 +421,15 @@ void CFXJSE_Engine::NormalMethodCall(CFXJSE_Value* pThis,
CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext();
pObject = lpScriptContext->GetVariablesThis(pObject);
+
WideString wsFunName = WideString::FromUTF8(szFuncName);
const XFA_METHODINFO* lpMethodInfo =
GetMethodByName(pObject->GetElementType(), wsFunName.AsStringView());
if (!lpMethodInfo)
return;
- (pObject->*(lpMethodInfo->lpfnCallback))(&args);
+ CJX_Object* jsObject = pObject->JSObject();
+ (jsObject->*(lpMethodInfo->callback))(&args);
}
bool CFXJSE_Engine::IsStrictScopeInJavaScript() {
return m_pDocument->HasFlag(XFA_DOCFLAG_StrictScoping);
@@ -640,18 +645,18 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject,
}
rndFind.m_CurObject = findObjects[i++];
rndFind.m_nLevel = nLevel;
- rndFind.m_dwFlag = XFA_RESOVENODE_RSTYPE_Nodes;
+ rndFind.m_dwFlag = XFA_RESOLVENODE_RSTYPE_Nodes;
nRet = m_ResolveProcessor->Resolve(rndFind);
if (nRet < 1) {
continue;
}
- if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute &&
+ if (rndFind.m_dwFlag == XFA_RESOLVENODE_RSTYPE_Attribute &&
rndFind.m_pScriptAttribute &&
nStart <
pdfium::base::checked_cast<int32_t>(wsExpression.GetLength())) {
auto pValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
- (rndFind.m_Objects.front()
- ->*(rndFind.m_pScriptAttribute->lpfnCallback))(
+ CJX_Object* jsObject = rndFind.m_Objects.front()->JSObject();
+ (jsObject->*(rndFind.m_pScriptAttribute->callback))(
pValue.get(), false,
(XFA_ATTRIBUTE)rndFind.m_pScriptAttribute->eAttribute);
rndFind.m_Objects.front() = ToObject(pValue.get(), nullptr);
@@ -703,7 +708,7 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject,
resolveNodeRS.objects.insert(resolveNodeRS.objects.end(),
findObjects.begin(), findObjects.end());
}
- if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute) {
+ if (rndFind.m_dwFlag == XFA_RESOLVENODE_RSTYPE_Attribute) {
resolveNodeRS.pScriptAttribute = rndFind.m_pScriptAttribute;
return 1;
}
@@ -713,7 +718,7 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject,
m_ResolveProcessor->SetResultCreateNode(resolveNodeRS,
rndFind.m_wsCondition);
if (!bNextCreate && (dwStyles & XFA_RESOLVENODE_CreateNode)) {
- resolveNodeRS.dwFlags = XFA_RESOVENODE_RSTYPE_ExistNodes;
+ resolveNodeRS.dwFlags = XFA_RESOLVENODE_RSTYPE_ExistNodes;
}
return pdfium::CollectionSize<int32_t>(resolveNodeRS.objects);
}
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index ff74cb9767..c8c78f43eb 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -5193,10 +5193,10 @@ void CFXJSE_FormCalcContext::dot_accessor(CFXJSE_Value* pThis,
for (int32_t i = 2; i < iLength; i++) {
argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(),
- resoveNodeRS, true, szName.IsEmpty()) > 0) {
- ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
+ resolveNodeRS, true, szName.IsEmpty()) > 0) {
+ ParseResolveResult(pThis, resolveNodeRS, hJSObjValue.get(),
&resolveValues[i - 2], &bAttribute);
iCounter += resolveValues[i - 2].size();
}
@@ -5229,18 +5229,18 @@ void CFXJSE_FormCalcContext::dot_accessor(CFXJSE_Value* pThis,
return;
}
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
int32_t iRet = 0;
ByteString bsAccessorName = args.GetUTF8String(1);
if (argAccessor->IsObject() ||
(argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
- resoveNodeRS, true, szName.IsEmpty());
+ resolveNodeRS, true, szName.IsEmpty());
} else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() &&
GetObjectForName(pThis, argAccessor.get(),
bsAccessorName.AsStringView())) {
iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
- resoveNodeRS, true, szName.IsEmpty());
+ resolveNodeRS, true, szName.IsEmpty());
}
if (iRet < 1) {
pContext->ThrowPropertyNotInObjectException(
@@ -5251,7 +5251,7 @@ void CFXJSE_FormCalcContext::dot_accessor(CFXJSE_Value* pThis,
std::vector<std::unique_ptr<CFXJSE_Value>> resolveValues;
bool bAttribute = false;
- ParseResolveResult(pThis, resoveNodeRS, argAccessor.get(), &resolveValues,
+ ParseResolveResult(pThis, resolveNodeRS, argAccessor.get(), &resolveValues,
&bAttribute);
std::vector<std::unique_ptr<CFXJSE_Value>> values;
@@ -5311,10 +5311,10 @@ void CFXJSE_FormCalcContext::dotdot_accessor(CFXJSE_Value* pThis,
bool bAttribute = false;
for (int32_t i = 2; i < iLength; i++) {
argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(),
- resoveNodeRS, false) > 0) {
- ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
+ resolveNodeRS, false) > 0) {
+ ParseResolveResult(pThis, resolveNodeRS, hJSObjValue.get(),
&resolveValues[i - 2], &bAttribute);
iCounter += resolveValues[i - 2].size();
}
@@ -5347,18 +5347,18 @@ void CFXJSE_FormCalcContext::dotdot_accessor(CFXJSE_Value* pThis,
return;
}
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
int32_t iRet = 0;
ByteString bsAccessorName = args.GetUTF8String(1);
if (argAccessor->IsObject() ||
(argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
- resoveNodeRS, false);
+ resolveNodeRS, false);
} else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() &&
GetObjectForName(pThis, argAccessor.get(),
bsAccessorName.AsStringView())) {
iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(),
- resoveNodeRS, false);
+ resolveNodeRS, false);
}
if (iRet < 1) {
pContext->ThrowPropertyNotInObjectException(
@@ -5369,7 +5369,7 @@ void CFXJSE_FormCalcContext::dotdot_accessor(CFXJSE_Value* pThis,
std::vector<std::unique_ptr<CFXJSE_Value>> resolveValues;
bool bAttribute = false;
- ParseResolveResult(pThis, resoveNodeRS, argAccessor.get(), &resolveValues,
+ ParseResolveResult(pThis, resolveNodeRS, argAccessor.get(), &resolveValues,
&bAttribute);
std::vector<std::unique_ptr<CFXJSE_Value>> values;
@@ -5785,7 +5785,8 @@ void CFXJSE_FormCalcContext::GetObjectDefaultValue(
pDefaultValue->SetNull();
return;
}
- pNode->Script_Som_DefaultValue(pDefaultValue, false, (XFA_ATTRIBUTE)-1);
+ pNode->JSNode()->Script_Som_DefaultValue(pDefaultValue, false,
+ (XFA_ATTRIBUTE)-1);
}
// static
@@ -5795,7 +5796,7 @@ bool CFXJSE_FormCalcContext::SetObjectDefaultValue(CFXJSE_Value* pValue,
if (!pNode)
return false;
- pNode->Script_Som_DefaultValue(hNewValue, true, (XFA_ATTRIBUTE)-1);
+ pNode->JSNode()->Script_Som_DefaultValue(hNewValue, true, (XFA_ATTRIBUTE)-1);
return true;
}
@@ -5840,28 +5841,29 @@ bool CFXJSE_FormCalcContext::GetObjectForName(
return false;
CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext();
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
int32_t iRet = pScriptContext->ResolveObjects(
pScriptContext->GetThisObject(),
- WideString::FromUTF8(szAccessorName).AsStringView(), resoveNodeRS,
+ WideString::FromUTF8(szAccessorName).AsStringView(), resolveNodeRS,
dwFlags);
- if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
+ if (iRet >= 1 && resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
accessorValue->Assign(
- pScriptContext->GetJSValueFromMap(resoveNodeRS.objects.front()));
+ pScriptContext->GetJSValueFromMap(resolveNodeRS.objects.front()));
return true;
}
return false;
}
// static
-int32_t CFXJSE_FormCalcContext::ResolveObjects(CFXJSE_Value* pThis,
- CFXJSE_Value* pRefValue,
- const ByteStringView& bsSomExp,
- XFA_RESOLVENODE_RS& resoveNodeRS,
- bool bdotAccessor,
- bool bHasNoResolveName) {
+int32_t CFXJSE_FormCalcContext::ResolveObjects(
+ CFXJSE_Value* pThis,
+ CFXJSE_Value* pRefValue,
+ const ByteStringView& bsSomExp,
+ XFA_RESOLVENODE_RS& resolveNodeRS,
+ bool bdotAccessor,
+ bool bHasNoResolveName) {
CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
if (!pDoc)
return -1;
@@ -5898,13 +5900,13 @@ int32_t CFXJSE_FormCalcContext::ResolveObjects(CFXJSE_Value* pThis,
dFlags = XFA_RESOLVENODE_AnyChild;
}
return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringView(),
- resoveNodeRS, dFlags);
+ resolveNodeRS, dFlags);
}
// static
void CFXJSE_FormCalcContext::ParseResolveResult(
CFXJSE_Value* pThis,
- const XFA_RESOLVENODE_RS& resoveNodeRS,
+ const XFA_RESOLVENODE_RS& resolveNodeRS,
CFXJSE_Value* pParentValue,
std::vector<std::unique_ptr<CFXJSE_Value>>* resultValues,
bool* bAttribute) {
@@ -5915,10 +5917,10 @@ void CFXJSE_FormCalcContext::ParseResolveResult(
CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
+ if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
*bAttribute = false;
CFXJSE_Engine* pScriptContext = pContext->GetDocument()->GetScriptContext();
- for (CXFA_Object* pObject : resoveNodeRS.objects) {
+ for (CXFA_Object* pObject : resolveNodeRS.objects) {
resultValues->push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
resultValues->back()->Assign(pScriptContext->GetJSValueFromMap(pObject));
}
@@ -5926,7 +5928,7 @@ void CFXJSE_FormCalcContext::ParseResolveResult(
}
CXFA_ValueArray objectProperties(pIsolate);
- int32_t iRet = resoveNodeRS.GetAttributeResult(&objectProperties);
+ int32_t iRet = resolveNodeRS.GetAttributeResult(&objectProperties);
*bAttribute = true;
if (iRet != 0) {
*bAttribute = false;
diff --git a/fxjs/cfxjse_formcalc_context.h b/fxjs/cfxjse_formcalc_context.h
index ec9c14b77b..ba331426df 100644
--- a/fxjs/cfxjse_formcalc_context.h
+++ b/fxjs/cfxjse_formcalc_context.h
@@ -395,12 +395,12 @@ class CFXJSE_FormCalcContext : public CFXJSE_HostObject {
static int32_t ResolveObjects(CFXJSE_Value* pThis,
CFXJSE_Value* pParentValue,
const ByteStringView& bsSomExp,
- XFA_RESOLVENODE_RS& resoveNodeRS,
+ XFA_RESOLVENODE_RS& resolveNodeRS,
bool bdotAccessor = true,
bool bHasNoResolveName = false);
static void ParseResolveResult(
CFXJSE_Value* pThis,
- const XFA_RESOLVENODE_RS& resoveNodeRS,
+ const XFA_RESOLVENODE_RS& resolveNodeRS,
CFXJSE_Value* pParentValue,
std::vector<std::unique_ptr<CFXJSE_Value>>* resultValues,
bool* bAttribute);
diff --git a/fxjs/cfxjse_resolveprocessor.cpp b/fxjs/cfxjse_resolveprocessor.cpp
index de4800119b..2ca3a44525 100644
--- a/fxjs/cfxjse_resolveprocessor.cpp
+++ b/fxjs/cfxjse_resolveprocessor.cpp
@@ -207,7 +207,7 @@ int32_t CFXJSE_ResolveProcessor::ResolveForAttributeRs(
rnd.m_pScriptAttribute = lpScriptAttribute;
rnd.m_Objects.push_back(curNode);
- rnd.m_dwFlag = XFA_RESOVENODE_RSTYPE_Attribute;
+ rnd.m_dwFlag = XFA_RESOLVENODE_RSTYPE_Attribute;
return 1;
}
@@ -794,6 +794,6 @@ CFXJSE_ResolveNodeData::CFXJSE_ResolveNodeData(CFXJSE_Engine* pSC)
m_Objects(),
m_dwStyles(XFA_RESOLVENODE_Children),
m_pScriptAttribute(nullptr),
- m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {}
+ m_dwFlag(XFA_RESOLVENODE_RSTYPE_Nodes) {}
CFXJSE_ResolveNodeData::~CFXJSE_ResolveNodeData() {}
diff --git a/fxjs/cfxjse_resolveprocessor.h b/fxjs/cfxjse_resolveprocessor.h
index f376cca4c7..2961d21727 100644
--- a/fxjs/cfxjse_resolveprocessor.h
+++ b/fxjs/cfxjse_resolveprocessor.h
@@ -29,7 +29,7 @@ class CFXJSE_ResolveNodeData {
std::vector<CXFA_Object*> m_Objects; // Not owned.
uint32_t m_dwStyles;
const XFA_SCRIPTATTRIBUTEINFO* m_pScriptAttribute;
- XFA_RESOVENODE_RSTYPE m_dwFlag;
+ XFA_RESOLVENODE_RSTYPE m_dwFlag;
};
class CFXJSE_ResolveProcessor {
diff --git a/fxjs/cjx_hostpseudomodel.cpp b/fxjs/cjx_hostpseudomodel.cpp
index b667e7a7f0..5b6fa02591 100644
--- a/fxjs/cjx_hostpseudomodel.cpp
+++ b/fxjs/cjx_hostpseudomodel.cpp
@@ -283,13 +283,14 @@ void CJX_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) {
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- pObject, pValue->ToWideString().AsStringView(), resoveNodeRS, dwFlag);
- if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode())
+ pObject, pValue->ToWideString().AsStringView(), resolveNodeRS,
+ dwFlag);
+ if (iRet < 1 || !resolveNodeRS.objects.front()->IsNode())
return;
- pNode = resoveNodeRS.objects.front()->AsNode();
+ pNode = resolveNodeRS.objects.front()->AsNode();
}
}
@@ -386,13 +387,13 @@ void CJX_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) {
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- pObject, wsName.AsStringView(), resoveNodeRS, dwFlag);
- if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode())
+ pObject, wsName.AsStringView(), resolveNodeRS, dwFlag);
+ if (iRet < 1 || !resolveNodeRS.objects.front()->IsNode())
continue;
- pNode = resoveNodeRS.objects.front()->AsNode();
+ pNode = resolveNodeRS.objects.front()->AsNode();
pNotify->ResetData(pNode->GetWidgetData());
}
if (!pNode)
@@ -450,13 +451,14 @@ void CJX_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) {
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- pObject, pValue->ToWideString().AsStringView(), resoveNodeRS, dwFlag);
- if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode())
+ pObject, pValue->ToWideString().AsStringView(), resolveNodeRS,
+ dwFlag);
+ if (iRet < 1 || !resolveNodeRS.objects.front()->IsNode())
return;
- pNode = resoveNodeRS.objects.front()->AsNode();
+ pNode = resolveNodeRS.objects.front()->AsNode();
}
}
pNotify->SetFocusWidgetNode(pNode);
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index 945b12f868..c710d31812 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -450,24 +450,25 @@ void CJX_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) {
uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
int32_t iRet = pScriptContext->ResolveObjects(
- refNode, wsExpression.AsStringView(), resoveNodeRS, dwFlag);
+ refNode, wsExpression.AsStringView(), resolveNodeRS, dwFlag);
if (iRet < 1) {
pArguments->GetReturnValue()->SetNull();
return;
}
- if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- CXFA_Object* pObject = resoveNodeRS.objects.front();
+ if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ CXFA_Object* pObject = resolveNodeRS.objects.front();
pArguments->GetReturnValue()->Assign(
pScriptContext->GetJSValueFromMap(pObject));
} else {
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
- resoveNodeRS.pScriptAttribute;
+ resolveNodeRS.pScriptAttribute;
if (lpAttributeInfo && lpAttributeInfo->eValueType == XFA_SCRIPT_Object) {
auto pValue =
pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetRuntime());
- (resoveNodeRS.objects.front()->*(lpAttributeInfo->lpfnCallback))(
+ CJX_Object* jsObject = resolveNodeRS.objects.front()->JSObject();
+ (jsObject->*(lpAttributeInfo->callback))(
pValue.get(), false, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
pArguments->GetReturnValue()->Assign(pValue.get());
} else {
@@ -503,20 +504,20 @@ void CJX_Node::ResolveNodeList(CFXJSE_Value* pValue,
CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
if (!pScriptContext)
return;
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
if (!refNode)
refNode = GetXFANode();
pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(),
- resoveNodeRS, dwFlag);
+ resolveNodeRS, dwFlag);
CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(GetDocument());
- if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
- for (CXFA_Object* pObject : resoveNodeRS.objects) {
+ if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ for (CXFA_Object* pObject : resolveNodeRS.objects) {
if (pObject->IsNode())
pNodeList->Append(pObject->AsNode());
}
} else {
CXFA_ValueArray valueArray(pScriptContext->GetRuntime());
- if (resoveNodeRS.GetAttributeResult(&valueArray) > 0) {
+ if (resolveNodeRS.GetAttributeResult(&valueArray) > 0) {
for (CXFA_Object* pObject : valueArray.GetAttributeObject()) {
if (pObject->IsNode())
pNodeList->Append(pObject->AsNode());
@@ -1268,11 +1269,11 @@ void CJX_Node::Script_Attribute_String(CFXJSE_Value* pValue,
XFA_RESOLVENODE_Attributes |
XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_Siblings;
- XFA_RESOLVENODE_RS resoveNodeRS;
+ XFA_RESOLVENODE_RS resolveNodeRS;
int32_t iRet = GetDocument()->GetScriptContext()->ResolveObjects(
- pProtoRoot, wsSOM.AsStringView(), resoveNodeRS, dwFlag);
- if (iRet > 0 && resoveNodeRS.objects.front()->IsNode()) {
- pProtoNode = resoveNodeRS.objects.front()->AsNode();
+ pProtoRoot, wsSOM.AsStringView(), resolveNodeRS, dwFlag);
+ if (iRet > 0 && resolveNodeRS.objects.front()->IsNode()) {
+ pProtoNode = resolveNodeRS.objects.front()->AsNode();
}
} else if (!wsID.IsEmpty()) {
pProtoNode =
diff --git a/fxjs/cjx_object.cpp b/fxjs/cjx_object.cpp
index 3efab63d48..5a334cf3cd 100644
--- a/fxjs/cjx_object.cpp
+++ b/fxjs/cjx_object.cpp
@@ -7,6 +7,7 @@
#include "fxjs/cjx_object.h"
#include "fxjs/cfxjse_value.h"
+#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_object.h"
CJX_Object::CJX_Object(CXFA_Object* obj) : object_(obj) {}
diff --git a/fxjs/cjx_object.h b/fxjs/cjx_object.h
index 27006f5169..e21b38ec86 100644
--- a/fxjs/cjx_object.h
+++ b/fxjs/cjx_object.h
@@ -10,10 +10,10 @@
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxcrt/widestring.h"
#include "xfa/fxfa/fxfa_basic.h"
-#include "xfa/fxfa/parser/cxfa_document.h"
class CFXJSE_Value;
class CXFA_Object;
+class CXFA_Document;
class CJX_Object {
public: