summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_attachnodelist.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp13
-rw-r--r--xfa/fxfa/parser/cxfa_dataimporter.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp18
-rw-r--r--xfa/fxfa/parser/cxfa_event.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_fill.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp72
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp103
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp208
-rw-r--r--xfa/fxfa/parser/cxfa_node.h7
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_nodelocale.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h6
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_value.cpp16
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp135
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp42
18 files changed, 284 insertions, 372 deletions
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index f9bd26bf82..f1fbfa784b 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -22,7 +22,7 @@ size_t CXFA_AttachNodeList::GetLength() {
}
bool CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
- CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParent = pNode->GetParent();
if (pParent)
pParent->RemoveChild(pNode, true);
@@ -30,7 +30,7 @@ bool CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
}
bool CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
- CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParent = pNewNode->GetParent();
if (pParent)
pParent->RemoveChild(pNewNode, true);
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index fdd09c80a8..23fc17883a 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -50,8 +50,8 @@ bool CXFA_DataExporter::Export(
case XFA_PacketType::Xdp: {
pStream->WriteString(
L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">");
- for (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pChild = pNode->GetFirstChild(); pChild;
+ pChild = pChild->GetNextSibling()) {
Export(pStream, pChild, dwFlag, pChecksum);
}
pStream->WriteString(L"</xdp:xdp\n>");
@@ -63,7 +63,7 @@ bool CXFA_DataExporter::Export(
if (!pElement || pElement->GetType() != FX_XMLNODE_Element)
return false;
- CXFA_Node* pDataNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pDataNode = pNode->GetFirstChild();
ASSERT(pDataNode);
XFA_DataExporter_DealWithDataGroupNode(pDataNode);
pXMLDoc->SaveXMLNode(pStream, pElement);
@@ -87,11 +87,10 @@ bool CXFA_DataExporter::Export(
return true;
}
- CXFA_Node* pDataNode = pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pDataNode = pNode->GetParent();
CXFA_Node* pExportNode = pNode;
- for (CXFA_Node* pChildNode = pDataNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pChildNode;
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pChildNode = pDataNode->GetFirstChild(); pChildNode;
+ pChildNode = pChildNode->GetNextSibling()) {
if (pChildNode != pNode) {
pExportNode = pDataNode;
break;
diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp
index 2967c30304..9171b00750 100644
--- a/xfa/fxfa/parser/cxfa_dataimporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp
@@ -49,8 +49,7 @@ bool CXFA_DataImporter::ImportData(
pDataModel->RemoveChild(pDataNode, true);
if (pImportDataRoot->GetElementType() == XFA_Element::DataModel) {
- while (CXFA_Node* pChildNode =
- pImportDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) {
+ while (CXFA_Node* pChildNode = pImportDataRoot->GetFirstChild()) {
pImportDataRoot->RemoveChild(pChildNode, true);
pDataModel->InsertChild(pChildNode, nullptr);
}
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index b7c9be517f..0675e35358 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -36,10 +36,8 @@ void MergeNodeRecurse(CXFA_Document* pDocument,
CXFA_Node* pDestNodeParent,
CXFA_Node* pProtoNode) {
CXFA_Node* pExistingNode = nullptr;
- for (CXFA_Node* pFormChild =
- pDestNodeParent->GetNodeItem(XFA_NODEITEM_FirstChild);
- pFormChild;
- pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pFormChild = pDestNodeParent->GetFirstChild(); pFormChild;
+ pFormChild = pFormChild->GetNextSibling()) {
if (pFormChild->GetElementType() == pProtoNode->GetElementType() &&
pFormChild->GetNameHash() == pProtoNode->GetNameHash() &&
pFormChild->IsUnusedNode()) {
@@ -51,10 +49,8 @@ void MergeNodeRecurse(CXFA_Document* pDocument,
if (pExistingNode) {
pExistingNode->SetTemplateNode(pProtoNode);
- for (CXFA_Node* pTemplateChild =
- pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pProtoNode->GetFirstChild();
+ pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
MergeNodeRecurse(pDocument, pExistingNode, pTemplateChild);
}
return;
@@ -75,10 +71,8 @@ void MergeNode(CXFA_Document* pDocument,
}
}
pDestNode->SetTemplateNode(pProtoNode);
- for (CXFA_Node* pTemplateChild =
- pProtoNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild;
- pTemplateChild = pTemplateChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pProtoNode->GetFirstChild(); pTemplateChild;
+ pTemplateChild = pTemplateChild->GetNextSibling()) {
MergeNodeRecurse(pDocument, pDestNode, pTemplateChild);
}
{
diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp
index 2675761bc6..9eef655d31 100644
--- a/xfa/fxfa/parser/cxfa_event.cpp
+++ b/xfa/fxfa/parser/cxfa_event.cpp
@@ -54,13 +54,13 @@ XFA_AttributeEnum CXFA_Event::GetActivity() {
}
XFA_Element CXFA_Event::GetEventType() const {
- CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pChild = GetFirstChild();
while (pChild) {
XFA_Element eType = pChild->GetElementType();
if (eType != XFA_Element::Extras)
return eType;
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChild = pChild->GetNextSibling();
}
return XFA_Element::Unknown;
}
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
index c55dd7e0e1..e6b289817e 100644
--- a/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -85,13 +85,13 @@ FX_ARGB CXFA_Fill::GetColor(bool bText) {
}
XFA_Element CXFA_Fill::GetFillType() const {
- CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pChild = GetFirstChild();
while (pChild) {
XFA_Element eType = pChild->GetElementType();
if (eType != XFA_Element::Color && eType != XFA_Element::Extras)
return eType;
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChild = pChild->GetNextSibling();
}
return XFA_Element::Solid;
}
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 398a5e8f7c..0b8daa8970 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -509,7 +509,7 @@ XFA_AttributeEnum GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) {
if (layoutMode)
return *layoutMode;
- CXFA_Node* pParentNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = pFormNode->GetParent();
if (pParentNode && pParentNode->GetElementType() == XFA_Element::Form) {
*bRootForceTb = true;
return XFA_AttributeEnum::Tb;
@@ -572,7 +572,7 @@ bool FindBreakNode(CXFA_Node* pContainerNode,
bool bBreakBefore) {
bool bFindRs = false;
for (CXFA_Node* pBreakNode = pContainerNode; pBreakNode;
- pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ pBreakNode = pBreakNode->GetNextSibling()) {
XFA_Attribute eAttributeType = XFA_Attribute::Before;
if (!bBreakBefore)
eAttributeType = XFA_Attribute::After;
@@ -633,8 +633,7 @@ void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
pCurLayoutItem = pNextLayoutItem;
}
}
- pGenerateNode->GetNodeItem(XFA_NODEITEM_Parent)
- ->RemoveChild(pGenerateNode, true);
+ pGenerateNode->GetParent()->RemoveChild(pGenerateNode, true);
}
uint8_t HAlignEnumToInt(XFA_AttributeEnum eHAlign) {
@@ -686,10 +685,9 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem(
*uCurHAlignState = uHAlign;
bool bIsOwnSplit =
pProcessor->m_pFormNode->GetIntact() == XFA_AttributeEnum::None;
- bool bUseRealHeight =
- bTakeSpace && bContainerHeightAutoSize && bIsOwnSplit &&
- pProcessor->m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)->GetIntact() ==
- XFA_AttributeEnum::None;
+ bool bUseRealHeight = bTakeSpace && bContainerHeightAutoSize && bIsOwnSplit &&
+ pProcessor->m_pFormNode->GetParent()->GetIntact() ==
+ XFA_AttributeEnum::None;
bool bIsTransHeight = bTakeSpace;
if (bIsTransHeight && !bIsOwnSplit) {
bool bRootForceTb = false;
@@ -1386,7 +1384,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
switch (nCurStage) {
case XFA_ItemLayoutProcessorStages::BreakBefore:
case XFA_ItemLayoutProcessorStages::BreakAfter: {
- pChildContainer = pCurActionNode->GetNodeItem(XFA_NODEITEM_Parent);
+ pChildContainer = pCurActionNode->GetParent();
break;
}
case XFA_ItemLayoutProcessorStages::Keep:
@@ -1400,8 +1398,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
switch (nCurStage) {
case XFA_ItemLayoutProcessorStages::Keep: {
- CXFA_Node* pBreakAfterNode =
- pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pBreakAfterNode = pChildContainer->GetFirstChild();
if (!m_bKeepBreakFinish &&
FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false)) {
return;
@@ -1411,12 +1408,10 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
case XFA_ItemLayoutProcessorStages::None: {
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
case XFA_ItemLayoutProcessorStages::BookendLeader:
- for (CXFA_Node* pBookendNode =
- pCurActionNode == XFA_LAYOUT_INVALIDNODE
- ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild)
- : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pBookendNode; pBookendNode = pBookendNode->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
+ ? pEntireContainer->GetFirstChild()
+ : pCurActionNode->GetNextSibling();
+ pBookendNode; pBookendNode = pBookendNode->GetNextSibling()) {
switch (pBookendNode->GetElementType()) {
case XFA_Element::Bookend:
case XFA_Element::Break:
@@ -1432,8 +1427,7 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
case XFA_ItemLayoutProcessorStages::BreakBefore:
if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) {
- CXFA_Node* pBreakBeforeNode =
- pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ CXFA_Node* pBreakBeforeNode = pCurActionNode->GetNextSibling();
if (!m_bKeepBreakFinish &&
FindBreakNode(pBreakBeforeNode, pCurActionNode, &nCurStage,
true)) {
@@ -1456,16 +1450,14 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
case XFA_ItemLayoutProcessorStages::BreakAfter: {
if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) {
- CXFA_Node* pBreakAfterNode =
- pChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pBreakAfterNode = pChildContainer->GetFirstChild();
if (!m_bKeepBreakFinish &&
FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage,
false)) {
return;
}
} else {
- CXFA_Node* pBreakAfterNode =
- pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ CXFA_Node* pBreakAfterNode = pCurActionNode->GetNextSibling();
if (FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage,
false)) {
return;
@@ -1499,9 +1491,8 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
return;
}
if (!m_bKeepBreakFinish && !bLastKeep &&
- FindBreakNode(
- pNextChildContainer->GetNodeItem(XFA_NODEITEM_FirstChild),
- pCurActionNode, &nCurStage, true)) {
+ FindBreakNode(pNextChildContainer->GetFirstChild(), pCurActionNode,
+ &nCurStage, true)) {
return;
}
pCurActionNode = pNextChildContainer;
@@ -1515,12 +1506,10 @@ void CXFA_ItemLayoutProcessor::GotoNextContainerNode(
NoMoreChildContainer : {
pCurActionNode = XFA_LAYOUT_INVALIDNODE;
case XFA_ItemLayoutProcessorStages::BookendTrailer:
- for (CXFA_Node* pBookendNode =
- pCurActionNode == XFA_LAYOUT_INVALIDNODE
- ? pEntireContainer->GetNodeItem(XFA_NODEITEM_FirstChild)
- : pCurActionNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pBookendNode; pBookendNode = pBookendNode->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
+ ? pEntireContainer->GetFirstChild()
+ : pCurActionNode->GetNextSibling();
+ pBookendNode; pBookendNode = pBookendNode->GetNextSibling()) {
switch (pBookendNode->GetElementType()) {
case XFA_Element::Bookend:
case XFA_Element::Break:
@@ -1559,8 +1548,8 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext(
if (m_bIsProcessKeep && m_pKeepHeadNode) {
m_pKeepTailNode = pNextContainer;
if (!m_bKeepBreakFinish &&
- FindBreakNode(pNextContainer->GetNodeItem(XFA_NODEITEM_FirstChild),
- pCurActionNode, &nCurStage, true)) {
+ FindBreakNode(pNextContainer->GetFirstChild(), pCurActionNode,
+ &nCurStage, true)) {
return true;
}
@@ -1592,8 +1581,7 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore(
return true;
}
- CXFA_Node* pBreakAfterNode =
- pContainerNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pBreakAfterNode = pContainerNode->GetFirstChild();
return FindBreakNode(pBreakAfterNode, pCurActionNode, &nCurStage, false);
}
@@ -2141,7 +2129,7 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow(
if (pFormNode->GetElementType() == XFA_Element::Overflow ||
pFormNode->GetElementType() == XFA_Element::Break) {
- pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
+ pFormNode = pFormNode->GetParent();
}
if (pLeaderNode && pFormNode)
pFormNode->RemoveChild(pLeaderNode, true);
@@ -2179,7 +2167,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
containerSize.height -= m_fUsedSize;
if (!bContainerHeightAutoSize) {
- CXFA_Node* pParentNode = m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = m_pFormNode->GetParent();
bool bFocrTb = false;
if (pParentNode &&
GetLayout(pParentNode, &bFocrTb) == XFA_AttributeEnum::Row) {
@@ -2367,8 +2355,8 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
AddPendingNode(this, pLeaderNode, true);
if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
- if (m_pFormNode->GetNodeItem(XFA_NODEITEM_Parent)
- ->GetElementType() == XFA_Element::Form &&
+ if (m_pFormNode->GetParent()->GetElementType() ==
+ XFA_Element::Form &&
!m_pLayoutItem) {
AddPendingNode(this, pTrailerNode, true);
} else {
@@ -2752,11 +2740,11 @@ bool CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
CXFA_Node* CXFA_ItemLayoutProcessor::GetSubformSetParent(
CXFA_Node* pSubformSet) {
if (pSubformSet && pSubformSet->GetElementType() == XFA_Element::SubformSet) {
- CXFA_Node* pParent = pSubformSet->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParent = pSubformSet->GetParent();
while (pParent) {
if (pParent->GetElementType() != XFA_Element::SubformSet)
return pParent;
- pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
+ pParent = pParent->GetParent();
}
}
return pSubformSet;
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index 93822521ef..c1947cf9cc 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -311,9 +311,8 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
InitPageSetMap();
CXFA_Node* pPageArea = nullptr;
int32_t iCount = 0;
- for (pPageArea = m_pTemplatePageSetRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
- pPageArea;
- pPageArea = pPageArea->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (pPageArea = m_pTemplatePageSetRoot->GetFirstChild(); pPageArea;
+ pPageArea = pPageArea->GetNextSibling()) {
if (pPageArea->GetElementType() == XFA_Element::PageArea) {
iCount++;
if (pPageArea->GetFirstChildByClass<CXFA_ContentArea>(
@@ -377,10 +376,8 @@ bool CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) {
bool bProBreakBefore = false;
CXFA_Node* pBreakBeforeNode = nullptr;
while (pRootSubform) {
- for (CXFA_Node* pBreakNode =
- pRootSubform->GetNodeItem(XFA_NODEITEM_FirstChild);
- pBreakNode;
- pBreakNode = pBreakNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pBreakNode = pRootSubform->GetFirstChild(); pBreakNode;
+ pBreakNode = pBreakNode->GetNextSibling()) {
XFA_Element eType = pBreakNode->GetElementType();
if (eType == XFA_Element::BreakBefore ||
(eType == XFA_Element::Break &&
@@ -510,7 +507,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord(
m_ProposedContainerRecords.push_back(pNewRecord);
return pNewRecord;
}
- CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pPageSet = pPageNode->GetParent();
if (!bCreateNew) {
if (pPageSet == m_pTemplatePageSetRoot) {
pNewRecord->pCurPageSet = m_pPageSetCurRoot;
@@ -530,9 +527,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord(
GetCurrentContainerRecord()->pCurPageSet->m_pParent);
} else {
pParentPageSetLayout = static_cast<CXFA_ContainerLayoutItem*>(
- pPageSet->GetNodeItem(XFA_NODEITEM_Parent)
- ->JSObject()
- ->GetLayoutItem());
+ pPageSet->GetParent()->JSObject()->GetLayoutItem());
}
CXFA_ContainerLayoutItem* pPageSetLayoutItem =
new CXFA_ContainerLayoutItem(pPageSet);
@@ -553,7 +548,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord(
}
} else {
if (pPageNode) {
- CXFA_Node* pPageSet = pPageNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pPageSet = pPageNode->GetParent();
if (pPageSet == m_pTemplatePageSetRoot) {
pNewRecord->pCurPageSet = m_pPageSetLayoutItemRoot;
} else {
@@ -692,11 +687,9 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
rgUsedHeights.push_back(fUsedHeight);
}
int32_t iCurContentAreaIndex = -1;
- for (CXFA_Node* pContentAreaNode =
- pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ for (CXFA_Node* pContentAreaNode = pNode->GetFirstChild();
pContentAreaNode;
- pContentAreaNode =
- pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ pContentAreaNode = pContentAreaNode->GetNextSibling()) {
if (pContentAreaNode->GetElementType() !=
XFA_Element::ContentArea) {
continue;
@@ -714,8 +707,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
if (bUsable) {
CXFA_LayoutItem* pChildLayoutItem =
pLastPageAreaLayoutItem->m_pFirstChild;
- CXFA_Node* pContentAreaNode =
- pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pContentAreaNode = pNode->GetFirstChild();
pLastPageAreaLayoutItem->m_pFormNode = pNode;
while (pChildLayoutItem && pContentAreaNode) {
if (pChildLayoutItem->m_pFormNode->GetElementType() !=
@@ -725,14 +717,12 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() {
}
if (pContentAreaNode->GetElementType() !=
XFA_Element::ContentArea) {
- pContentAreaNode =
- pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pContentAreaNode = pContentAreaNode->GetNextSibling();
continue;
}
pChildLayoutItem->m_pFormNode = pContentAreaNode;
pChildLayoutItem = pChildLayoutItem->m_pNextSibling;
- pContentAreaNode =
- pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pContentAreaNode = pContentAreaNode->GetNextSibling();
}
} else if (pNode->JSObject()->GetEnum(XFA_Attribute::PagePosition) ==
XFA_AttributeEnum::Last) {
@@ -777,7 +767,7 @@ bool CXFA_LayoutPageMgr::RunBreak(XFA_Element eBreakType,
bStartNew) {
CXFA_Node* pPageArea = nullptr;
if (pTarget)
- pPageArea = pTarget->GetNodeItem(XFA_NODEITEM_Parent);
+ pPageArea = pTarget->GetParent();
pPageArea = GetNextAvailPageArea(pPageArea, pTarget);
bRet = !!pPageArea;
@@ -856,7 +846,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
XFA_ObjectType::ContainerNode)) {
break;
}
- pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
+ pParentNode = pParentNode->GetParent();
if (!pParentNode ||
pParentNode->GetElementType() != XFA_Element::Form) {
break;
@@ -1047,14 +1037,13 @@ bool CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode,
pFormNode->GetElementType() == XFA_Element::Break) {
bIsOverflowNode = true;
}
- for (CXFA_Node* pCurNode =
- bIsOverflowNode ? pFormNode
- : pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) {
+ for (CXFA_Node* pCurNode = bIsOverflowNode ? pFormNode
+ : pFormNode->GetFirstChild();
+ pCurNode; pCurNode = pCurNode->GetNextSibling()) {
if (BreakOverflow(pCurNode, pLeaderTemplate, pTrailerTemplate,
bCreatePage)) {
if (bIsOverflowNode)
- pFormNode = pCurNode->GetNodeItem(XFA_NODEITEM_Parent);
+ pFormNode = pCurNode->GetParent();
CXFA_Document* pDocument = pCurNode->GetDocument();
CXFA_Node* pDataScope = nullptr;
@@ -1162,10 +1151,8 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered(
bool bRes = false;
CXFA_Node* pCurrentNode =
- pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling)
- : pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pCurrentNode;
- pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ pStartChild ? pStartChild->GetNextSibling() : pPageSet->GetFirstChild();
+ for (; pCurrentNode; pCurrentNode = pCurrentNode->GetNextSibling()) {
if (pCurrentNode->GetElementType() == XFA_Element::PageArea) {
if ((pTargetPageArea == pCurrentNode || !pTargetPageArea)) {
if (!pCurrentNode->GetFirstChildByClass<CXFA_ContentArea>(
@@ -1223,12 +1210,11 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex(
CXFA_Node* pFallbackPageArea = nullptr;
CXFA_Node* pCurrentNode = nullptr;
if (!pStartChild || pStartChild->GetElementType() == XFA_Element::PageArea)
- pCurrentNode = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild);
+ pCurrentNode = pPageSet->GetFirstChild();
else
- pCurrentNode = pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pCurrentNode = pStartChild->GetNextSibling();
- for (; pCurrentNode;
- pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (; pCurrentNode; pCurrentNode = pCurrentNode->GetNextSibling()) {
if (pCurrentNode->GetElementType() == XFA_Element::PageArea) {
if (!MatchPageAreaOddOrEven(pCurrentNode))
continue;
@@ -1379,13 +1365,13 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea(
if (!bQuery && IsPageSetRootOrderedOccurrence())
CreateMinPageRecord(m_pCurPageArea, false, true);
- if (FindPageAreaFromPageSet(m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent),
- m_pCurPageArea, pTargetPageArea,
- pTargetContentArea, bNewPage, bQuery)) {
+ if (FindPageAreaFromPageSet(m_pCurPageArea->GetParent(), m_pCurPageArea,
+ pTargetPageArea, pTargetContentArea, bNewPage,
+ bQuery)) {
return m_pCurPageArea;
}
- CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pPageSet = m_pCurPageArea->GetParent();
while (true) {
if (FindPageAreaFromPageSet(pPageSet, nullptr, pTargetPageArea,
pTargetContentArea, bNewPage, bQuery)) {
@@ -1400,7 +1386,7 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea(
if (pPageSet == m_pTemplatePageSetRoot)
break;
- pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent);
+ pPageSet = pPageSet->GetParent();
}
return nullptr;
}
@@ -1414,7 +1400,7 @@ bool CXFA_LayoutPageMgr::GetNextContentArea(CXFA_Node* pContentArea) {
if (!pContentArea)
return false;
} else {
- if (pContentArea->GetNodeItem(XFA_NODEITEM_Parent) != m_pCurPageArea)
+ if (pContentArea->GetParent() != m_pCurPageArea)
return false;
CXFA_ContainerLayoutItem* pContentAreaLayout = nullptr;
@@ -1513,8 +1499,8 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet,
return;
for (int32_t i = 0; i < *iMin - iCurSetCount; i++) {
- for (CXFA_Node* node = pPageSet->GetNodeItem(XFA_NODEITEM_FirstChild); node;
- node = node->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* node = pPageSet->GetFirstChild(); node;
+ node = node->GetNextSibling()) {
if (node->GetElementType() == XFA_Element::PageArea)
CreateMinPageRecord(node, false);
else if (node->GetElementType() == XFA_Element::PageSet)
@@ -1528,10 +1514,8 @@ void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) {
if (!pRecordNode)
return;
- for (CXFA_Node* pCurrentNode =
- pRecordNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pCurrentNode;
- pCurrentNode = pCurrentNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pCurrentNode = pRecordNode->GetNextSibling(); pCurrentNode;
+ pCurrentNode = pCurrentNode->GetNextSibling()) {
if (pCurrentNode->GetElementType() == XFA_Element::PageArea)
CreateMinPageRecord(pCurrentNode, false);
else if (pCurrentNode->GetElementType() == XFA_Element::PageSet)
@@ -1542,14 +1526,14 @@ void CXFA_LayoutPageMgr::CreateNextMinRecord(CXFA_Node* pRecordNode) {
void CXFA_LayoutPageMgr::ProcessLastPageSet() {
CreateMinPageRecord(m_pCurPageArea, false, true);
CreateNextMinRecord(m_pCurPageArea);
- CXFA_Node* pPageSet = m_pCurPageArea->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pPageSet = m_pCurPageArea->GetParent();
while (true) {
CreateMinPageSetRecord(pPageSet);
if (pPageSet == m_pTemplatePageSetRoot)
break;
CreateNextMinRecord(pPageSet);
- pPageSet = pPageSet->GetNodeItem(XFA_NODEITEM_Parent);
+ pPageSet = pPageSet->GetParent();
}
}
@@ -1686,8 +1670,8 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
}
CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) {
- for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) {
+ for (CXFA_Node* pCurNode = pFormNode->GetFirstChild(); pCurNode;
+ pCurNode = pCurNode->GetNextSibling()) {
if (pCurNode->GetElementType() == XFA_Element::Break) {
WideString wsOverflowLeader =
pCurNode->JSObject()->GetCData(XFA_Attribute::OverflowLeader);
@@ -1826,10 +1810,8 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
}
case XFA_Element::ContentArea: {
CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode;
- for (CXFA_Node* pChildNode =
- pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pChildNode;
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pChildNode = pParentNode->GetFirstChild(); pChildNode;
+ pChildNode = pChildNode->GetNextSibling()) {
if (pChildNode->GetTemplateNode() != pContainerItem->m_pFormNode) {
continue;
}
@@ -1842,7 +1824,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
break;
}
}
- if (!pPendingPageSet->GetNodeItem(XFA_NODEITEM_Parent)) {
+ if (!pPendingPageSet->GetParent()) {
CXFA_Node* pFormToplevelSubform =
pDocument->GetXFAObject(XFA_HASHCODE_Form)
->AsNode()
@@ -1883,7 +1865,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
}
}
CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext();
- pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode, true);
+ pNode->GetParent()->RemoveChild(pNode, true);
pNode = pNext;
} else {
pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
@@ -2020,8 +2002,7 @@ void CXFA_LayoutPageMgr::PrepareLayout() {
CXFA_Node* pNextPageSet =
pPageSetFormNode->GetNextSameClassSibling<CXFA_PageSet>(
XFA_Element::PageSet);
- pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent)
- ->RemoveChild(pPageSetFormNode, false);
+ pPageSetFormNode->GetParent()->RemoveChild(pPageSetFormNode, false);
pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.push_back(
pPageSetFormNode);
pPageSetFormNode = pNextPageSet;
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 323a63dd72..cbe709fb20 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -1130,10 +1130,10 @@ CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, WideString wsDeflcid)
: m_dwLocaleFlags(0x00) {
m_dwDeflcid = XFA_GetLanguage(wsDeflcid);
if (pLocaleSet) {
- CXFA_Node* pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pNodeLocale = pLocaleSet->GetFirstChild();
while (pNodeLocale) {
m_LocaleArray.push_back(pdfium::MakeUnique<CXFA_NodeLocale>(pNodeLocale));
- pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pNodeLocale = pNodeLocale->GetNextSibling();
}
}
m_pDefLocale = GetLocaleByName(wsDeflcid);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index e3ece5d57a..ad70e94256 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -65,10 +65,9 @@ std::vector<CXFA_Node*> NodesSortedByDocumentIdx(
return std::vector<CXFA_Node*>();
std::vector<CXFA_Node*> rgNodeArray;
- CXFA_Node* pCommonParent =
- (*rgNodeSet.begin())->GetNodeItem(XFA_NODEITEM_Parent);
- for (CXFA_Node* pNode = pCommonParent->GetNodeItem(XFA_NODEITEM_FirstChild);
- pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ CXFA_Node* pCommonParent = (*rgNodeSet.begin())->GetParent();
+ for (CXFA_Node* pNode = pCommonParent->GetFirstChild(); pNode;
+ pNode = pNode->GetNextSibling()) {
if (pdfium::ContainsValue(rgNodeSet, pNode))
rgNodeArray.push_back(pNode);
}
@@ -83,7 +82,7 @@ using CXFA_NodeSetPairMapMap =
CXFA_NodeSetPair* NodeSetPairForNode(CXFA_Node* pNode,
CXFA_NodeSetPairMapMap* pMap) {
- CXFA_Node* pParentNode = pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = pNode->GetParent();
uint32_t dwNameHash = pNode->GetNameHash();
if (!pParentNode || !dwNameHash)
return nullptr;
@@ -134,11 +133,11 @@ void ReorderDataNodes(const std::set<CXFA_Node*>& sSet1,
CXFA_Node* pBeforeNode = nullptr;
if (bInsertBefore) {
pBeforeNode = rgNodeArray2.front();
- pParentNode = pBeforeNode->GetNodeItem(XFA_NODEITEM_Parent);
+ pParentNode = pBeforeNode->GetParent();
} else {
CXFA_Node* pLastNode = rgNodeArray2.back();
- pParentNode = pLastNode->GetNodeItem(XFA_NODEITEM_Parent);
- pBeforeNode = pLastNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pParentNode = pLastNode->GetParent();
+ pBeforeNode = pLastNode->GetNextSibling();
}
for (auto* pCurNode : rgNodeArray1) {
pParentNode->RemoveChild(pCurNode, true);
@@ -257,8 +256,8 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
pClone->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
}
if (bRecursive) {
- for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild;
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pChild = GetFirstChild(); pChild;
+ pChild = pChild->GetNextSibling()) {
pClone->InsertChild(pChild->Clone(bRecursive), nullptr);
}
}
@@ -267,29 +266,51 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
return pClone;
}
-CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem) const {
+CXFA_Node* CXFA_Node::GetPrevSibling() const {
+ if (!m_pParent || m_pParent->m_pChild == this)
+ return nullptr;
+
+ for (CXFA_Node* pNode = m_pParent->m_pChild; pNode; pNode = pNode->m_pNext) {
+ if (pNode->m_pNext == this)
+ return pNode;
+ }
+ return nullptr;
+}
+
+CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem,
+ XFA_ObjectType eType) const {
+ CXFA_Node* pNode = nullptr;
switch (eItem) {
case XFA_NODEITEM_NextSibling:
- return m_pNext;
+ pNode = m_pNext;
+ while (pNode && pNode->GetObjectType() != eType)
+ pNode = pNode->m_pNext;
+ break;
case XFA_NODEITEM_FirstChild:
- return m_pChild;
+ pNode = m_pChild;
+ while (pNode && pNode->GetObjectType() != eType)
+ pNode = pNode->m_pNext;
+ break;
case XFA_NODEITEM_Parent:
- return m_pParent;
+ pNode = m_pParent;
+ while (pNode && pNode->GetObjectType() != eType)
+ pNode = pNode->m_pParent;
+ break;
case XFA_NODEITEM_PrevSibling:
if (m_pParent) {
CXFA_Node* pSibling = m_pParent->m_pChild;
- CXFA_Node* pPrev = nullptr;
while (pSibling && pSibling != this) {
- pPrev = pSibling;
+ if (eType == pSibling->GetObjectType())
+ pNode = pSibling;
+
pSibling = pSibling->m_pNext;
}
- return pPrev;
}
- return nullptr;
+ break;
default:
break;
}
- return nullptr;
+ return pNode;
}
bool CXFA_Node::IsValidInPacket(XFA_PacketType packet) const {
@@ -370,42 +391,6 @@ XFA_AttributeType CXFA_Node::GetAttributeType(XFA_Attribute type) const {
return data ? data->type : XFA_AttributeType::CData;
}
-CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem,
- XFA_ObjectType eType) const {
- CXFA_Node* pNode = nullptr;
- switch (eItem) {
- case XFA_NODEITEM_NextSibling:
- pNode = m_pNext;
- while (pNode && pNode->GetObjectType() != eType)
- pNode = pNode->m_pNext;
- break;
- case XFA_NODEITEM_FirstChild:
- pNode = m_pChild;
- while (pNode && pNode->GetObjectType() != eType)
- pNode = pNode->m_pNext;
- break;
- case XFA_NODEITEM_Parent:
- pNode = m_pParent;
- while (pNode && pNode->GetObjectType() != eType)
- pNode = pNode->m_pParent;
- break;
- case XFA_NODEITEM_PrevSibling:
- if (m_pParent) {
- CXFA_Node* pSibling = m_pParent->m_pChild;
- while (pSibling && pSibling != this) {
- if (eType == pSibling->GetObjectType())
- pNode = pSibling;
-
- pSibling = pSibling->m_pNext;
- }
- }
- break;
- default:
- break;
- }
- return pNode;
-}
-
std::vector<CXFA_Node*> CXFA_Node::GetNodeList(uint32_t dwTypeFilter,
XFA_Element eTypeFilter) {
if (eTypeFilter != XFA_Element::Unknown) {
@@ -485,8 +470,8 @@ CXFA_Node* CXFA_Node::CloneTemplateToForm(bool bRecursive) {
pClone->UpdateNameHash();
pClone->SetXMLMappingNode(GetXMLMappingNode());
if (bRecursive) {
- for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild;
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pChild = GetFirstChild(); pChild;
+ pChild = pChild->GetNextSibling()) {
pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive), nullptr);
}
}
@@ -578,7 +563,7 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
XFA_Element eType = GetElementType();
if (eType == XFA_Element::ExclGroup)
return nullptr;
- CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = GetParent();
if (pParentNode && pParentNode->GetElementType() == XFA_Element::ExclGroup)
return nullptr;
@@ -613,8 +598,7 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
return pFieldWidgetAcc;
}
- CXFA_Node* pGrandNode =
- pParentNode ? pParentNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr;
+ CXFA_Node* pGrandNode = pParentNode ? pParentNode->GetParent() : nullptr;
CXFA_Node* pValueNode =
(pParentNode && pParentNode->GetElementType() == XFA_Element::Value)
? pParentNode
@@ -626,7 +610,7 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
: nullptr;
}
CXFA_Node* pParentOfValueNode =
- pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr;
+ pValueNode ? pValueNode->GetParent() : nullptr;
return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetAcc()
: nullptr;
}
@@ -653,7 +637,7 @@ Optional<WideString> CXFA_Node::GetLocaleName() {
if (localeName)
return localeName;
- pLocaleNode = pLocaleNode->GetNodeItem(XFA_NODEITEM_Parent);
+ pLocaleNode = pLocaleNode->GetParent();
} while (pLocaleNode && pLocaleNode != pTopSubform);
CXFA_Node* pConfig = ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
@@ -725,7 +709,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
return XFA_AttributeEnum::None;
}
case XFA_Element::Field: {
- CXFA_Node* parent = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* parent = GetParent();
if (!parent || parent->GetElementType() == XFA_Element::PageArea)
return XFA_AttributeEnum::ContentArea;
if (parent->GetIntact() != XFA_AttributeEnum::None)
@@ -794,8 +778,7 @@ CXFA_Node* CXFA_Node::GetModelNode() {
size_t CXFA_Node::CountChildren(XFA_Element eType, bool bOnlyChild) {
size_t count = 0;
- for (CXFA_Node* pNode = m_pChild; pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = m_pChild; pNode; pNode = pNode->GetNextSibling()) {
if (pNode->GetElementType() != eType && eType != XFA_Element::Unknown)
continue;
if (bOnlyChild && HasProperty(pNode->GetElementType()))
@@ -809,8 +792,7 @@ CXFA_Node* CXFA_Node::GetChildInternal(size_t index,
XFA_Element eType,
bool bOnlyChild) {
size_t count = 0;
- for (CXFA_Node* pNode = m_pChild; pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = m_pChild; pNode; pNode = pNode->GetNextSibling()) {
if (pNode->GetElementType() != eType && eType != XFA_Element::Unknown)
continue;
if (bOnlyChild && HasProperty(pNode->GetElementType()))
@@ -991,8 +973,8 @@ CXFA_Node* CXFA_Node::GetFirstChildByName(const WideStringView& wsName) const {
}
CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const {
- for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = GetFirstChild(); pNode;
+ pNode = pNode->GetNextSibling()) {
if (pNode->GetNameHash() == dwNameHash) {
return pNode;
}
@@ -1001,8 +983,8 @@ CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const {
}
CXFA_Node* CXFA_Node::GetFirstChildByClassInternal(XFA_Element eType) const {
- for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = GetFirstChild(); pNode;
+ pNode = pNode->GetNextSibling()) {
if (pNode->GetElementType() == eType) {
return pNode;
}
@@ -1011,8 +993,8 @@ CXFA_Node* CXFA_Node::GetFirstChildByClassInternal(XFA_Element eType) const {
}
CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const {
- for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = GetNextSibling(); pNode;
+ pNode = pNode->GetNextSibling()) {
if (pNode->GetNameHash() == dwNameHash) {
return pNode;
}
@@ -1026,8 +1008,8 @@ CXFA_Node* CXFA_Node::GetNextSameNameSiblingInternal(
}
CXFA_Node* CXFA_Node::GetNextSameClassSiblingInternal(XFA_Element eType) const {
- for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = GetNextSibling(); pNode;
+ pNode = pNode->GetNextSibling()) {
if (pNode->GetElementType() == eType) {
return pNode;
}
@@ -1054,12 +1036,12 @@ int32_t CXFA_Node::GetNodeSameClassIndex() const {
CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() {
CXFA_Node* pInstanceMgr = nullptr;
if (m_ePacket == XFA_PacketType::Form) {
- CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = GetParent();
if (!pParentNode || pParentNode->GetElementType() == XFA_Element::Area) {
return pInstanceMgr;
}
- for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
+ for (CXFA_Node* pNode = GetPrevSibling(); pNode;
+ pNode = pNode->GetPrevSibling()) {
XFA_Element eType = pNode->GetElementType();
if ((eType == XFA_Element::Subform || eType == XFA_Element::SubformSet) &&
pNode->m_dwNameHash != m_dwNameHash) {
@@ -1152,8 +1134,8 @@ bool CXFA_Node::IsNeedSavingXMLNode() {
CXFA_Node* CXFA_Node::GetItem(int32_t iIndex) {
int32_t iCount = 0;
uint32_t dwNameHash = 0;
- for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = GetNextSibling(); pNode;
+ pNode = pNode->GetNextSibling()) {
XFA_Element eCurType = pNode->GetElementType();
if (eCurType == XFA_Element::InstanceManager)
break;
@@ -1183,8 +1165,8 @@ CXFA_Node* CXFA_Node::GetItem(int32_t iIndex) {
int32_t CXFA_Node::GetCount() {
int32_t iCount = 0;
uint32_t dwNameHash = 0;
- for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode;
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = GetNextSibling(); pNode;
+ pNode = pNode->GetNextSibling()) {
XFA_Element eCurType = pNode->GetElementType();
if (eCurType == XFA_Element::InstanceManager)
break;
@@ -1219,9 +1201,8 @@ void CXFA_Node::InsertItem(CXFA_Node* pNewInstance,
iPos = iCount;
if (iPos == iCount) {
CXFA_Node* pNextSibling =
- iCount > 0 ? GetItem(iCount - 1)->GetNodeItem(XFA_NODEITEM_NextSibling)
- : GetNodeItem(XFA_NODEITEM_NextSibling);
- GetNodeItem(XFA_NODEITEM_Parent)->InsertChild(pNewInstance, pNextSibling);
+ iCount > 0 ? GetItem(iCount - 1)->GetNextSibling() : GetNextSibling();
+ GetParent()->InsertChild(pNewInstance, pNextSibling);
if (bMoveDataBindingNodes) {
std::set<CXFA_Node*> sNew;
std::set<CXFA_Node*> sAfter;
@@ -1251,8 +1232,7 @@ void CXFA_Node::InsertItem(CXFA_Node* pNewInstance,
}
} else {
CXFA_Node* pBeforeInstance = GetItem(iPos);
- GetNodeItem(XFA_NODEITEM_Parent)
- ->InsertChild(pNewInstance, pBeforeInstance);
+ GetParent()->InsertChild(pNewInstance, pBeforeInstance);
if (bMoveDataBindingNodes) {
std::set<CXFA_Node*> sNew;
std::set<CXFA_Node*> sBefore;
@@ -1285,7 +1265,7 @@ void CXFA_Node::InsertItem(CXFA_Node* pNewInstance,
void CXFA_Node::RemoveItem(CXFA_Node* pRemoveInstance,
bool bRemoveDataBinding) {
- GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pRemoveInstance, true);
+ GetParent()->RemoveChild(pRemoveInstance, true);
if (!bRemoveDataBinding)
return;
@@ -1298,8 +1278,7 @@ void CXFA_Node::RemoveItem(CXFA_Node* pRemoveInstance,
continue;
if (pDataNode->RemoveBindItem(pFormNode) == 0) {
- if (CXFA_Node* pDataParent =
- pDataNode->GetNodeItem(XFA_NODEITEM_Parent)) {
+ if (CXFA_Node* pDataParent = pDataNode->GetParent()) {
pDataParent->RemoveChild(pDataNode, true);
}
}
@@ -1310,11 +1289,11 @@ void CXFA_Node::RemoveItem(CXFA_Node* pRemoveInstance,
CXFA_Node* CXFA_Node::CreateInstance(bool bDataMerge) {
CXFA_Document* pDocument = GetDocument();
CXFA_Node* pTemplateNode = GetTemplateNode();
- CXFA_Node* pFormParent = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pFormParent = GetParent();
CXFA_Node* pDataScope = nullptr;
for (CXFA_Node* pRootBoundNode = pFormParent;
pRootBoundNode && pRootBoundNode->IsContainerNode();
- pRootBoundNode = pRootBoundNode->GetNodeItem(XFA_NODEITEM_Parent)) {
+ pRootBoundNode = pRootBoundNode->GetParent()) {
pDataScope = pRootBoundNode->GetBindData();
if (pDataScope)
break;
@@ -1401,16 +1380,15 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
switch (GetElementType()) {
case XFA_Element::Caption:
bNeedFindContainer = true;
- pNotify->OnValueChanged(this, eAttribute, this,
- GetNodeItem(XFA_NODEITEM_Parent));
+ pNotify->OnValueChanged(this, eAttribute, this, GetParent());
break;
case XFA_Element::Font:
case XFA_Element::Para: {
bNeedFindContainer = true;
- CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = GetParent();
if (pParentNode->GetElementType() == XFA_Element::Caption) {
pNotify->OnValueChanged(this, eAttribute, pParentNode,
- pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
+ pParentNode->GetParent());
} else {
pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
}
@@ -1418,32 +1396,31 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
}
case XFA_Element::Margin: {
bNeedFindContainer = true;
- CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = GetParent();
XFA_Element eParentType = pParentNode->GetElementType();
if (pParentNode->IsContainerNode()) {
pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
} else if (eParentType == XFA_Element::Caption) {
pNotify->OnValueChanged(this, eAttribute, pParentNode,
- pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
+ pParentNode->GetParent());
} else {
- CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pNode = pParentNode->GetParent();
if (pNode && pNode->GetElementType() == XFA_Element::Ui) {
- pNotify->OnValueChanged(this, eAttribute, pNode,
- pNode->GetNodeItem(XFA_NODEITEM_Parent));
+ pNotify->OnValueChanged(this, eAttribute, pNode, pNode->GetParent());
}
}
break;
}
case XFA_Element::Comb: {
- CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pEditNode = GetParent();
XFA_Element eUIType = pEditNode->GetElementType();
if (pEditNode && (eUIType == XFA_Element::DateTimeEdit ||
eUIType == XFA_Element::NumericEdit ||
eUIType == XFA_Element::TextEdit)) {
- CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pUINode = pEditNode->GetParent();
if (pUINode) {
pNotify->OnValueChanged(this, eAttribute, pUINode,
- pUINode->GetNodeItem(XFA_NODEITEM_Parent));
+ pUINode->GetParent());
}
}
break;
@@ -1455,19 +1432,19 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
case XFA_Element::NumericEdit:
case XFA_Element::PasswordEdit:
case XFA_Element::TextEdit: {
- CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pUINode = GetParent();
if (pUINode) {
pNotify->OnValueChanged(this, eAttribute, pUINode,
- pUINode->GetNodeItem(XFA_NODEITEM_Parent));
+ pUINode->GetParent());
}
break;
}
case XFA_Element::CheckButton: {
bNeedFindContainer = true;
- CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pUINode = GetParent();
if (pUINode) {
pNotify->OnValueChanged(this, eAttribute, pUINode,
- pUINode->GetNodeItem(XFA_NODEITEM_Parent));
+ pUINode->GetParent());
}
break;
}
@@ -1491,30 +1468,29 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
case XFA_Element::Sharptext:
case XFA_Element::Sharpxml:
case XFA_Element::SharpxHTML: {
- CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pTextNode = GetParent();
if (!pTextNode)
return;
- CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pValueNode = pTextNode->GetParent();
if (!pValueNode)
return;
XFA_Element eType = pValueNode->GetElementType();
if (eType == XFA_Element::Value) {
bNeedFindContainer = true;
- CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pNode = pValueNode->GetParent();
if (pNode && pNode->IsContainerNode()) {
if (bScriptModify)
pValueNode = pNode;
pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
} else {
- pNotify->OnValueChanged(this, eAttribute, pNode,
- pNode->GetNodeItem(XFA_NODEITEM_Parent));
+ pNotify->OnValueChanged(this, eAttribute, pNode, pNode->GetParent());
}
} else {
if (eType == XFA_Element::Items) {
- CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pNode = pValueNode->GetParent();
if (pNode && pNode->IsContainerNode()) {
pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
}
@@ -1531,7 +1507,7 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
CXFA_Node* pParent = this;
while (pParent && !pParent->IsContainerNode())
- pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
+ pParent = pParent->GetParent();
if (pParent)
pLayoutPro->AddChangedContainer(pParent);
@@ -1668,7 +1644,7 @@ Optional<float> CXFA_Node::TryMaxHeight() {
}
CXFA_Node* CXFA_Node::GetExclGroup() {
- CXFA_Node* pExcl = GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pExcl = GetParent();
if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup)
return nullptr;
return pExcl;
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 374e8e55bf..fe1c3e007f 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -182,7 +182,12 @@ class CXFA_Node : public CXFA_Object {
bool RemoveChild(CXFA_Node* pNode, bool bNotify);
CXFA_Node* Clone(bool bRecursive);
- CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const;
+
+ CXFA_Node* GetNextSibling() const { return m_pNext; }
+ CXFA_Node* GetPrevSibling() const;
+ CXFA_Node* GetFirstChild() const { return m_pChild; }
+ CXFA_Node* GetParent() const { return m_pParent; }
+
CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const;
std::vector<CXFA_Node*> GetNodeList(uint32_t dwTypeFilter,
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp
index 98e4bdce42..6a090ffe96 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -181,7 +181,7 @@ CXFA_Node* CXFA_NodeHelper::ResolveNodes_GetParent(CXFA_Node* pNode,
return nullptr;
}
if (eLogicType == XFA_LOGIC_NoTransparent) {
- return pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ return pNode->GetParent();
}
CXFA_Node* parent;
CXFA_Node* node = pNode;
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp
index 5031216de9..92a676a762 100644
--- a/xfa/fxfa/parser/cxfa_nodelocale.cpp
+++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp
@@ -136,13 +136,12 @@ WideString CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const {
CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent,
const WideStringView& wsName) const {
- CXFA_Node* pChild =
- pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr;
+ CXFA_Node* pChild = pParent ? pParent->GetFirstChild() : nullptr;
while (pChild) {
if (pChild->JSObject()->GetAttribute(XFA_Attribute::Name) == wsName)
return pChild;
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChild = pChild->GetNextSibling();
}
return nullptr;
}
diff --git a/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h b/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h
index 7fab43c9bc..fc98d18623 100644
--- a/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h
+++ b/xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h
@@ -12,13 +12,13 @@
class CXFA_TraverseStrategy_XFANode {
public:
static inline CXFA_Node* GetFirstChild(CXFA_Node* pTemplateNode) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ return pTemplateNode->GetFirstChild();
}
static inline CXFA_Node* GetNextSibling(CXFA_Node* pTemplateNode) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ return pTemplateNode->GetNextSibling();
}
static inline CXFA_Node* GetParent(CXFA_Node* pTemplateNode) {
- return pTemplateNode->GetNodeItem(XFA_NODEITEM_Parent);
+ return pTemplateNode->GetParent();
}
};
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index c124c3052a..9e7ffcee50 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -79,9 +79,8 @@ WideString CXFA_Validate::GetMessageText(const WideString& wsMessageType) {
if (!pNode)
return L"";
- for (CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pItemNode;
- pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pItemNode = pNode->GetFirstChild(); pItemNode;
+ pItemNode = pItemNode->GetNextSibling()) {
if (pItemNode->GetElementType() != XFA_Element::Text)
continue;
@@ -123,9 +122,8 @@ void CXFA_Validate::SetMessageText(const WideString& wsMessageType,
if (!pNode)
return;
- for (CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pItemNode;
- pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pItemNode = pNode->GetFirstChild(); pItemNode;
+ pItemNode = pItemNode->GetNextSibling()) {
if (pItemNode->GetElementType() != XFA_Element::Text)
continue;
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
index 0998c06364..dc93bba25c 100644
--- a/xfa/fxfa/parser/cxfa_value.cpp
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -57,37 +57,37 @@ CXFA_Value::CXFA_Value(CXFA_Document* doc, XFA_PacketType packet)
CXFA_Value::~CXFA_Value() {}
XFA_Element CXFA_Value::GetChildValueClassID() const {
- CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pNode = GetFirstChild();
return pNode ? pNode->GetElementType() : XFA_Element::Unknown;
}
WideString CXFA_Value::GetChildValueContent() const {
- CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pNode = GetFirstChild();
if (!pNode)
return L"";
return pNode->JSObject()->TryContent(false, true).value_or(L"");
}
CXFA_Arc* CXFA_Value::GetArc() const {
- return static_cast<CXFA_Arc*>(GetNodeItem(XFA_NODEITEM_FirstChild));
+ return static_cast<CXFA_Arc*>(GetFirstChild());
}
CXFA_Line* CXFA_Value::GetLine() const {
- return static_cast<CXFA_Line*>(GetNodeItem(XFA_NODEITEM_FirstChild));
+ return static_cast<CXFA_Line*>(GetFirstChild());
}
CXFA_Rectangle* CXFA_Value::GetRectangle() const {
- return static_cast<CXFA_Rectangle*>(GetNodeItem(XFA_NODEITEM_FirstChild));
+ return static_cast<CXFA_Rectangle*>(GetFirstChild());
}
CXFA_Text* CXFA_Value::GetText() const {
- return static_cast<CXFA_Text*>(GetNodeItem(XFA_NODEITEM_FirstChild));
+ return static_cast<CXFA_Text*>(GetFirstChild());
}
CXFA_ExData* CXFA_Value::GetExData() const {
- return static_cast<CXFA_ExData*>(GetNodeItem(XFA_NODEITEM_FirstChild));
+ return static_cast<CXFA_ExData*>(GetFirstChild());
}
CXFA_Image* CXFA_Value::GetImage() const {
- return static_cast<CXFA_Image*>(GetNodeItem(XFA_NODEITEM_FirstChild));
+ return static_cast<CXFA_Image*>(GetFirstChild());
}
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index c8de462e0a..e2e212f70b 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -47,7 +47,7 @@ class CXFA_TraverseStrategy_DDGroup {
return pDDGroupNode->GetNextSameNameSibling(XFA_HASHCODE_Group);
}
static CXFA_Node* GetParent(CXFA_Node* pDDGroupNode) {
- return pDDGroupNode->GetNodeItem(XFA_NODEITEM_Parent);
+ return pDDGroupNode->GetParent();
}
};
@@ -57,7 +57,7 @@ struct RecurseRecord {
};
CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) {
- CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pChildNode = pValueNode->GetFirstChild();
if (!pChildNode) {
if (iType == XFA_Element::Unknown)
return nullptr;
@@ -87,8 +87,7 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode,
switch (pChildNode->GetObjectType()) {
case XFA_ObjectType::ContentNode: {
- CXFA_Node* pContentRawDataNode =
- pChildNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pContentRawDataNode = pChildNode->GetFirstChild();
if (!pContentRawDataNode) {
XFA_Element element = XFA_Element::Sharptext;
if (pChildNode->GetElementType() == XFA_Element::ExData) {
@@ -199,8 +198,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
break;
case XFA_Element::ExclGroup: {
CXFA_Node* pChecked = nullptr;
- CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ CXFA_Node* pChild = pFormNode->GetFirstChild();
+ for (; pChild; pChild = pChild->GetNextSibling()) {
if (pChild->GetElementType() != XFA_Element::Field)
continue;
@@ -218,7 +217,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (!pItems)
continue;
- CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pText = pItems->GetFirstChild();
if (!pText)
continue;
@@ -235,8 +234,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (!pChecked)
break;
- pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ pChild = pFormNode->GetFirstChild();
+ for (; pChild; pChild = pChild->GetNextSibling()) {
if (pChild == pChecked)
continue;
if (pChild->GetElementType() != XFA_Element::Field)
@@ -247,10 +246,9 @@ void CreateDataBinding(CXFA_Node* pFormNode,
0, XFA_Element::Value);
CXFA_Items* pItems =
pChild->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
- CXFA_Node* pText =
- pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr;
+ CXFA_Node* pText = pItems ? pItems->GetFirstChild() : nullptr;
if (pText)
- pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pText = pText->GetNextSibling();
WideString wsContent;
if (pText)
@@ -397,8 +395,7 @@ CXFA_Node* ScopeMatchGlobalBinding(CXFA_Node* pDataScope,
pCurDataScope &&
pCurDataScope->GetPacketType() == XFA_PacketType::Datasets;
pLastDataScope = pCurDataScope,
- pCurDataScope =
- pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) {
+ pCurDataScope = pCurDataScope->GetParent()) {
for (CXFA_Node* pDataChild = pCurDataScope->GetFirstChildByName(dwNameHash);
pDataChild;
pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) {
@@ -458,7 +455,7 @@ CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument,
for (CXFA_Node* pCurDataScope = pDataScope;
pCurDataScope &&
pCurDataScope->GetPacketType() == XFA_PacketType::Datasets;
- pCurDataScope = pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) {
+ pCurDataScope = pCurDataScope->GetParent()) {
for (CXFA_Node* pDataChild = pCurDataScope->GetFirstChildByName(dwNameHash);
pDataChild;
pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) {
@@ -528,22 +525,20 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument,
pDocument, XFA_Element::InstanceManager, dwInstNameHash, pFormParent);
if (pExistingNode) {
uint32_t dwNameHash = pTemplateNode->GetNameHash();
- for (CXFA_Node* pNode =
- pExistingNode->GetNodeItem(XFA_NODEITEM_NextSibling);
- pNode;) {
+ for (CXFA_Node* pNode = pExistingNode->GetNextSibling(); pNode;) {
XFA_Element eCurType = pNode->GetElementType();
if (eCurType == XFA_Element::InstanceManager)
break;
if ((eCurType != XFA_Element::Subform) &&
(eCurType != XFA_Element::SubformSet)) {
- pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pNode = pNode->GetNextSibling();
continue;
}
if (dwNameHash != pNode->GetNameHash())
break;
- CXFA_Node* pNextNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ CXFA_Node* pNextNode = pNode->GetNextSibling();
pFormParent->RemoveChild(pNode, true);
subforms->push_back(pNode);
pNode = pNextNode;
@@ -686,8 +681,8 @@ void SortRecurseRecord(std::vector<RecurseRecord>* rgRecords,
CXFA_Node* pDataScope,
bool bChoiceMode) {
std::vector<RecurseRecord> rgResultRecord;
- for (CXFA_Node* pNode = pDataScope->GetNodeItem(XFA_NODEITEM_FirstChild);
- pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pNode = pDataScope->GetFirstChild(); pNode;
+ pNode = pNode->GetNextSibling()) {
auto it = std::find_if(rgRecords->begin(), rgRecords->end(),
[pNode](const RecurseRecord& record) {
return pNode == record.pDataChild;
@@ -804,10 +799,9 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
auto it = subformMapArray.find(pSubform);
if (it != subformMapArray.end())
pDataNode = it->second;
- for (CXFA_Node* pTemplateChild =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
+ pTemplateChild;
+ pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, bUseInstanceManager)) {
XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubform,
pTemplateChild, true, nullptr);
@@ -843,10 +837,9 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
std::vector<RecurseRecord> rgItemMatchList;
std::vector<CXFA_Node*> rgItemUnmatchList;
- for (CXFA_Node* pTemplateChild =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
+ pTemplateChild;
+ pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, bUseInstanceManager)) {
XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubformSetNode,
pTemplateChild, true, nullptr);
@@ -909,10 +902,9 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
if (!pFirstInstance)
pFirstInstance = pSubformSetNode;
- for (CXFA_Node* pTemplateChild =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
+ pTemplateChild;
+ pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, bUseInstanceManager)) {
XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubformSetNode,
pTemplateChild, true, nullptr);
@@ -950,10 +942,9 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
if (!pFirstInstance)
pFirstInstance = pSubformNode;
- for (CXFA_Node* pTemplateChild =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
+ pTemplateChild;
+ pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, bUseInstanceManager)) {
XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubformNode,
pTemplateChild, true, nullptr);
@@ -975,10 +966,8 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
pFirstInstance = pSubformSetNode;
bool bFound = false;
- for (CXFA_Node* pTemplateChild =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
+ pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, bUseInstanceManager)) {
XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubformSetNode,
pTemplateChild, true, nullptr);
@@ -1004,10 +993,9 @@ CXFA_Node* CopyContainer_Field(CXFA_Document* pDocument,
CXFA_Node* pFieldNode = XFA_NodeMerge_CloneOrMergeContainer(
pDocument, pFormNode, pTemplateNode, false, nullptr);
ASSERT(pFieldNode);
- for (CXFA_Node* pTemplateChildNode =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChildNode; pTemplateChildNode = pTemplateChildNode->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChildNode = pTemplateNode->GetFirstChild();
+ pTemplateChildNode;
+ pTemplateChildNode = pTemplateChildNode->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChildNode, true)) {
XFA_NodeMerge_CloneOrMergeContainer(pDocument, pFieldNode,
pTemplateChildNode, true, nullptr);
@@ -1137,8 +1125,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument,
FormValueNode_MatchNoneCreateChild(pFormNode);
} else {
- CXFA_Node* pDataParent =
- pDataNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pDataParent = pDataNode->GetParent();
if (pDataParent != pDataScope) {
ASSERT(pDataParent);
pDataParent->RemoveChild(pDataNode, true);
@@ -1208,10 +1195,8 @@ void UpdateBindingRelations(CXFA_Document* pDocument,
(eType == XFA_Element::Subform || eType == XFA_Element::SubformSet ||
eType == XFA_Element::Area || eType == XFA_Element::PageArea ||
eType == XFA_Element::PageSet)) {
- for (CXFA_Node* pFormChild =
- pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pFormChild;
- pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pFormChild = pFormNode->GetFirstChild(); pFormChild;
+ pFormChild = pFormChild->GetNextSibling()) {
if (!pFormChild->IsContainerNode())
continue;
if (pFormChild->IsUnusedNode())
@@ -1226,9 +1211,8 @@ void UpdateBindingRelations(CXFA_Document* pDocument,
void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) {
ASSERT(pDataDescriptionNode);
- for (CXFA_Node* pDataChild = pDataNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pDataChild;
- pDataChild = pDataChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pDataChild = pDataNode->GetFirstChild(); pDataChild;
+ pDataChild = pDataChild->GetNextSibling()) {
uint32_t dwNameHash = pDataChild->GetNameHash();
if (!dwNameHash)
continue;
@@ -1265,9 +1249,8 @@ CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument,
XFA_Element eType,
uint32_t dwNameHash,
CXFA_Node* pFormParent) {
- CXFA_Node* pFormChild = pFormParent->GetNodeItem(XFA_NODEITEM_FirstChild);
- for (; pFormChild;
- pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ CXFA_Node* pFormChild = pFormParent->GetFirstChild();
+ for (; pFormChild; pFormChild = pFormChild->GetNextSibling()) {
if (pFormChild->GetElementType() == eType &&
pFormChild->GetNameHash() == dwNameHash && pFormChild->IsUnusedNode()) {
return pFormChild;
@@ -1301,10 +1284,8 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(
pExistingNode->ClearFlag(XFA_NodeFlag_UnusedNode);
pExistingNode->SetTemplateNode(pTemplateNode);
if (bRecursive && pExistingNode->GetElementType() != XFA_Element::Items) {
- for (CXFA_Node* pTemplateChild =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
+ pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, true)) {
XFA_NodeMerge_CloneOrMergeContainer(
pDocument, pExistingNode, pTemplateChild, bRecursive, nullptr);
@@ -1318,10 +1299,8 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(
CXFA_Node* pNewNode = pTemplateNode->CloneTemplateToForm(false);
pFormParent->InsertChild(pNewNode, nullptr);
if (bRecursive) {
- for (CXFA_Node* pTemplateChild =
- pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
+ pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, true)) {
CXFA_Node* pNewChild = pTemplateChild->CloneTemplateToForm(true);
pNewNode->InsertChild(pNewChild, nullptr);
@@ -1334,7 +1313,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(
CXFA_Node* XFA_DataMerge_FindDataScope(CXFA_Node* pParentFormNode) {
for (CXFA_Node* pRootBoundNode = pParentFormNode;
pRootBoundNode && pRootBoundNode->IsContainerNode();
- pRootBoundNode = pRootBoundNode->GetNodeItem(XFA_NODEITEM_Parent)) {
+ pRootBoundNode = pRootBoundNode->GetParent()) {
CXFA_Node* pDataScope = pRootBoundNode->GetBindData();
if (pDataScope)
return pDataScope;
@@ -1374,8 +1353,8 @@ CXFA_Node* CXFA_Document::DataMerge_CopyContainer(CXFA_Node* pTemplateNode,
void CXFA_Document::DataMerge_UpdateBindingRelations(
CXFA_Node* pFormUpdateRoot) {
- CXFA_Node* pDataScope = XFA_DataMerge_FindDataScope(
- pFormUpdateRoot->GetNodeItem(XFA_NODEITEM_Parent));
+ CXFA_Node* pDataScope =
+ XFA_DataMerge_FindDataScope(pFormUpdateRoot->GetParent());
if (!pDataScope)
return;
@@ -1410,10 +1389,8 @@ void CXFA_Document::DoDataMerge() {
CXFA_Node *pDataRoot = nullptr, *pDDRoot = nullptr;
WideString wsDatasetsURI =
pDatasetsRoot->JSObject()->TryNamespace().value_or(WideString());
- for (CXFA_Node* pChildNode =
- pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
- pChildNode;
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pChildNode = pDatasetsRoot->GetFirstChild(); pChildNode;
+ pChildNode = pChildNode->GetNextSibling()) {
if (pChildNode->GetElementType() != XFA_Element::DataGroup)
continue;
@@ -1497,16 +1474,14 @@ void CXFA_Document::DoDataMerge() {
pDataTopLevel->JSObject()->SetCData(XFA_Attribute::Name, wsDataTopLevelName,
false, false);
pDataTopLevel->SetXMLMappingNode(pDataTopLevelXMLNode);
- CXFA_Node* pBeforeNode = pDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pBeforeNode = pDataRoot->GetFirstChild();
pDataRoot->InsertChild(pDataTopLevel, pBeforeNode);
}
ASSERT(pDataTopLevel);
CreateDataBinding(pSubformSetNode, pDataTopLevel, true);
- for (CXFA_Node* pTemplateChild =
- pTemplateChosen->GetNodeItem(XFA_NODEITEM_FirstChild);
- pTemplateChild;
- pTemplateChild = pTemplateChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pTemplateChild = pTemplateChosen->GetFirstChild();
+ pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
if (NeedGenerateForm(pTemplateChild, true)) {
XFA_NodeMerge_CloneOrMergeContainer(this, pSubformSetNode, pTemplateChild,
true, nullptr);
@@ -1541,7 +1516,7 @@ void CXFA_Document::DoDataMerge() {
if (pNode->IsContainerNode() ||
pNode->GetElementType() == XFA_Element::InstanceManager) {
CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext();
- pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode, true);
+ pNode->GetParent()->RemoveChild(pNode, true);
pNode = pNext;
} else {
pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
@@ -1558,7 +1533,7 @@ void CXFA_Document::DoDataMerge() {
void CXFA_Document::DoDataRemerge(bool bDoDataMerge) {
CXFA_Node* pFormRoot = ToNode(GetXFAObject(XFA_HASHCODE_Form));
if (pFormRoot) {
- while (CXFA_Node* pNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild))
+ while (CXFA_Node* pNode = pFormRoot->GetFirstChild())
pFormRoot->RemoveChild(pNode, true);
pFormRoot->SetBindingNode(nullptr);
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index bc181b5947..bda4c2c92f 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -115,11 +115,11 @@ bool AttributeSaveInDataModel(CXFA_Node* pNode, XFA_Attribute eAttribute) {
if (pNode->GetElementType() != XFA_Element::Image)
return bSaveInDataModel;
- CXFA_Node* pValueNode = pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pValueNode = pNode->GetParent();
if (!pValueNode || pValueNode->GetElementType() != XFA_Element::Value)
return bSaveInDataModel;
- CXFA_Node* pFieldNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pFieldNode = pValueNode->GetParent();
if (pFieldNode && pFieldNode->GetBindData() &&
eAttribute == XFA_Attribute::Href) {
bSaveInDataModel = true;
@@ -134,11 +134,11 @@ bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) {
return false;
ASSERT(pContentNode->IsContentNode());
- CXFA_Node* pParentNode = pContentNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = pContentNode->GetParent();
if (!pParentNode || pParentNode->GetElementType() != XFA_Element::Value)
return true;
- CXFA_Node* pGrandParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pGrandParentNode = pParentNode->GetParent();
if (!pGrandParentNode || !pGrandParentNode->IsContainerNode())
return true;
if (pGrandParentNode->GetBindData())
@@ -194,12 +194,12 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
if (!bSaveXML && !ContentNodeNeedtoExport(pNode))
break;
- CXFA_Node* pRawValueNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pRawValueNode = pNode->GetFirstChild();
while (pRawValueNode &&
pRawValueNode->GetElementType() != XFA_Element::SharpxHTML &&
pRawValueNode->GetElementType() != XFA_Element::Sharptext &&
pRawValueNode->GetElementType() != XFA_Element::Sharpxml) {
- pRawValueNode = pRawValueNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pRawValueNode = pRawValueNode->GetNextSibling();
}
if (!pRawValueNode)
break;
@@ -245,10 +245,9 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
iEnd = rawValue->Find(L'\n', iStart);
}
- CXFA_Node* pParentNode = pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pParentNode = pNode->GetParent();
ASSERT(pParentNode);
- CXFA_Node* pGrandparentNode =
- pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Node* pGrandparentNode = pParentNode->GetParent();
ASSERT(pGrandparentNode);
WideString bodyTagName;
bodyTagName =
@@ -294,23 +293,23 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
}
}
CFX_WideTextBuf newBuf;
- CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pChildNode = pNode->GetFirstChild();
while (pChildNode) {
RegenerateFormFile_Changed(pChildNode, newBuf, bSaveXML);
wsChildren += newBuf.AsStringView();
newBuf.Clear();
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChildNode = pChildNode->GetNextSibling();
}
if (!bSaveXML && !wsChildren.IsEmpty() &&
pNode->GetElementType() == XFA_Element::Items) {
wsChildren.clear();
bSaveXML = true;
- CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pChild = pNode->GetFirstChild();
while (pChild) {
RegenerateFormFile_Changed(pChild, newBuf, bSaveXML);
wsChildren += newBuf.AsStringView();
newBuf.Clear();
- pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChild = pChild->GetNextSibling();
}
}
break;
@@ -375,12 +374,12 @@ void RegenerateFormFile_Container(
if (!wsOutput.IsEmpty())
pStream->WriteString(wsOutput.AsStringView());
- CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pChildNode = pNode->GetFirstChild();
if (pChildNode) {
pStream->WriteString(L"\n>");
while (pChildNode) {
RegenerateFormFile_Container(pChildNode, pStream, bSaveXML);
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChildNode = pChildNode->GetNextSibling();
}
pStream->WriteString(L"</");
pStream->WriteString(wsElement);
@@ -422,7 +421,7 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_Node* pNode) {
if (!pNodeValue)
return CXFA_LocaleValue();
- CXFA_Node* pValueChild = pNodeValue->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pValueChild = pNodeValue->GetFirstChild();
if (!pValueChild)
return CXFA_LocaleValue();
@@ -495,9 +494,8 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) {
return;
int32_t iChildNum = 0;
- for (CXFA_Node* pChildNode = pDataNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- pChildNode;
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
+ for (CXFA_Node* pChildNode = pDataNode->GetFirstChild(); pChildNode;
+ pChildNode = pChildNode->GetNextSibling()) {
iChildNum++;
XFA_DataExporter_DealWithDataGroupNode(pChildNode);
}
@@ -545,10 +543,10 @@ void XFA_DataExporter_RegenerateFormFile(
wsVersionNumber += L"/\"\n>";
pStream->WriteString(wsVersionNumber.AsStringView());
- CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pChildNode = pNode->GetFirstChild();
while (pChildNode) {
RegenerateFormFile_Container(pChildNode, pStream, false);
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChildNode = pChildNode->GetNextSibling();
}
pStream->WriteString(L"</form\n>");
} else {
@@ -564,7 +562,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) {
if (!pUIChild)
return false;
- CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild);
+ CXFA_Node* pFirstChild = pUIChild->GetFirstChild();
if (!pFirstChild ||
pFirstChild->GetElementType() != XFA_Element::ChoiceList) {
return false;