From 2fa6441d686e1205eb25ed2cbfc4cf47d96efec6 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 14 Feb 2018 16:20:01 +0000 Subject: Cleanup CXFA_Node::SetFlag The SetFlag method has a signature of (flag, bool) which, looking at the callsites makes you think it will set the flag to the boolean. This isn't what happens, the flag is always set to true and the boolean decides if we execute some notification code. This CL splits SetFlag into SetFlag(flag) and SetFlagAndNotify(flag) to make it a lot clearer what is happening. Change-Id: I3e067c87532cce10b94bda10cc88feb62b948eb0 Reviewed-on: https://pdfium-review.googlesource.com/26750 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_layoutpagemgr.cpp') 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(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(); } } -- cgit v1.2.3