summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-08 10:35:37 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-08 15:49:31 +0000
commit5dc906eeda8cef7aff368e3c8efed37c0a5b3162 (patch)
treeb88b497f4da907ccc6d59667e2b8301ffc1e3a40
parentde8be21859ce52b5f9b4d9e33687c42c9ea79fb1 (diff)
downloadpdfium-5dc906eeda8cef7aff368e3c8efed37c0a5b3162.tar.xz
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 <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp16
1 files changed, 9 insertions, 7 deletions
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 <algorithm>
+#include <tuple>
#include <vector>
#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<XFA_Element, CXFA_Node*> 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<CXFA_Text>(0, XFA_Element::Text, true);
}
- return pUI->JSObject()->GetProperty<CXFA_Node>(0, eUIType, true);
+ return {eWidgetType,
+ pUI->JSObject()->GetProperty<CXFA_Node>(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<CXFA_Node>(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;
}