diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-02 19:40:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-02 19:40:58 +0000 |
commit | eda1761e6a90058a97cee1bcd763a2447eb6a67b (patch) | |
tree | e2ad7c55d46caed4c6338de4794ba5c00b64c21f /xfa/fxfa/parser | |
parent | a6adac83c6aadbacf2a338d2e55148f7d3417762 (diff) | |
download | pdfium-eda1761e6a90058a97cee1bcd763a2447eb6a67b.tar.xz |
Remove default values from Set{UserData|Object} and GetUserData.
This CL removes the default values and inlines at the call sites.
Change-Id: I47ff04a01c30af89949e9c8dd5d51f7ffaef1f98
Reviewed-on: https://pdfium-review.googlesource.com/17610
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_contentlayoutitem.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 23 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutprocessor.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 4 |
6 files changed, 29 insertions, 28 deletions
diff --git a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp index 03c3ebcc84..28871259ce 100644 --- a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp @@ -15,6 +15,6 @@ CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) m_dwStatus(0) {} CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { - if (m_pFormNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY) == this) - m_pFormNode->JSNode()->SetUserData(XFA_LAYOUTITEMKEY, nullptr); + if (m_pFormNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, false) == this) + m_pFormNode->JSNode()->SetUserData(XFA_LAYOUTITEMKEY, nullptr, nullptr); } diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index 428746d3c2..78ac13d816 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -597,8 +597,8 @@ void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { CXFA_ContentLayoutItem* pCurLayoutItem = - (CXFA_ContentLayoutItem*)pNode->JSNode()->GetUserData( - XFA_LAYOUTITEMKEY); + (CXFA_ContentLayoutItem*)pNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, + false); CXFA_ContentLayoutItem* pNextLayoutItem = nullptr; while (pCurLayoutItem) { pNextLayoutItem = pCurLayoutItem->m_pNext; @@ -1142,7 +1142,7 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, m_pFormNode->GetElementType() == XFA_Element::Form)); m_pOldLayoutItem = (CXFA_ContentLayoutItem*)m_pFormNode->JSNode()->GetUserData( - XFA_LAYOUTITEMKEY); + XFA_LAYOUTITEMKEY, false); } CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} @@ -1163,7 +1163,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( ->OnCreateLayoutItem(pFormNode); CXFA_ContentLayoutItem* pPrevLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->JSNode()->GetUserData( - XFA_LAYOUTITEMKEY); + XFA_LAYOUTITEMKEY, false); if (pPrevLayoutItem) { while (pPrevLayoutItem->m_pNext) pPrevLayoutItem = pPrevLayoutItem->m_pNext; @@ -1171,7 +1171,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( pPrevLayoutItem->m_pNext = pLayoutItem; pLayoutItem->m_pPrev = pPrevLayoutItem; } else { - pFormNode->JSNode()->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem); + pFormNode->JSNode()->SetUserData(XFA_LAYOUTITEMKEY, pLayoutItem, nullptr); } return pLayoutItem; } @@ -2090,7 +2090,7 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) { CXFA_Node* pBindNode = pNode->GetBindData(); if (pBindNode) { pBindNode->RemoveBindItem(pNode); - pNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + pNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr, nullptr); } } pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index 568b7ebb19..ce9dbf7de0 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -286,7 +286,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { } m_pPageSetCurRoot = m_pPageSetLayoutItemRoot; m_pTemplatePageSetRoot->JSNode()->SetUserData( - XFA_LAYOUTITEMKEY, (void*)m_pPageSetLayoutItemRoot); + XFA_LAYOUTITEMKEY, (void*)m_pPageSetLayoutItemRoot, nullptr); XFA_ATTRIBUTEENUM eRelation = m_pTemplatePageSetRoot->JSNode()->GetEnum(XFA_ATTRIBUTE_Relation); if (eRelation != XFA_ATTRIBUTEENUM_Unknown) @@ -505,7 +505,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( } else { CXFA_ContainerLayoutItem* pParentLayoutItem = static_cast<CXFA_ContainerLayoutItem*>( - pPageSet->JSNode()->GetUserData(XFA_LAYOUTITEMKEY)); + pPageSet->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, false)); if (!pParentLayoutItem) pParentLayoutItem = m_pPageSetCurRoot; @@ -520,12 +520,12 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( pParentPageSetLayout = static_cast<CXFA_ContainerLayoutItem*>( pPageSet->GetNodeItem(XFA_NODEITEM_Parent) ->JSNode() - ->GetUserData(XFA_LAYOUTITEMKEY)); + ->GetUserData(XFA_LAYOUTITEMKEY, false)); } CXFA_ContainerLayoutItem* pPageSetLayoutItem = new CXFA_ContainerLayoutItem(pPageSet); pPageSet->JSNode()->SetUserData(XFA_LAYOUTITEMKEY, - (void*)pPageSetLayoutItem); + (void*)pPageSetLayoutItem, nullptr); if (!pParentPageSetLayout) { CXFA_ContainerLayoutItem* pPrePageSet = m_pPageSetLayoutItemRoot; while (pPrePageSet->m_pNextSibling) { @@ -549,7 +549,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( CXFA_ContainerLayoutItem* pPageSetLayoutItem = new CXFA_ContainerLayoutItem(pPageSet); pPageSet->JSNode()->SetUserData(XFA_LAYOUTITEMKEY, - (void*)pPageSetLayoutItem); + (void*)pPageSetLayoutItem, nullptr); m_pPageSetLayoutItemRoot->AddChild(pPageSetLayoutItem); pNewRecord->pCurPageSet = pPageSetLayoutItem; } @@ -1698,7 +1698,8 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_Node* pBindNode = pNode->GetBindData(); if (pBindNode) { pBindNode->RemoveBindItem(pNode); - pNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + pNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr, + nullptr); } } pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); @@ -1731,9 +1732,9 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { } } if (pRootPageSetContainerItem->m_pFormNode->JSNode()->GetUserData( - XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { + XFA_LAYOUTITEMKEY, false) == pRootPageSetContainerItem) { pRootPageSetContainerItem->m_pFormNode->JSNode()->SetUserData( - XFA_LAYOUTITEMKEY, nullptr); + XFA_LAYOUTITEMKEY, nullptr, nullptr); } pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); @@ -1781,7 +1782,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { pIter = sIterator.MoveToNext()) { if (pIter->GetElementType() != XFA_Element::ContentArea) { CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( - pIter->JSNode()->GetUserData(XFA_LAYOUTITEMKEY)); + pIter->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, false)); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; @@ -1845,7 +1846,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_Node* pChildNode = iteChild.MoveToNext(); for (; pChildNode; pChildNode = iteChild.MoveToNext()) { CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( - pChildNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY)); + pChildNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, false)); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; @@ -1853,7 +1854,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { } } else if (eType != XFA_Element::ContentArea) { CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( - pNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY)); + pNode->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, false)); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index 53a28f394a..17248c881a 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -123,7 +123,7 @@ CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const { CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { return static_cast<CXFA_LayoutItem*>( - pFormItem->JSNode()->GetUserData(XFA_LAYOUTITEMKEY)); + pFormItem->JSNode()->GetUserData(XFA_LAYOUTITEMKEY, false)); } void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) { diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 1d0b639004..b2677573f5 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -211,7 +211,7 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) { } } pClone->SetFlag(XFA_NodeFlag_Initialized, true); - pClone->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + pClone->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr, nullptr); return pClone; } @@ -405,7 +405,7 @@ int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) { CXFA_Node* pOldFormItem = static_cast<CXFA_Node*>(JSNode()->GetObject(XFA_ATTRIBUTE_BindingNode)); if (!pOldFormItem) { - JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode); + JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode, nullptr); return 1; } if (pOldFormItem == pFormNode) @@ -430,8 +430,8 @@ int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) { *iter = pItems->back(); pItems->pop_back(); if (pItems->size() == 1) { - JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, - (*pItems)[0]); // Invalidates pItems. + JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, (*pItems)[0], + nullptr); // Invalidates pItems. m_uNodeFlags &= ~XFA_NodeFlag_BindFormItems; return 1; } @@ -443,7 +443,7 @@ int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) { if (pOldFormItem != pFormNode) return pOldFormItem ? 1 : 0; - JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr, nullptr); return 0; } @@ -1936,7 +1936,7 @@ void CXFA_Node::RemoveItem(CXFA_Node* pRemoveInstance, pDataParent->RemoveChild(pDataNode); } } - pFormNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + pFormNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr, nullptr); } } diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index c7354a7a63..2ed6c7288a 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -122,7 +122,7 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, void CreateDataBinding(CXFA_Node* pFormNode, CXFA_Node* pDataNode, bool bDataToForm) { - pFormNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, pDataNode); + pFormNode->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, pDataNode, nullptr); pDataNode->AddBindItem(pFormNode); XFA_Element eType = pFormNode->GetElementType(); if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) @@ -1536,7 +1536,7 @@ void CXFA_Document::DoDataRemerge(bool bDoDataMerge) { if (pFormRoot) { while (CXFA_Node* pNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) pFormRoot->RemoveChild(pNode); - pFormRoot->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + pFormRoot->JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr, nullptr); } m_rgGlobalBinding.clear(); if (bDoDataMerge) |