summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp18
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp32
-rw-r--r--xfa/fxfa/parser/cxfa_node.h3
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp16
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp14
7 files changed, 47 insertions, 40 deletions
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 01ba3205ed..cf6f3ccbc4 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -69,7 +69,7 @@ void MergeNode(CXFA_Document* pDocument,
CXFA_NodeIterator sIterator(pDestNode);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
+ pNode->SetFlag(XFA_NodeFlag_UnusedNode);
}
}
pDestNode->SetTemplateNode(pProtoNode);
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 88dcd1b4ae..d4506c7bb1 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -1552,7 +1552,7 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) {
pNode->SetBindingNode(nullptr);
}
}
- pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
+ pNode->SetFlag(XFA_NodeFlag_UnusedNode);
}
}
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index d6178bfc5e..c6b76b88cc 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -198,7 +198,7 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
}
void SetLayoutGeneratedNodeFlag(CXFA_Node* pNode) {
- pNode->SetFlag(XFA_NodeFlag_LayoutGeneratedNode, false);
+ pNode->SetFlag(XFA_NodeFlag_LayoutGeneratedNode);
pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
}
@@ -337,7 +337,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
return false;
m_pTemplatePageSetRoot->InsertChild(pPageArea, nullptr);
- pPageArea->SetFlag(XFA_NodeFlag_Initialized, true);
+ pPageArea->SetFlagAndNotify(XFA_NodeFlag_Initialized);
}
CXFA_ContentArea* pContentArea =
pPageArea->GetChild<CXFA_ContentArea>(0, XFA_Element::ContentArea, false);
@@ -348,7 +348,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
return false;
pPageArea->InsertChild(pContentArea, nullptr);
- pContentArea->SetFlag(XFA_NodeFlag_Initialized, true);
+ pContentArea->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pContentArea->JSObject()->SetMeasure(
XFA_Attribute::X, CXFA_Measurement(0.25f, XFA_Unit::In), false);
pContentArea->JSObject()->SetMeasure(
@@ -367,7 +367,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
return false;
pPageArea->InsertChild(pMedium, nullptr);
- pMedium->SetFlag(XFA_NodeFlag_Initialized, true);
+ pMedium->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pMedium->JSObject()->SetMeasure(
XFA_Attribute::Short, CXFA_Measurement(8.5f, XFA_Unit::In), false);
pMedium->JSObject()->SetMeasure(
@@ -1641,7 +1641,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
sIterator(pCurLayoutItem->m_pFormNode);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- pNode->SetFlag(XFA_NodeFlag_UnusedNode, false);
+ pNode->SetFlag(XFA_NodeFlag_UnusedNode);
}
}
}
@@ -1701,7 +1701,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pNode->SetBindingNode(nullptr);
}
}
- pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
+ pNode->SetFlag(XFA_NodeFlag_UnusedNode);
}
}
@@ -1824,7 +1824,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pFormToplevelSubform->InsertChild(pPendingPageSet, nullptr);
}
pDocument->DataMerge_UpdateBindingRelations(pPendingPageSet);
- pPendingPageSet->SetFlag(XFA_NodeFlag_Initialized, true);
+ pPendingPageSet->SetFlagAndNotify(XFA_NodeFlag_Initialized);
}
CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode;
@@ -1861,11 +1861,11 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pNode = pNext;
} else {
pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
- pNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pNode = sIterator.MoveToNext();
}
} else {
- pNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pNode = sIterator.MoveToNext();
}
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 58b14cdf8a..46e601d556 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -566,7 +566,7 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
pCloneXML = m_pXMLNode->Clone();
}
pClone->SetXMLMappingNode(pCloneXML.release());
- pClone->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
+ pClone->SetFlag(XFA_NodeFlag_OwnXMLNode);
}
if (bRecursive) {
for (CXFA_Node* pChild = GetFirstChild(); pChild;
@@ -574,7 +574,7 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
pClone->InsertChild(pChild->Clone(bRecursive), nullptr);
}
}
- pClone->SetFlag(XFA_NodeFlag_Initialized, true);
+ pClone->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pClone->SetBindingNode(nullptr);
return pClone;
}
@@ -748,7 +748,7 @@ std::vector<CXFA_Node*> CXFA_Node::GetNodeList(uint32_t dwTypeFilter,
CXFA_Node* pNewNode = m_pDocument->CreateNode(GetPacketType(), *property);
if (pNewNode) {
InsertChild(pNewNode, nullptr);
- pNewNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNewNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
nodes.push_back(pNewNode);
}
return nodes;
@@ -756,7 +756,7 @@ std::vector<CXFA_Node*> CXFA_Node::GetNodeList(uint32_t dwTypeFilter,
CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eType) {
CXFA_Node* pNode = m_pDocument->CreateNode(m_ePacket, eType);
- pNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
return pNode;
}
@@ -776,7 +776,7 @@ CXFA_Node* CXFA_Node::CloneTemplateToForm(bool bRecursive) {
pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive), nullptr);
}
}
- pClone->SetFlag(XFA_NodeFlag_Initialized, true);
+ pClone->SetFlagAndNotify(XFA_NodeFlag_Initialized);
return pClone;
}
@@ -1186,7 +1186,7 @@ void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
PDFIUM_IMMEDIATE_CRASH();
}
- pNode->SetFlag(XFA_NodeFlag_HasRemovedChildren, true);
+ pNode->SetFlag(XFA_NodeFlag_HasRemovedChildren);
if (first_child_ == pNode && last_child_ == pNode) {
first_child_ = nullptr;
@@ -1236,7 +1236,7 @@ void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
} else {
m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode);
}
- pNode->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
+ pNode->SetFlag(XFA_NodeFlag_OwnXMLNode);
}
CXFA_Node* CXFA_Node::GetFirstChildByName(const WideStringView& wsName) const {
@@ -1325,8 +1325,10 @@ bool CXFA_Node::HasFlag(XFA_NodeFlag dwFlag) const {
return false;
}
-void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) {
- if (dwFlag == XFA_NodeFlag_Initialized && bNotify && !IsInitialized()) {
+void CXFA_Node::SetFlagAndNotify(uint32_t dwFlag) {
+ ASSERT(dwFlag == XFA_NodeFlag_Initialized);
+
+ if (!IsInitialized()) {
CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
if (pNotify) {
pNotify->OnNodeReady(this);
@@ -1335,6 +1337,10 @@ void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) {
m_uNodeFlags |= dwFlag;
}
+void CXFA_Node::SetFlag(uint32_t dwFlag) {
+ m_uNodeFlags |= dwFlag;
+}
+
void CXFA_Node::ClearFlag(uint32_t dwFlag) {
m_uNodeFlags &= ~dwFlag;
}
@@ -1372,7 +1378,7 @@ CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() {
if (!m_pXMLNode) {
WideString wsTag(JSObject()->GetCData(XFA_Attribute::Name));
m_pXMLNode = new CFX_XMLElement(wsTag);
- SetFlag(XFA_NodeFlag_OwnXMLNode, false);
+ SetFlag(XFA_NodeFlag_OwnXMLNode);
}
return m_pXMLNode;
}
@@ -2010,7 +2016,7 @@ void CXFA_Node::ProcessScriptTestValidate(CXFA_FFDocView* docView,
}
if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- SetFlag(XFA_NodeFlag_UserInteractive, false);
+ SetFlag(XFA_NodeFlag_UserInteractive);
}
return;
}
@@ -2061,7 +2067,7 @@ int32_t CXFA_Node::ProcessFormatTestValidate(CXFA_FFDocView* docView,
}
if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- SetFlag(XFA_NodeFlag_UserInteractive, false);
+ SetFlag(XFA_NodeFlag_UserInteractive);
}
return XFA_EVENTERROR_Success;
}
@@ -2128,7 +2134,7 @@ int32_t CXFA_Node::ProcessNullTestValidate(CXFA_FFDocView* docView,
}
if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- SetFlag(XFA_NodeFlag_UserInteractive, false);
+ SetFlag(XFA_NodeFlag_UserInteractive);
}
return XFA_EVENTERROR_Error;
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index f5eb2be77e..f34bd9bfba 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -115,7 +115,8 @@ class CXFA_Node : public CXFA_Object {
XFA_PacketType GetPacketType() const { return m_ePacket; }
- void SetFlag(uint32_t dwFlag, bool bNotify);
+ void SetFlag(uint32_t dwFlag);
+ void SetFlagAndNotify(uint32_t dwFlag);
void ClearFlag(uint32_t dwFlag);
CXFA_Node* CreateInstanceIfPossible(bool bDataMerge);
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 42498695e9..7424913114 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -429,7 +429,7 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode,
pXFANode->InsertChild(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLChild);
- pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
+ pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
break;
}
}
@@ -760,7 +760,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
pNode->SetXMLMappingNode(pDataXMLNode);
if (pDataXMLNode != pXMLDocumentNode)
- pNode->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
+ pNode->SetFlag(XFA_NodeFlag_OwnXMLNode);
return pNode;
}
return nullptr;
@@ -1067,7 +1067,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
XFA_AttributeEnum::MetaData, false);
pXFAChild->InsertChild(pXFAMetaData, nullptr);
pXFAMetaData->SetXMLMappingNode(pXMLElement);
- pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized, false);
+ pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized);
}
if (!bNeedValue) {
@@ -1081,7 +1081,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
ParseDataValue(pXFAChild, pXMLChild, XFA_PacketType::Datasets);
pXFAChild->SetXMLMappingNode(pXMLElement);
- pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
+ pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
continue;
}
case FX_XMLNODE_CharData:
@@ -1100,7 +1100,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
false);
pXFANode->InsertChild(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLText);
- pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
+ pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
continue;
}
default:
@@ -1151,7 +1151,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
false, false);
pXFANode->InsertChild(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLCurValueNode);
- pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
+ pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
wsValueTextBuf << wsCurValue;
wsCurValueTextBuf.Clear();
}
@@ -1169,7 +1169,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
ParseDataValue(pXFAChild, pXMLChild, ePacketID);
pXFANode->InsertChild(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLChild);
- pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
+ pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
WideString wsCurValue =
pXFAChild->JSObject()->GetCData(XFA_Attribute::Value);
wsValueTextBuf << wsCurValue;
@@ -1189,7 +1189,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
false);
pXFANode->InsertChild(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLCurValueNode);
- pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
+ pXFAChild->SetFlag(XFA_NodeFlag_Initialized);
}
wsValueTextBuf << wsCurValue;
wsCurValueTextBuf.Clear();
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index b06c9ce549..8ad38afe2d 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -729,7 +729,7 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
pOccurNode->ClearFlag(XFA_NodeFlag_UnusedNode);
}
if (pInstMgrNode) {
- pInstMgrNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pInstMgrNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pSearchArray = &subformArray;
if (pFormParentNode->GetElementType() == XFA_Element::PageArea) {
bOneInstance = true;
@@ -1029,7 +1029,7 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
pDataNode->JSObject()->SetCData(XFA_Attribute::Name, wsName, false, false);
pDataNode->CreateXMLMappingNode();
pDataParent->InsertChild(pDataNode, nullptr);
- pDataNode->SetFlag(XFA_NodeFlag_Initialized, false);
+ pDataNode->SetFlag(XFA_NodeFlag_Initialized);
return pDataNode;
}
@@ -1065,7 +1065,7 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
}
pDataParent->InsertChild(pDataNode, nullptr);
pDataNode->SetDataDescriptionNode(pDDNode);
- pDataNode->SetFlag(XFA_NodeFlag_Initialized, false);
+ pDataNode->SetFlag(XFA_NodeFlag_Initialized);
return pDataNode;
}
return nullptr;
@@ -1285,7 +1285,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(
}
}
}
- pExistingNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pExistingNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
return pExistingNode;
}
@@ -1448,7 +1448,7 @@ void CXFA_Document::DoDataMerge() {
sIterator(pFormRoot);
for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode;
pNode = sIterator.MoveToNext()) {
- pNode->SetFlag(XFA_NodeFlag_UnusedNode, true);
+ pNode->SetFlag(XFA_NodeFlag_UnusedNode);
}
}
@@ -1513,11 +1513,11 @@ void CXFA_Document::DoDataMerge() {
pNode = pNext;
} else {
pNode->ClearFlag(XFA_NodeFlag_UnusedNode);
- pNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pNode = sIterator.MoveToNext();
}
} else {
- pNode->SetFlag(XFA_NodeFlag_Initialized, true);
+ pNode->SetFlagAndNotify(XFA_NodeFlag_Initialized);
pNode = sIterator.MoveToNext();
}
}