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 --- fxjs/xfa/cjx_node.cpp | 10 +++++----- fxjs/xfa/cjx_object.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'fxjs/xfa') diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index d3a9bf17c1..9b5d4044ea 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -274,7 +274,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, CXFA_Node* pItem = pNewChild->GetNextSibling(); pFakeRoot->RemoveChild(pNewChild, true); GetXFANode()->InsertChild(index++, pNewChild); - pNewChild->SetFlag(XFA_NodeFlag_Initialized, true); + pNewChild->SetFlagAndNotify(XFA_NodeFlag_Initialized); pNewChild = pItem; } @@ -289,7 +289,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, GetXFANode()->GetElementType() == XFA_Element::ExData) { CFX_XMLNode* pTempXMLNode = GetXFANode()->GetXMLMappingNode(); GetXFANode()->SetXMLMappingNode(pFakeXMLRoot.release()); - GetXFANode()->SetFlag(XFA_NodeFlag_OwnXMLNode, false); + GetXFANode()->SetFlag(XFA_NodeFlag_OwnXMLNode); if (pTempXMLNode && !pTempXMLNode->GetParent()) pFakeXMLRoot.reset(pTempXMLNode); else @@ -302,16 +302,16 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, CXFA_Node* pItem = pChild->GetNextSibling(); pFakeRoot->RemoveChild(pChild, true); GetXFANode()->InsertChild(pChild, nullptr); - pChild->SetFlag(XFA_NodeFlag_Initialized, true); + pChild->SetFlagAndNotify(XFA_NodeFlag_Initialized); pChild = pItem; } } if (pFakeXMLRoot) { pFakeRoot->SetXMLMappingNode(pFakeXMLRoot.release()); - pFakeRoot->SetFlag(XFA_NodeFlag_OwnXMLNode, false); + pFakeRoot->SetFlag(XFA_NodeFlag_OwnXMLNode); } - pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren, false); + pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren); return CJS_Return(true); } diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index 50643ffc5b..3f6903557c 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -942,7 +942,7 @@ CXFA_Node* CJX_Object::GetOrCreatePropertyInternal(int32_t index, return nullptr; xfaNode->InsertChild(pNewNode, nullptr); - pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); + pNewNode->SetFlagAndNotify(XFA_NodeFlag_Initialized); } return pNewNode; } -- cgit v1.2.3