diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-10 16:28:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-10 16:28:57 +0000 |
commit | 640d8ffad8536c789103892c7a4e69e5d30172c8 (patch) | |
tree | ebd3f4013383a2319c95d29a10097f4bdb28ea30 /xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | |
parent | 594b3eeeaa61a2c0a6d84df3e17ea587f3b15c23 (diff) | |
download | pdfium-640d8ffad8536c789103892c7a4e69e5d30172c8.tar.xz |
Make methods which create nodes more obvious
This CL converts the various methods Get methods which take a boolean
value to explicit Get* and GetOrCreate* methods to make the usage
clearer.
Change-Id: I2af68448b1b69b95713e739bf7fe14a4336d2b65
Reviewed-on: https://pdfium-review.googlesource.com/22590
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/xfa_document_datamerger_imp.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 192a7f2fe5..c8de462e0a 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -61,7 +61,9 @@ CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) { if (!pChildNode) { if (iType == XFA_Element::Unknown) return nullptr; - pChildNode = pValueNode->JSObject()->GetProperty<CXFA_Node>(0, iType, true); + + pChildNode = + pValueNode->JSObject()->GetOrCreateProperty<CXFA_Node>(0, iType); } return pChildNode; } @@ -133,8 +135,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, CXFA_WidgetAcc* pWidgetAcc = pFormNode->GetWidgetAcc(); ASSERT(pWidgetAcc); XFA_Element eUIType = pWidgetAcc->GetUIType(); - auto* defValue = pFormNode->JSObject()->GetProperty<CXFA_Value>( - 0, XFA_Element::Value, true); + auto* defValue = pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>( + 0, XFA_Element::Value); if (!bDataToForm) { WideString wsValue; switch (eUIType) { @@ -240,8 +242,9 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (pChild->GetElementType() != XFA_Element::Field) continue; - CXFA_Value* pValue = pChild->JSObject()->GetProperty<CXFA_Value>( - 0, XFA_Element::Value, true); + CXFA_Value* pValue = + pChild->JSObject()->GetOrCreateProperty<CXFA_Value>( + 0, XFA_Element::Value); CXFA_Items* pItems = pChild->GetChild<CXFA_Items>(0, XFA_Element::Items, false); CXFA_Node* pText = @@ -265,8 +268,9 @@ void CreateDataBinding(CXFA_Node* pFormNode, wsValue = pWidgetAcc->NormalizeNumStr(wsValue); pDataNode->JSObject()->SetAttributeValue( wsValue, pWidgetAcc->GetFormatDataValue(wsValue), false, false); - CXFA_Value* pValue = pFormNode->JSObject()->GetProperty<CXFA_Value>( - 0, XFA_Element::Value, true); + CXFA_Value* pValue = + pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>( + 0, XFA_Element::Value); FormValueNode_SetChildContent(pValue, wsValue, XFA_Element::Float); break; } |