summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxjs/cfxjse_engine.cpp26
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp4
-rw-r--r--fxjs/cfxjse_resolveprocessor.cpp20
-rw-r--r--fxjs/cfxjse_resolveprocessor.h4
-rw-r--r--fxjs/cjx_node.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.h2
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp8
-rw-r--r--xfa/fxfa/parser/xfa_resolvenode_rs.h18
10 files changed, 45 insertions, 53 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index a2bebdb7f9..821b8da70f 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -175,11 +175,11 @@ bool CFXJSE_Engine::QueryNodeByFlag(CXFA_Node* refNode,
XFA_RESOLVENODE_RS resolveRs;
if (!ResolveObjects(refNode, propname, &resolveRs, dwFlag, nullptr))
return false;
- if (resolveRs.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ if (resolveRs.dwFlags == XFA_ResolveNode_RSType_Nodes) {
pValue->Assign(GetJSValueFromMap(resolveRs.objects.front()));
return true;
}
- if (resolveRs.dwFlags == XFA_RESOLVENODE_RSTYPE_Attribute) {
+ if (resolveRs.dwFlags == XFA_ResolveNode_RSType_Attribute) {
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = resolveRs.pScriptAttribute;
if (lpAttributeInfo) {
CJX_Object* jsObject = resolveRs.objects.front()->JSObject();
@@ -641,11 +641,11 @@ bool CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject,
}
rndFind.m_CurObject = findObjects[i++];
rndFind.m_nLevel = nLevel;
- rndFind.m_dwFlag = XFA_RESOLVENODE_RSTYPE_Nodes;
+ rndFind.m_dwFlag = XFA_ResolveNode_RSType_Nodes;
if (!m_ResolveProcessor->Resolve(rndFind))
continue;
- if (rndFind.m_dwFlag == XFA_RESOLVENODE_RSTYPE_Attribute &&
+ if (rndFind.m_dwFlag == XFA_ResolveNode_RSType_Attribute &&
rndFind.m_pScriptAttribute &&
nStart <
pdfium::base::checked_cast<int32_t>(wsExpression.GetLength())) {
@@ -701,17 +701,27 @@ bool CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject,
resolveNodeRS->objects.insert(resolveNodeRS->objects.end(),
findObjects.begin(), findObjects.end());
}
- if (rndFind.m_dwFlag == XFA_RESOLVENODE_RSTYPE_Attribute) {
+ if (rndFind.m_dwFlag == XFA_ResolveNode_RSType_Attribute) {
resolveNodeRS->pScriptAttribute = rndFind.m_pScriptAttribute;
return 1;
}
}
if (dwStyles & (XFA_RESOLVENODE_CreateNode | XFA_RESOLVENODE_Bind |
XFA_RESOLVENODE_BindNew)) {
- m_ResolveProcessor->SetResultCreateNode(resolveNodeRS,
- rndFind.m_wsCondition);
+ CXFA_NodeHelper* helper = m_ResolveProcessor->GetNodeHelper();
+ if (helper->m_pCreateParent)
+ resolveNodeRS->objects.push_back(helper->m_pCreateParent);
+ else
+ helper->CreateNode_ForCondition(rndFind.m_wsCondition);
+
+ resolveNodeRS->dwFlags = helper->m_iCreateFlag;
+ if (resolveNodeRS->dwFlags == XFA_ResolveNode_RSType_CreateNodeOne) {
+ if (helper->m_iCurAllStart != -1)
+ resolveNodeRS->dwFlags = XFA_ResolveNode_RSType_CreateNodeMidAll;
+ }
+
if (!bNextCreate && (dwStyles & XFA_RESOLVENODE_CreateNode))
- resolveNodeRS->dwFlags = XFA_RESOLVENODE_RSTYPE_ExistNodes;
+ resolveNodeRS->dwFlags = XFA_ResolveNode_RSType_ExistNodes;
return !resolveNodeRS->objects.empty();
}
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index e7d44d179f..e565c42e46 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -5918,7 +5918,7 @@ bool CFXJSE_FormCalcContext::GetObjectForName(
pScriptContext->GetThisObject(),
WideString::FromUTF8(szAccessorName).AsStringView(), &resolveNodeRS,
dwFlags, nullptr);
- if (iRet && resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ if (iRet && resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) {
accessorValue->Assign(
pScriptContext->GetJSValueFromMap(resolveNodeRS.objects.front()));
return true;
@@ -5990,7 +5990,7 @@ void CFXJSE_FormCalcContext::ParseResolveResult(
CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ if (resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) {
*bAttribute = false;
CFXJSE_Engine* pScriptContext = pContext->GetDocument()->GetScriptContext();
for (CXFA_Object* pObject : resolveNodeRS.objects) {
diff --git a/fxjs/cfxjse_resolveprocessor.cpp b/fxjs/cfxjse_resolveprocessor.cpp
index eeeeefcf08..8e0c6fba1e 100644
--- a/fxjs/cfxjse_resolveprocessor.cpp
+++ b/fxjs/cfxjse_resolveprocessor.cpp
@@ -207,7 +207,7 @@ bool CFXJSE_ResolveProcessor::ResolveForAttributeRs(
rnd.m_pScriptAttribute = lpScriptAttribute;
rnd.m_Objects.push_back(curNode);
- rnd.m_dwFlag = XFA_RESOLVENODE_RSTYPE_Attribute;
+ rnd.m_dwFlag = XFA_ResolveNode_RSType_Attribute;
return true;
}
@@ -713,22 +713,6 @@ void CFXJSE_ResolveProcessor::SetStylesForChild(uint32_t dwParentStyles,
rnd.m_dwStyles = dwSubStyles;
}
-int32_t CFXJSE_ResolveProcessor::SetResultCreateNode(
- XFA_RESOLVENODE_RS* resolveNodeRS,
- WideString& wsLastCondition) {
- if (m_pNodeHelper->m_pCreateParent)
- resolveNodeRS->objects.push_back(m_pNodeHelper->m_pCreateParent);
- else
- m_pNodeHelper->CreateNode_ForCondition(wsLastCondition);
-
- resolveNodeRS->dwFlags = m_pNodeHelper->m_iCreateFlag;
- if (resolveNodeRS->dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) {
- if (m_pNodeHelper->m_iCurAllStart != -1)
- resolveNodeRS->dwFlags = XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll;
- }
- return pdfium::CollectionSize<int32_t>(resolveNodeRS->objects);
-}
-
void CFXJSE_ResolveProcessor::SetIndexDataBind(WideString& wsNextCondition,
int32_t& iIndex,
int32_t iCount) {
@@ -753,6 +737,6 @@ CFXJSE_ResolveNodeData::CFXJSE_ResolveNodeData(CFXJSE_Engine* pSC)
m_Objects(),
m_dwStyles(XFA_RESOLVENODE_Children),
m_pScriptAttribute(nullptr),
- m_dwFlag(XFA_RESOLVENODE_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 23ecd52d1a..71aba6efa8 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_RESOLVENODE_RSTYPE m_dwFlag;
+ XFA_ResolveNode_RSType m_dwFlag;
};
class CFXJSE_ResolveProcessor {
@@ -41,8 +41,6 @@ class CFXJSE_ResolveProcessor {
int32_t GetFilter(const WideStringView& wsExpression,
int32_t nStart,
CFXJSE_ResolveNodeData& rnd);
- int32_t SetResultCreateNode(XFA_RESOLVENODE_RS* resolveNodeRS,
- WideString& wsLastCondition);
void SetIndexDataBind(WideString& wsNextCondition,
int32_t& iIndex,
int32_t iCount);
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index 9f0a0de998..aaff83ecb1 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -416,7 +416,7 @@ void CJX_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) {
pArguments->GetReturnValue()->SetNull();
return;
}
- if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ if (resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) {
CXFA_Object* pObject = resolveNodeRS.objects.front();
pArguments->GetReturnValue()->Assign(
pScriptContext->GetJSValueFromMap(pObject));
@@ -475,7 +475,7 @@ void CJX_Node::ResolveNodeList(CFXJSE_Value* pValue,
pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(),
&resolveNodeRS, dwFlag, nullptr);
CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(GetDocument());
- if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ if (resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) {
for (CXFA_Object* pObject : resolveNodeRS.objects) {
if (pObject->IsNode())
pNodeList->Append(pObject->AsNode());
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index f7704509f6..f1ae2af3c0 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -506,7 +506,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
return nullptr;
}
- if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) {
+ if (resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) {
CXFA_Node* pNode = resolveNodeRS.objects.front()->AsNode();
if (pNode)
return static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
@@ -719,7 +719,7 @@ void CXFA_FFDocView::RunBindItems() {
pScriptContext->ResolveObjects(pWidgetNode, wsRef.AsStringView(), &rs,
dwStyle, nullptr);
pAcc->DeleteItem(-1, false, false);
- if (rs.dwFlags != XFA_RESOLVENODE_RSTYPE_Nodes || rs.objects.empty())
+ if (rs.dwFlags != XFA_ResolveNode_RSType_Nodes || rs.objects.empty())
continue;
WideString wsValueRef = bindItemsData.GetValueRef();
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp
index f11472a112..e3d6aa0bb5 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -18,7 +18,7 @@ CXFA_NodeHelper::CXFA_NodeHelper()
: m_eLastCreateType(XFA_Element::DataValue),
m_pCreateParent(nullptr),
m_iCreateCount(0),
- m_iCreateFlag(XFA_RESOLVENODE_RSTYPE_CreateNodeOne),
+ m_iCreateFlag(XFA_ResolveNode_RSType_CreateNodeOne),
m_iCurAllStart(-1),
m_pAllStartParent(nullptr) {}
@@ -281,7 +281,7 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(WideString& wsCondition) {
WideString wsIndex(L"0");
bool bAll = false;
if (iLen == 0) {
- m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne;
+ m_iCreateFlag = XFA_ResolveNode_RSType_CreateNodeOne;
return false;
}
if (wsCondition[0] != '[')
@@ -299,9 +299,9 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(WideString& wsCondition) {
}
if (bAll) {
wsIndex = L"1";
- m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeAll;
+ m_iCreateFlag = XFA_ResolveNode_RSType_CreateNodeAll;
} else {
- m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne;
+ m_iCreateFlag = XFA_ResolveNode_RSType_CreateNodeOne;
wsIndex = wsCondition.Mid(i, iLen - 1 - i);
}
int32_t iIndex = wsIndex.GetInteger();
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h
index e2f46f4508..394259e53d 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.h
+++ b/xfa/fxfa/parser/cxfa_nodehelper.h
@@ -64,7 +64,7 @@ class CXFA_NodeHelper {
XFA_Element m_eLastCreateType;
CXFA_Node* m_pCreateParent;
int32_t m_iCreateCount;
- XFA_RESOLVENODE_RSTYPE m_iCreateFlag;
+ XFA_ResolveNode_RSType m_iCreateFlag;
int32_t m_iCurAllStart;
CXFA_Node* m_pAllStartParent;
};
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 4f2b2fb41d..868361e336 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -469,13 +469,13 @@ CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
XFA_RESOLVENODE_RS rs;
pDocument->GetScriptContext()->ResolveObjects(
pDataScope, wsRef.AsStringView(), &rs, dFlags, pTemplateNode);
- if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeAll ||
- rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll ||
+ if (rs.dwFlags == XFA_ResolveNode_RSType_CreateNodeAll ||
+ rs.dwFlags == XFA_ResolveNode_RSType_CreateNodeMidAll ||
rs.objects.size() > 1) {
return pDocument->GetNotBindNode(rs.objects);
}
- if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) {
+ if (rs.dwFlags == XFA_ResolveNode_RSType_CreateNodeOne) {
CXFA_Object* pObject = !rs.objects.empty() ? rs.objects.front() : nullptr;
CXFA_Node* pNode = ToNode(pObject);
return (bForceBind || !pNode || !pNode->HasBindItem()) ? pNode : nullptr;
@@ -1169,7 +1169,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument,
pDataNode = ToNode(pObject);
if (pDataNode) {
CreateDataBinding(pFormNode, pDataNode,
- rs.dwFlags == XFA_RESOLVENODE_RSTYPE_ExistNodes);
+ rs.dwFlags == XFA_ResolveNode_RSType_ExistNodes);
} else {
FormValueNode_MatchNoneCreateChild(pFormNode);
}
diff --git a/xfa/fxfa/parser/xfa_resolvenode_rs.h b/xfa/fxfa/parser/xfa_resolvenode_rs.h
index 2eaab5dff4..86960abecc 100644
--- a/xfa/fxfa/parser/xfa_resolvenode_rs.h
+++ b/xfa/fxfa/parser/xfa_resolvenode_rs.h
@@ -27,13 +27,13 @@
#define XFA_RESOLVENODE_Bind 0x0800
#define XFA_RESOLVENODE_BindNew 0x1000
-enum XFA_RESOLVENODE_RSTYPE {
- XFA_RESOLVENODE_RSTYPE_Nodes,
- XFA_RESOLVENODE_RSTYPE_Attribute,
- XFA_RESOLVENODE_RSTYPE_CreateNodeOne,
- XFA_RESOLVENODE_RSTYPE_CreateNodeAll,
- XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll,
- XFA_RESOLVENODE_RSTYPE_ExistNodes,
+enum XFA_ResolveNode_RSType {
+ XFA_ResolveNode_RSType_Nodes,
+ XFA_ResolveNode_RSType_Attribute,
+ XFA_ResolveNode_RSType_CreateNodeOne,
+ XFA_ResolveNode_RSType_CreateNodeAll,
+ XFA_ResolveNode_RSType_CreateNodeMidAll,
+ XFA_ResolveNode_RSType_ExistNodes,
};
struct XFA_RESOLVENODE_RS {
@@ -41,12 +41,12 @@ struct XFA_RESOLVENODE_RS {
~XFA_RESOLVENODE_RS();
std::vector<CXFA_Object*> objects; // Not owned.
- XFA_RESOLVENODE_RSTYPE dwFlags;
+ XFA_ResolveNode_RSType dwFlags;
const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute;
};
inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS()
- : dwFlags(XFA_RESOLVENODE_RSTYPE_Nodes), pScriptAttribute(nullptr) {}
+ : dwFlags(XFA_ResolveNode_RSType_Nodes), pScriptAttribute(nullptr) {}
inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() {}