Rename CXFA_Node::RemoveChild() to RemoveChildAndNotify()
Avoid some confusion with superclass method TreeNode<>::RemoveChild().
Ditto for InsertChild().
Change-Id: I0f527ac3eb67ab75ca739517578e2831f22014c7
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/54370
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index bf10c0f..3dcee6c 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -331,16 +331,16 @@
int32_t index = 0;
while (pNewChild) {
CXFA_Node* pItem = pNewChild->GetNextSibling();
- pFakeRoot->RemoveChild(pNewChild, true);
- GetXFANode()->InsertChild(index++, pNewChild);
+ pFakeRoot->RemoveChildAndNotify(pNewChild, true);
+ GetXFANode()->InsertChildAndNotify(index++, pNewChild);
pNewChild->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pNewChild = pItem;
}
while (pChild) {
CXFA_Node* pItem = pChild->GetNextSibling();
- GetXFANode()->RemoveChild(pChild, true);
- pFakeRoot->InsertChild(pChild, nullptr);
+ GetXFANode()->RemoveChildAndNotify(pChild, true);
+ pFakeRoot->InsertChildAndNotify(pChild, nullptr);
pChild = pItem;
}
@@ -359,8 +359,8 @@
CXFA_Node* pChild = pFakeRoot->GetFirstChild();
while (pChild) {
CXFA_Node* pItem = pChild->GetNextSibling();
- pFakeRoot->RemoveChild(pChild, true);
- GetXFANode()->InsertChild(pChild, nullptr);
+ pFakeRoot->RemoveChildAndNotify(pChild, true);
+ GetXFANode()->InsertChildAndNotify(pChild, nullptr);
pChild->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pChild = pItem;
}
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 63eb003..a151fba 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -581,7 +581,7 @@
}
if (iSize == 0) {
while (CXFA_Node* pChildNode = pBind->GetFirstChild()) {
- pBind->RemoveChild(pChildNode, true);
+ pBind->RemoveChildAndNotify(pChildNode, true);
}
} else {
std::vector<CXFA_Node*> valueNodes = pBind->GetNodeList(
@@ -596,13 +596,13 @@
pValueNodes->JSObject()->SetCData(XFA_Attribute::Name, L"value",
false, false);
pValueNodes->CreateXMLMappingNode();
- pBind->InsertChild(pValueNodes, nullptr);
+ pBind->InsertChildAndNotify(pValueNodes, nullptr);
}
pValueNodes = nullptr;
} else if (iDatas > iSize) {
size_t iDelNodes = iDatas - iSize;
while (iDelNodes-- > 0) {
- pBind->RemoveChild(pBind->GetFirstChild(), true);
+ pBind->RemoveChildAndNotify(pBind->GetFirstChild(), true);
}
}
int32_t i = 0;
@@ -670,7 +670,8 @@
->CreateSamePacketNode(wsContentType.EqualsASCII("text/xml")
? XFA_Element::Sharpxml
: XFA_Element::Sharptext);
- ToNode(GetXFAObject())->InsertChild(pContentRawDataNode, nullptr);
+ ToNode(GetXFAObject())
+ ->InsertChildAndNotify(pContentRawDataNode, nullptr);
}
pContentRawDataNode->JSObject()->SetContent(
wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData);
@@ -762,7 +763,8 @@
}
pContentRawDataNode =
ToNode(GetXFAObject())->CreateSamePacketNode(element);
- ToNode(GetXFAObject())->InsertChild(pContentRawDataNode, nullptr);
+ ToNode(GetXFAObject())
+ ->InsertChildAndNotify(pContentRawDataNode, nullptr);
}
return pContentRawDataNode->JSObject()->TryContent(bScriptModify, true);
}
@@ -864,7 +866,7 @@
if (!pNewNode)
return nullptr;
- xfaNode->InsertChild(pNewNode, nullptr);
+ xfaNode->InsertChildAndNotify(pNewNode, nullptr);
pNewNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
}
return pNewNode;
@@ -1187,7 +1189,7 @@
CXFA_Node* pHeadChild = ToNode(GetXFAObject())->GetFirstChild();
while (pHeadChild) {
CXFA_Node* pSibling = pHeadChild->GetNextSibling();
- ToNode(GetXFAObject())->RemoveChild(pHeadChild, true);
+ ToNode(GetXFAObject())->RemoveChildAndNotify(pHeadChild, true);
pHeadChild = pSibling;
}
@@ -1195,8 +1197,8 @@
pHeadChild = pProtoForm->GetFirstChild();
while (pHeadChild) {
CXFA_Node* pSibling = pHeadChild->GetNextSibling();
- pProtoForm->RemoveChild(pHeadChild, true);
- ToNode(GetXFAObject())->InsertChild(pHeadChild, nullptr);
+ pProtoForm->RemoveChildAndNotify(pHeadChild, true);
+ ToNode(GetXFAObject())->InsertChildAndNotify(pHeadChild, nullptr);
pHeadChild = pSibling;
}
GetDocument()->FreeOwnedNode(pProtoForm);
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index ee43004..138b7f0 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -519,7 +519,7 @@
CXFA_Node* pNewFormItem = pTemplateParent->CloneTemplateToForm(false);
if (pParent)
- pParent->InsertChild(pNewFormItem, pBefore);
+ pParent->InsertChildAndNotify(pNewFormItem, pBefore);
return pNewFormItem;
}
@@ -535,7 +535,7 @@
pBefore ? pBefore->GetTemplateNodeIfExists() : nullptr)
->Clone(false);
if (pParent)
- pParent->InsertChild(pNewNode, pBefore);
+ pParent->InsertChildAndNotify(pNewNode, pBefore);
return pNewNode;
}
@@ -546,7 +546,7 @@
CXFA_Node* pNewTemplateNode =
pXFADoc->CreateNode(XFA_PacketType::Template, eElement);
if (pParent)
- pParent->InsertChild(pNewTemplateNode, pBefore);
+ pParent->InsertChildAndNotify(pNewTemplateNode, pBefore);
return pNewTemplateNode;
}
diff --git a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
index 0a22d25..99a6e45 100644
--- a/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_itemlayoutprocessor.cpp
@@ -445,7 +445,7 @@
pCurLayoutItem = pNextLayoutItem;
}
}
- pGenerateNode->GetParent()->RemoveChild(pGenerateNode, true);
+ pGenerateNode->GetParent()->RemoveChildAndNotify(pGenerateNode, true);
}
uint8_t HAlignEnumToInt(XFA_AttributeValue eHAlign) {
@@ -1490,9 +1490,9 @@
pFormNode = pFormNode->GetParent();
}
if (pLeaderNode && pFormNode)
- pFormNode->RemoveChild(pLeaderNode, true);
+ pFormNode->RemoveChildAndNotify(pLeaderNode, true);
if (pTrailerNode && pFormNode)
- pFormNode->RemoveChild(pTrailerNode, true);
+ pFormNode->RemoveChildAndNotify(pTrailerNode, true);
if (pTrailerItem)
XFA_ReleaseLayoutItem(pTrailerItem);
}
diff --git a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp b/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
index 700eba5..b191b9c 100644
--- a/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/layout/cxfa_layoutpagemgr.cpp
@@ -419,7 +419,7 @@
if (!pPageArea)
return false;
- m_pTemplatePageSetRoot->InsertChild(pPageArea, nullptr);
+ m_pTemplatePageSetRoot->InsertChildAndNotify(pPageArea, nullptr);
pPageArea->SetFlagAndNotify(XFA_NodeFlag_Initialized);
}
CXFA_ContentArea* pContentArea =
@@ -430,7 +430,7 @@
if (!pContentArea)
return false;
- pPageArea->InsertChild(pContentArea, nullptr);
+ pPageArea->InsertChildAndNotify(pContentArea, nullptr);
pContentArea->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pContentArea->JSObject()->SetMeasure(
XFA_Attribute::X, CXFA_Measurement(0.25f, XFA_Unit::In), false);
@@ -449,7 +449,7 @@
if (!pContentArea)
return false;
- pPageArea->InsertChild(pMedium, nullptr);
+ pPageArea->InsertChildAndNotify(pMedium, nullptr);
pMedium->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pMedium->JSObject()->SetMeasure(
XFA_Attribute::Short, CXFA_Measurement(8.5f, XFA_Unit::In), false);
@@ -1766,7 +1766,7 @@
}
}
if (pExistingNode) {
- pParentNode->RemoveChild(pExistingNode, true);
+ pParentNode->RemoveChildAndNotify(pExistingNode, true);
}
}
pViewItem->m_pOldSubform = pNewSubform;
@@ -1800,7 +1800,7 @@
CXFA_Node* pFormToplevelSubform =
pNode->GetFirstChildByClass<CXFA_Subform>(XFA_Element::Subform);
if (pFormToplevelSubform)
- pFormToplevelSubform->InsertChild(pPendingPageSet, nullptr);
+ pFormToplevelSubform->InsertChildAndNotify(pPendingPageSet, nullptr);
}
}
pDocument->DataMerge_UpdateBindingRelations(pPendingPageSet);
@@ -1839,7 +1839,7 @@
}
}
CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext();
- pNode->GetParent()->RemoveChild(pNode, true);
+ pNode->GetParent()->RemoveChildAndNotify(pNode, true);
pNode = pNext;
} else {
pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
@@ -1951,7 +1951,8 @@
CXFA_Node* pNextPageSet =
pPageSetFormNode->GetNextSameClassSibling<CXFA_PageSet>(
XFA_Element::PageSet);
- pPageSetFormNode->GetParent()->RemoveChild(pPageSetFormNode, false);
+ pPageSetFormNode->GetParent()->RemoveChildAndNotify(pPageSetFormNode,
+ false);
pRootLayoutItem->GetFormNode()
->GetDocument()
->m_pPendingPageSet.push_back(pPageSetFormNode);
diff --git a/xfa/fxfa/parser/cxfa_attachnodelist.cpp b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
index 8fc67cb1..6d8e5c3 100644
--- a/xfa/fxfa/parser/cxfa_attachnodelist.cpp
+++ b/xfa/fxfa/parser/cxfa_attachnodelist.cpp
@@ -24,9 +24,9 @@
void CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
CXFA_Node* pParent = pNode->GetParent();
if (pParent)
- pParent->RemoveChild(pNode, true);
+ pParent->RemoveChildAndNotify(pNode, true);
- m_pAttachNode->InsertChild(pNode, nullptr);
+ m_pAttachNode->InsertChildAndNotify(pNode, nullptr);
}
bool CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) {
@@ -35,14 +35,14 @@
CXFA_Node* pParent = pNewNode->GetParent();
if (pParent)
- pParent->RemoveChild(pNewNode, true);
+ pParent->RemoveChildAndNotify(pNewNode, true);
- m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
+ m_pAttachNode->InsertChildAndNotify(pNewNode, pBeforeNode);
return true;
}
void CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
- m_pAttachNode->RemoveChild(pNode, true);
+ m_pAttachNode->RemoveChildAndNotify(pNode, true);
}
CXFA_Node* CXFA_AttachNodeList::Item(size_t index) {
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index a30cb54..0264365 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -116,7 +116,7 @@
}
}
pContentRawDataNode = pChildNode->CreateSamePacketNode(element);
- pChildNode->InsertChild(pContentRawDataNode, nullptr);
+ pChildNode->InsertChildAndNotify(pContentRawDataNode, nullptr);
}
pContentRawDataNode->JSObject()->SetCData(XFA_Attribute::Value, wsContent,
false, false);
@@ -157,7 +157,7 @@
}
CXFA_Node* pNewNode = pProtoNode->Clone(true);
pNewNode->SetTemplateNode(pProtoNode);
- pDestNodeParent->InsertChild(pNewNode, nullptr);
+ pDestNodeParent->InsertChildAndNotify(pNewNode, nullptr);
}
void MergeNode(CXFA_Node* pDestNode, CXFA_Node* pProtoNode) {
@@ -209,12 +209,12 @@
break;
CXFA_Node* pNextNode = pNode->GetNextSibling();
- pFormParent->RemoveChild(pNode, true);
+ pFormParent->RemoveChildAndNotify(pNode, true);
subforms->push_back(pNode);
pNode = pNextNode;
}
- pFormParent->RemoveChild(pExistingNode, true);
- pFormParent->InsertChild(pExistingNode, nullptr);
+ pFormParent->RemoveChildAndNotify(pExistingNode, true);
+ pFormParent->InsertChildAndNotify(pExistingNode, nullptr);
pExistingNode->ClearFlag(XFA_NodeFlag_UnusedNode);
pExistingNode->SetTemplateNode(pTemplateNode);
return pExistingNode;
@@ -226,7 +226,7 @@
L"_" + pTemplateNode->JSObject()->GetCData(XFA_Attribute::Name);
pNewNode->JSObject()->SetCData(XFA_Attribute::Name, wsInstMgrNodeName, false,
false);
- pFormParent->InsertChild(pNewNode, nullptr);
+ pFormParent->InsertChildAndNotify(pNewNode, nullptr);
pNewNode->SetTemplateNode(pTemplateNode);
return pNewNode;
}
@@ -534,7 +534,7 @@
pValue->JSObject()->SetCData(XFA_Attribute::Name, L"value", false,
false);
pValue->CreateXMLMappingNode();
- pDataNode->InsertChild(pValue, nullptr);
+ pDataNode->InsertChildAndNotify(pValue, nullptr);
pValue->JSObject()->SetCData(XFA_Attribute::Value, text, false,
false);
}
@@ -739,7 +739,7 @@
pDocument->CreateNode(XFA_PacketType::Datasets, eNodeType);
pDataNode->JSObject()->SetCData(XFA_Attribute::Name, wsName, false, false);
pDataNode->CreateXMLMappingNode();
- pDataParent->InsertChild(pDataNode, nullptr);
+ pDataParent->InsertChildAndNotify(pDataNode, nullptr);
pDataNode->SetFlag(XFA_NodeFlag_Initialized);
return pDataNode;
}
@@ -776,7 +776,7 @@
pDataNode->JSObject()->SetEnum(XFA_Attribute::Contains,
XFA_AttributeValue::MetaData, false);
}
- pDataParent->InsertChild(pDataNode, nullptr);
+ pDataParent->InsertChildAndNotify(pDataNode, nullptr);
pDataNode->SetDataDescriptionNode(pDDNode);
pDataNode->SetFlag(XFA_NodeFlag_Initialized);
return pDataNode;
@@ -1156,8 +1156,8 @@
CXFA_Node* pDataParent = pDataNode->GetParent();
if (pDataParent != pDataScope) {
ASSERT(pDataParent);
- pDataParent->RemoveChild(pDataNode, true);
- pDataScope->InsertChild(pDataNode, nullptr);
+ pDataParent->RemoveChildAndNotify(pDataNode, true);
+ pDataScope->InsertChildAndNotify(pDataNode, nullptr);
}
}
}
@@ -1642,7 +1642,7 @@
false);
m_pRootNode->GetXMLMappingNode()->AppendChild(pDatasetsXMLNode);
- m_pRootNode->InsertChild(pDatasetsRoot, nullptr);
+ m_pRootNode->InsertChildAndNotify(pDatasetsRoot, nullptr);
pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode);
}
@@ -1685,7 +1685,7 @@
notify_->GetHDOC()->GetXMLDocument()->CreateNode<CFX_XMLElement>(
L"xfa:data");
pDataRoot->SetXMLMappingNode(elem);
- pDatasetsRoot->InsertChild(pDataRoot, nullptr);
+ pDatasetsRoot->InsertChildAndNotify(pDataRoot, nullptr);
}
CXFA_DataGroup* pDataTopLevel =
@@ -1716,7 +1716,7 @@
CreateNode(XFA_PacketType::Form, XFA_Element::Form));
ASSERT(pFormRoot);
pFormRoot->JSObject()->SetCData(XFA_Attribute::Name, L"form", false, false);
- m_pRootNode->InsertChild(pFormRoot, nullptr);
+ m_pRootNode->InsertChildAndNotify(pFormRoot, nullptr);
} else {
CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
sIterator(pFormRoot);
@@ -1745,7 +1745,7 @@
pDataTopLevel->SetXMLMappingNode(elem);
CXFA_Node* pBeforeNode = pDataRoot->GetFirstChild();
- pDataRoot->InsertChild(pDataTopLevel, pBeforeNode);
+ pDataRoot->InsertChildAndNotify(pDataTopLevel, pBeforeNode);
}
ASSERT(pDataTopLevel);
@@ -1771,7 +1771,7 @@
CXFA_PageSet* pNextPageSetNode =
pPageSetNode->GetNextSameClassSibling<CXFA_PageSet>(
XFA_Element::PageSet);
- pSubformSetNode->RemoveChild(pPageSetNode, true);
+ pSubformSetNode->RemoveChildAndNotify(pPageSetNode, true);
pPageSetNode = pNextPageSetNode;
}
@@ -1786,7 +1786,7 @@
if (pNode->IsContainerNode() ||
pNode->GetElementType() == XFA_Element::InstanceManager) {
CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext();
- pNode->GetParent()->RemoveChild(pNode, true);
+ pNode->GetParent()->RemoveChildAndNotify(pNode, true);
pNode = pNext;
} else {
pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
@@ -1804,7 +1804,7 @@
CXFA_Node* pFormRoot = ToNode(GetXFAObject(XFA_HASHCODE_Form));
if (pFormRoot) {
while (CXFA_Node* pNode = pFormRoot->GetFirstChild())
- pFormRoot->RemoveChild(pNode, true);
+ pFormRoot->RemoveChildAndNotify(pNode, true);
pFormRoot->SetBindingNode(nullptr);
}
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index beb99e3..61e14fa 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -294,7 +294,7 @@
pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsChildValue,
false, false);
- pXFANode->InsertChild(pXFAChild, nullptr);
+ pXFANode->InsertChildAndNotify(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLChild);
pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
break;
@@ -387,7 +387,7 @@
pXMLConfigDOMRoot = pChildItem;
pXFAConfigDOMRoot = ParseAsXDPPacket_Config(pXMLConfigDOMRoot);
if (pXFAConfigDOMRoot)
- pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr);
+ pXFARootNode->InsertChildAndNotify(pXFAConfigDOMRoot, nullptr);
}
CFX_XMLNode* pXMLDatasetsDOMRoot = nullptr;
@@ -430,7 +430,7 @@
CXFA_Node* pPacketNode = ParseAsXDPPacket_Template(pElement);
if (pPacketNode) {
pXMLTemplateDOMRoot = pElement;
- pXFARootNode->InsertChild(pPacketNode, nullptr);
+ pXFARootNode->InsertChildAndNotify(pPacketNode, nullptr);
}
} else {
CXFA_Node* pPacketNode = ParseAsXDPPacket(pElement, ePacket);
@@ -441,7 +441,7 @@
FX_HashCode_GetW(packet_info.value().name, false))) {
return nullptr;
}
- pXFARootNode->InsertChild(pPacketNode, nullptr);
+ pXFARootNode->InsertChildAndNotify(pPacketNode, nullptr);
}
}
}
@@ -454,13 +454,13 @@
CXFA_Node* pPacketNode =
ParseAsXDPPacket(pXMLDatasetsDOMRoot, XFA_PacketType::Datasets);
if (pPacketNode)
- pXFARootNode->InsertChild(pPacketNode, nullptr);
+ pXFARootNode->InsertChildAndNotify(pPacketNode, nullptr);
}
if (pXMLFormDOMRoot) {
CXFA_Node* pPacketNode =
ParseAsXDPPacket(pXMLFormDOMRoot, XFA_PacketType::Form);
if (pPacketNode)
- pXFARootNode->InsertChild(pPacketNode, nullptr);
+ pXFARootNode->InsertChildAndNotify(pPacketNode, nullptr);
}
pXFARootNode->SetXMLMappingNode(pXMLDocumentNode);
@@ -710,7 +710,7 @@
pXFAChild->JSObject()->SetAttribute(attr.value().attribute,
it.second.AsStringView(), false);
}
- pXFANode->InsertChild(pXFAChild, nullptr);
+ pXFANode->InsertChildAndNotify(pXFAChild, nullptr);
if (eType == XFA_Element::Validate || eType == XFA_Element::Locale) {
if (ePacketID == XFA_PacketType::Config)
ParseContentNode(pXFAChild, pXMLElement, ePacketID);
@@ -790,7 +790,7 @@
ASSERT(pContentRawDataNode);
pContentRawDataNode->JSObject()->SetCData(XFA_Attribute::Value, wsValue,
false, false);
- pXFANode->InsertChild(pContentRawDataNode, nullptr);
+ pXFANode->InsertChildAndNotify(pContentRawDataNode, nullptr);
} else {
pXFANode->JSObject()->SetCData(XFA_Attribute::Value, wsValue, false,
false);
@@ -886,7 +886,7 @@
false, false);
pXFAMetaData->JSObject()->SetEnum(
XFA_Attribute::Contains, XFA_AttributeValue::MetaData, false);
- pXFAChild->InsertChild(pXFAMetaData, nullptr);
+ pXFAChild->InsertChildAndNotify(pXFAMetaData, nullptr);
pXFAMetaData->SetXMLMappingNode(pXMLElement);
pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized);
}
@@ -894,7 +894,7 @@
if (!bNeedValue)
pXMLElement->RemoveAttribute(L"xsi:nil");
- pXFANode->InsertChild(pXFAChild, nullptr);
+ pXFANode->InsertChildAndNotify(pXFAChild, nullptr);
if (eNodeType == XFA_Element::DataGroup)
ParseDataGroup(pXFAChild, pXMLElement, ePacketID);
else if (bNeedValue)
@@ -918,7 +918,7 @@
pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsText, false,
false);
- pXFANode->InsertChild(pXFAChild, nullptr);
+ pXFANode->InsertChildAndNotify(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLText);
pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
continue;
@@ -970,7 +970,7 @@
false, false);
pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsCurValue, false,
false);
- pXFANode->InsertChild(pXFAChild, nullptr);
+ pXFANode->InsertChildAndNotify(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLCurValueNode);
pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
wsValueTextBuf << wsCurValue;
@@ -987,7 +987,7 @@
pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, wsNodeStr, false,
false);
ParseDataValue(pXFAChild, pXMLChild, ePacketID);
- pXFANode->InsertChild(pXFAChild, nullptr);
+ pXFANode->InsertChildAndNotify(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLChild);
pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
WideString wsCurValue =
@@ -1008,7 +1008,7 @@
false, false);
pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsCurValue, false,
false);
- pXFANode->InsertChild(pXFAChild, nullptr);
+ pXFANode->InsertChildAndNotify(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLCurValueNode);
pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 368da29..496c5db 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -623,8 +623,8 @@
pBeforeNode = pLastNode->GetNextSibling();
}
for (auto* pCurNode : rgNodeArray1) {
- pParentNode->RemoveChild(pCurNode, true);
- pParentNode->InsertChild(pCurNode, pBeforeNode);
+ pParentNode->RemoveChildAndNotify(pCurNode, true);
+ pParentNode->InsertChildAndNotify(pCurNode, pBeforeNode);
}
}
}
@@ -1005,7 +1005,7 @@
if (bRecursive) {
for (CXFA_Node* pChild = GetFirstChild(); pChild;
pChild = pChild->GetNextSibling()) {
- pClone->InsertChild(pChild->Clone(bRecursive), nullptr);
+ pClone->InsertChildAndNotify(pChild->Clone(bRecursive), nullptr);
}
}
pClone->SetFlagAndNotify(XFA_NodeFlag_Initialized);
@@ -1162,7 +1162,7 @@
CXFA_Node* pNewNode =
m_pDocument->CreateNode(GetPacketType(), property.value());
if (pNewNode) {
- InsertChild(pNewNode, nullptr);
+ InsertChildAndNotify(pNewNode, nullptr);
pNewNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
nodes.push_back(pNewNode);
}
@@ -1191,7 +1191,8 @@
if (bRecursive) {
for (CXFA_Node* pChild = GetFirstChild(); pChild;
pChild = pChild->GetNextSibling()) {
- pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive), nullptr);
+ pClone->InsertChildAndNotify(pChild->CloneTemplateToForm(bRecursive),
+ nullptr);
}
}
pClone->SetFlagAndNotify(XFA_NodeFlag_Initialized);
@@ -1504,7 +1505,7 @@
return nullptr;
}
-void CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
+void CXFA_Node::InsertChildAndNotify(int32_t index, CXFA_Node* pNode) {
CHECK(!pNode->GetParent());
pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
@@ -1535,7 +1536,7 @@
xml_node_->InsertChildNode(pNode->xml_node_.Get(), index);
}
-void CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
+void CXFA_Node::InsertChildAndNotify(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
CHECK(!pBeforeNode || pBeforeNode->GetParent() == this);
int32_t index = -1;
@@ -1551,10 +1552,10 @@
++index;
}
}
- InsertChild(index, pNode);
+ InsertChildAndNotify(index, pNode);
}
-void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
+void CXFA_Node::RemoveChildAndNotify(CXFA_Node* pNode, bool bNotify) {
CHECK(pNode);
CHECK_EQ(pNode->GetParent(), this);
@@ -1874,7 +1875,7 @@
CXFA_Node* pNextSibling =
iCount > 0 ? item->GetNextSibling() : GetNextSibling();
- GetParent()->InsertChild(pNewInstance, pNextSibling);
+ GetParent()->InsertChildAndNotify(pNewInstance, pNextSibling);
if (bMoveDataBindingNodes) {
std::set<CXFA_Node*> sNew;
std::set<CXFA_Node*> sAfter;
@@ -1909,7 +1910,7 @@
return;
}
- GetParent()->InsertChild(pNewInstance, pBeforeInstance);
+ GetParent()->InsertChildAndNotify(pNewInstance, pBeforeInstance);
if (bMoveDataBindingNodes) {
std::set<CXFA_Node*> sNew;
std::set<CXFA_Node*> sBefore;
@@ -1942,7 +1943,7 @@
void CXFA_Node::RemoveItem(CXFA_Node* pRemoveInstance,
bool bRemoveDataBinding) {
- GetParent()->RemoveChild(pRemoveInstance, true);
+ GetParent()->RemoveChildAndNotify(pRemoveInstance, true);
if (!bRemoveDataBinding)
return;
@@ -1956,7 +1957,7 @@
if (pDataNode->RemoveBindItem(pFormNode) == 0) {
if (CXFA_Node* pDataParent = pDataNode->GetParent()) {
- pDataParent->RemoveChild(pDataNode, true);
+ pDataParent->RemoveChildAndNotify(pDataNode, true);
}
}
pFormNode->SetBindingNode(nullptr);
@@ -1987,7 +1988,7 @@
pTemplateNode, pFormParent, pDataScope, true, bDataMerge, true);
if (pInstance) {
pDocument->DataMerge_UpdateBindingRelations(pInstance);
- pFormParent->RemoveChild(pInstance, true);
+ pFormParent->RemoveChildAndNotify(pInstance, true);
}
return pInstance;
}
@@ -4415,7 +4416,7 @@
}
while (CXFA_Node* pChildNode = pBind->GetFirstChild())
- pBind->RemoveChild(pChildNode, true);
+ pBind->RemoveChildAndNotify(pChildNode, true);
}
void CXFA_Node::InsertItem(const WideString& wsLabel,
@@ -4434,10 +4435,10 @@
}
if (listitems.empty()) {
CXFA_Node* pItems = CreateSamePacketNode(XFA_Element::Items);
- InsertChild(-1, pItems);
+ InsertChildAndNotify(-1, pItems);
InsertListTextItem(pItems, wsLabel, nIndex);
CXFA_Node* pSaveItems = CreateSamePacketNode(XFA_Element::Items);
- InsertChild(-1, pSaveItems);
+ InsertChildAndNotify(-1, pSaveItems);
pSaveItems->JSObject()->SetBoolean(XFA_Attribute::Save, true, false);
InsertListTextItem(pSaveItems, wsNewValue, nIndex);
} else if (listitems.size() > 1) {
@@ -4455,7 +4456,7 @@
pNode->JSObject()->SetEnum(XFA_Attribute::Presence,
XFA_AttributeValue::Visible, false);
CXFA_Node* pSaveItems = CreateSamePacketNode(XFA_Element::Items);
- InsertChild(-1, pSaveItems);
+ InsertChildAndNotify(-1, pSaveItems);
pSaveItems->JSObject()->SetBoolean(XFA_Attribute::Save, true, false);
pSaveItems->JSObject()->SetEnum(XFA_Attribute::Presence,
XFA_AttributeValue::Hidden, false);
@@ -4569,7 +4570,7 @@
if (nIndex < 0) {
while (CXFA_Node* pNode = pItems->GetFirstChild()) {
- pItems->RemoveChild(pNode, true);
+ pItems->RemoveChildAndNotify(pNode, true);
}
} else {
if (!bSetValue && pItems->JSObject()->GetBoolean(XFA_Attribute::Save)) {
@@ -4580,7 +4581,7 @@
CXFA_Node* pNode = pItems->GetFirstChild();
while (pNode) {
if (i == nIndex) {
- pItems->RemoveChild(pNode, true);
+ pItems->RemoveChildAndNotify(pNode, true);
break;
}
i++;
@@ -4990,7 +4991,7 @@
const WideString& wsText,
int32_t nIndex) {
CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_Element::Text);
- pItems->InsertChild(nIndex, pText);
+ pItems->InsertChildAndNotify(nIndex, pText);
pText->JSObject()->SetContent(wsText, wsText, false, false, false);
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 182bbae..4639e16 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -164,9 +164,9 @@
return static_cast<T*>(GetChildInternal(index, eType, bOnlyChild));
}
- void InsertChild(int32_t index, CXFA_Node* pNode);
- void InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode);
- void RemoveChild(CXFA_Node* pNode, bool bNotify);
+ void InsertChildAndNotify(int32_t index, CXFA_Node* pNode);
+ void InsertChildAndNotify(CXFA_Node* pNode, CXFA_Node* pBeforeNode);
+ void RemoveChildAndNotify(CXFA_Node* pNode, bool bNotify);
CXFA_Node* Clone(bool bRecursive);
diff --git a/xfa/fxfa/parser/cxfa_node_unittest.cpp b/xfa/fxfa/parser/cxfa_node_unittest.cpp
index d302398..3653d51 100644
--- a/xfa/fxfa/parser/cxfa_node_unittest.cpp
+++ b/xfa/fxfa/parser/cxfa_node_unittest.cpp
@@ -54,7 +54,7 @@
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child);
+ GetNode()->InsertChildAndNotify(-1, child);
EXPECT_EQ(GetNode(), child->GetParent());
EXPECT_EQ(child, GetNode()->GetFirstChild());
@@ -66,11 +66,11 @@
TEST_F(CXFANodeTest, InsertChildByNegativeIndex) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child);
+ GetNode()->InsertChildAndNotify(-1, child);
EXPECT_EQ(GetNode(), child->GetParent());
EXPECT_EQ(nullptr, child->GetNextSibling());
@@ -85,23 +85,23 @@
TEST_F(CXFANodeTest, InsertChildByIndex) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child2 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child2);
+ GetNode()->InsertChildAndNotify(-1, child2);
CXFA_Node* child3 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child3);
+ GetNode()->InsertChildAndNotify(-1, child3);
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(2, child);
+ GetNode()->InsertChildAndNotify(2, child);
EXPECT_EQ(GetNode(), child->GetParent());
@@ -123,15 +123,15 @@
TEST_F(CXFANodeTest, InsertChildIndexPastEnd) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(20, child);
+ GetNode()->InsertChildAndNotify(20, child);
EXPECT_EQ(GetNode(), child->GetParent());
EXPECT_EQ(nullptr, child->GetNextSibling());
@@ -148,8 +148,7 @@
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(child, nullptr);
-
+ GetNode()->InsertChildAndNotify(child, nullptr);
EXPECT_EQ(child, GetNode()->GetFirstChild());
EXPECT_EQ(child, GetNode()->GetLastChild());
}
@@ -157,15 +156,15 @@
TEST_F(CXFANodeTest, InsertBeforeWithNullBefore) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(child, nullptr);
+ GetNode()->InsertChildAndNotify(child, nullptr);
EXPECT_EQ(GetNode(), child->GetParent());
EXPECT_EQ(nullptr, child->GetNextSibling());
@@ -179,15 +178,15 @@
TEST_F(CXFANodeTest, InsertBeforeFirstChild) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(child, child0);
+ GetNode()->InsertChildAndNotify(child, child0);
EXPECT_EQ(GetNode(), child->GetParent());
EXPECT_EQ(child0, child->GetNextSibling());
@@ -201,23 +200,23 @@
TEST_F(CXFANodeTest, InsertBefore) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child2 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child2);
+ GetNode()->InsertChildAndNotify(-1, child2);
CXFA_Node* child3 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child3);
+ GetNode()->InsertChildAndNotify(-1, child3);
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(child, child2);
+ GetNode()->InsertChildAndNotify(child, child2);
EXPECT_EQ(GetNode(), child->GetParent());
EXPECT_EQ(child2, child->GetNextSibling());
@@ -232,16 +231,13 @@
TEST_F(CXFANodeTest, RemoveOnlyChild) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
-
+ GetNode()->InsertChildAndNotify(-1, child0);
EXPECT_EQ(child0, GetNode()->GetFirstChild());
EXPECT_EQ(child0, GetNode()->GetLastChild());
- GetNode()->RemoveChild(child0, false);
-
+ GetNode()->RemoveChildAndNotify(child0, false);
EXPECT_EQ(nullptr, GetNode()->GetFirstChild());
EXPECT_EQ(nullptr, GetNode()->GetLastChild());
-
EXPECT_EQ(nullptr, child0->GetParent());
EXPECT_EQ(nullptr, child0->GetNextSibling());
EXPECT_EQ(nullptr, child0->GetPrevSibling());
@@ -250,24 +246,21 @@
TEST_F(CXFANodeTest, RemoveFirstChild) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child2 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child2);
-
+ GetNode()->InsertChildAndNotify(-1, child2);
EXPECT_EQ(child0, GetNode()->GetFirstChild());
EXPECT_EQ(child2, GetNode()->GetLastChild());
- GetNode()->RemoveChild(child0, false);
-
+ GetNode()->RemoveChildAndNotify(child0, false);
EXPECT_EQ(child1, GetNode()->GetFirstChild());
EXPECT_EQ(child2, GetNode()->GetLastChild());
-
EXPECT_EQ(nullptr, child1->GetPrevSibling());
EXPECT_EQ(nullptr, child0->GetParent());
EXPECT_EQ(nullptr, child0->GetNextSibling());
@@ -277,24 +270,21 @@
TEST_F(CXFANodeTest, RemoveLastChild) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child2 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child2);
-
+ GetNode()->InsertChildAndNotify(-1, child2);
EXPECT_EQ(child0, GetNode()->GetFirstChild());
EXPECT_EQ(child2, GetNode()->GetLastChild());
- GetNode()->RemoveChild(child2, false);
-
+ GetNode()->RemoveChildAndNotify(child2, false);
EXPECT_EQ(child0, GetNode()->GetFirstChild());
EXPECT_EQ(child1, GetNode()->GetLastChild());
-
EXPECT_EQ(nullptr, child1->GetNextSibling());
EXPECT_EQ(nullptr, child2->GetParent());
EXPECT_EQ(nullptr, child2->GetNextSibling());
@@ -304,24 +294,21 @@
TEST_F(CXFANodeTest, RemoveChild) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child1);
+ GetNode()->InsertChildAndNotify(-1, child1);
CXFA_Node* child2 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child2);
-
+ GetNode()->InsertChildAndNotify(-1, child2);
EXPECT_EQ(child0, GetNode()->GetFirstChild());
EXPECT_EQ(child2, GetNode()->GetLastChild());
- GetNode()->RemoveChild(child1, false);
-
+ GetNode()->RemoveChildAndNotify(child1, false);
EXPECT_EQ(child0, GetNode()->GetFirstChild());
EXPECT_EQ(child2, GetNode()->GetLastChild());
-
EXPECT_EQ(child2, child0->GetNextSibling());
EXPECT_EQ(child0, child2->GetPrevSibling());
EXPECT_EQ(nullptr, child1->GetParent());
@@ -334,57 +321,60 @@
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- child0->InsertChild(-1, child1);
+ child0->InsertChildAndNotify(-1, child1);
- EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChild(0, child1), "");
+ EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChildAndNotify(0, child1), "");
}
TEST_F(CXFANodeTest, InsertNullChild) {
- EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChild(0, nullptr), "");
+ EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChildAndNotify(0, nullptr), "");
}
TEST_F(CXFANodeTest, InsertBeforeWithNullChild) {
- EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChild(nullptr, nullptr), "");
+ EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChildAndNotify(nullptr, nullptr),
+ "");
}
TEST_F(CXFANodeTest, InsertBeforeWithBeforeInAnotherParent) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- child0->InsertChild(-1, child1);
+ child0->InsertChildAndNotify(-1, child1);
CXFA_Node* child =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChild(child, child1), "");
+ EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChildAndNotify(child, child1), "");
}
TEST_F(CXFANodeTest, InsertBeforeWithNodeInAnotherParent) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- child0->InsertChild(-1, child1);
+ child0->InsertChildAndNotify(-1, child1);
- EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChild(child1, nullptr), "");
+ EXPECT_DEATH_IF_SUPPORTED(GetNode()->InsertChildAndNotify(child1, nullptr),
+ "");
}
TEST_F(CXFANodeTest, RemoveChildNullptr) {
- EXPECT_DEATH_IF_SUPPORTED(GetNode()->RemoveChild(nullptr, false), "");
+ EXPECT_DEATH_IF_SUPPORTED(GetNode()->RemoveChildAndNotify(nullptr, false),
+ "");
}
TEST_F(CXFANodeTest, RemoveChildAnotherParent) {
CXFA_Node* child0 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- GetNode()->InsertChild(-1, child0);
+ GetNode()->InsertChildAndNotify(-1, child0);
CXFA_Node* child1 =
GetDoc()->CreateNode(XFA_PacketType::Form, XFA_Element::Ui);
- child0->InsertChild(-1, child1);
+ child0->InsertChildAndNotify(-1, child1);
- EXPECT_DEATH_IF_SUPPORTED(GetNode()->RemoveChild(child1, false), "");
+ EXPECT_DEATH_IF_SUPPORTED(GetNode()->RemoveChildAndNotify(child1, false), "");
}
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp
index 7d65e0d..7f961f7 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -91,7 +91,7 @@
for (size_t i = 0; i < m_iCreateCount; ++i) {
CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eType);
if (pNewNode) {
- m_pCreateParent->InsertChild(pNewNode, nullptr);
+ m_pCreateParent->InsertChildAndNotify(pNewNode, nullptr);
if (i == m_iCreateCount - 1) {
m_pCreateParent = pNewNode;
}
@@ -109,7 +109,7 @@
pNewNode->JSObject()->SetAttribute(XFA_Attribute::Name, wsNameView,
false);
pNewNode->CreateXMLMappingNode();
- m_pCreateParent->InsertChild(pNewNode, nullptr);
+ m_pCreateParent->InsertChildAndNotify(pNewNode, nullptr);
if (i == m_iCreateCount - 1) {
m_pCreateParent = pNewNode;
}
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 8506e5f..d65b170 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -137,7 +137,7 @@
}
CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_Element::Text);
- pNode->InsertChild(pTextNode, nullptr);
+ pNode->InsertChildAndNotify(pTextNode, nullptr);
pTextNode->JSObject()->SetCData(XFA_Attribute::Name, wsMessageType, false,
false);
pTextNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, true);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 7962916..dfd8cf0 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -55,10 +55,10 @@
}
if (pExistingNode) {
if (pSubformArray) {
- pFormParent->InsertChild(pExistingNode, nullptr);
+ pFormParent->InsertChildAndNotify(pExistingNode, nullptr);
} else if (pExistingNode->IsContainerNode()) {
- pFormParent->RemoveChild(pExistingNode, true);
- pFormParent->InsertChild(pExistingNode, nullptr);
+ pFormParent->RemoveChildAndNotify(pExistingNode, true);
+ pFormParent->InsertChildAndNotify(pExistingNode, nullptr);
}
pExistingNode->ClearFlag(XFA_NodeFlag_UnusedNode);
pExistingNode->SetTemplateNode(pTemplateNode);
@@ -76,13 +76,13 @@
}
CXFA_Node* pNewNode = pTemplateNode->CloneTemplateToForm(false);
- pFormParent->InsertChild(pNewNode, nullptr);
+ pFormParent->InsertChildAndNotify(pNewNode, nullptr);
if (bRecursive) {
for (CXFA_Node* pTemplateChild = pTemplateNode->GetFirstChild();
pTemplateChild; pTemplateChild = pTemplateChild->GetNextSibling()) {
if (XFA_DataMerge_NeedGenerateForm(pTemplateChild, true)) {
CXFA_Node* pNewChild = pTemplateChild->CloneTemplateToForm(true);
- pNewNode->InsertChild(pNewChild, nullptr);
+ pNewNode->InsertChildAndNotify(pNewChild, nullptr);
}
}
}