From 5dc906eeda8cef7aff368e3c8efed37c0a5b3162 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 8 Jan 2018 10:35:37 -0500 Subject: Make CreateUIChild return the child type This CL removes the out parameter and changes the method to return a std::pair. Change-Id: I3d1e83c387ae338e3f5d23eb8b91b28217235c33 Reviewed-on: https://pdfium-review.googlesource.com/22390 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/cxfa_widgetacc.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 12777b9143..dbd772ea6b 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/cxfa_widgetacc.h" #include +#include #include #include "core/fxcrt/cfx_decimal.h" @@ -209,11 +210,11 @@ bool SplitDateTime(const WideString& wsDateTime, return true; } -CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { +std::pair CreateUIChild(CXFA_Node* pNode) { XFA_Element eType = pNode->GetElementType(); - eWidgetType = eType; + XFA_Element eWidgetType = eType; if (eType != XFA_Element::Field && eType != XFA_Element::Draw) - return nullptr; + return {eWidgetType, nullptr}; eWidgetType = XFA_Element::Unknown; XFA_Element eUIType = XFA_Element::Unknown; @@ -304,11 +305,12 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eUIType = XFA_Element::TextEdit; defValue->JSObject()->GetProperty(0, XFA_Element::Text, true); } - return pUI->JSObject()->GetProperty(0, eUIType, true); + return {eWidgetType, + pUI->JSObject()->GetProperty(0, eUIType, true)}; } if (eUIType != XFA_Element::Unknown) - return pUIChild; + return {eWidgetType, pUIChild}; switch (pUIChild->GetElementType()) { case XFA_Element::CheckButton: { @@ -349,7 +351,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { } defValue->JSObject()->GetProperty(0, eValueType, true); - return pUIChild; + return {eWidgetType, pUIChild}; } } // namespace @@ -1713,7 +1715,7 @@ FX_ARGB CXFA_WidgetAcc::GetTextColor() { CXFA_Node* CXFA_WidgetAcc::GetUIChild() { if (m_eUIType == XFA_Element::Unknown) - m_pUiChildNode = CreateUIChild(m_pNode, m_eUIType); + std::tie(m_eUIType, m_pUiChildNode) = CreateUIChild(m_pNode); return m_pUiChildNode; } -- cgit v1.2.3