From 03f04e276655f744d481295d0cacb6f6d62fcbf2 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 24 Jan 2018 20:06:37 +0000 Subject: Rename eUIType for clarity This CL renames eUIType to make it clear it's the type for the value node we need to create, not the UI node we're creating. Change-Id: I7ffe86b07a2ccf81114e7d1a6a41f520b864a61f Reviewed-on: https://pdfium-review.googlesource.com/23771 Commit-Queue: dsinclair Reviewed-by: Henrique Nakashima --- xfa/fxfa/parser/cxfa_node.cpp | 54 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 1f98a27bfa..f9452c046c 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -2521,7 +2521,7 @@ std::pair CXFA_Node::CreateUIChild() { ASSERT(eType == XFA_Element::Field || eType == XFA_Element::Draw); XFA_Element eWidgetType = XFA_Element::Unknown; - XFA_Element eUIType = XFA_Element::Unknown; + XFA_Element valueNodeType = XFA_Element::Unknown; // Both Field and Draw nodes have a Value child. So, we should either always // have it, or always create it. If we don't get the Value child for some @@ -2536,31 +2536,31 @@ std::pair CXFA_Node::CreateUIChild() { if (child) { switch (child->GetElementType()) { case XFA_Element::Boolean: - eUIType = XFA_Element::CheckButton; + valueNodeType = XFA_Element::CheckButton; break; case XFA_Element::Integer: case XFA_Element::Decimal: case XFA_Element::Float: - eUIType = XFA_Element::NumericEdit; + valueNodeType = XFA_Element::NumericEdit; break; case XFA_Element::ExData: case XFA_Element::Text: - eUIType = XFA_Element::TextEdit; + valueNodeType = XFA_Element::TextEdit; eWidgetType = XFA_Element::Text; break; case XFA_Element::Date: case XFA_Element::Time: case XFA_Element::DateTime: - eUIType = XFA_Element::DateTimeEdit; + valueNodeType = XFA_Element::DateTimeEdit; break; case XFA_Element::Image: - eUIType = XFA_Element::ImageEdit; + valueNodeType = XFA_Element::ImageEdit; eWidgetType = XFA_Element::Image; break; case XFA_Element::Arc: case XFA_Element::Line: case XFA_Element::Rectangle: - eUIType = XFA_Element::DefaultUi; + valueNodeType = XFA_Element::DefaultUi; eWidgetType = child->GetElementType(); break; default: @@ -2586,35 +2586,33 @@ std::pair CXFA_Node::CreateUIChild() { } if (eType == XFA_Element::Draw) { - XFA_Element eDraw = - pUIChild ? pUIChild->GetElementType() : XFA_Element::Unknown; - switch (eDraw) { - case XFA_Element::TextEdit: - eWidgetType = XFA_Element::Text; - break; - case XFA_Element::ImageEdit: - eWidgetType = XFA_Element::Image; - break; - default: - eWidgetType = eWidgetType == XFA_Element::Unknown ? XFA_Element::Text - : eWidgetType; - break; + if (pUIChild && pUIChild->GetElementType() == XFA_Element::TextEdit) { + eWidgetType = XFA_Element::Text; + } else if (pUIChild && + pUIChild->GetElementType() == XFA_Element::ImageEdit) { + eWidgetType = XFA_Element::Image; + } else if (eWidgetType == XFA_Element::Unknown) { + eWidgetType = XFA_Element::Text; } - } else { + } else if (eType == XFA_Element::Field) { if (pUIChild && pUIChild->GetElementType() == XFA_Element::DefaultUi) { eWidgetType = XFA_Element::TextEdit; + } else if (pUIChild) { + eWidgetType = pUIChild->GetElementType(); + } else if (valueNodeType == XFA_Element::Unknown) { + eWidgetType = XFA_Element::TextEdit; } else { - eWidgetType = - pUIChild ? pUIChild->GetElementType() - : (eUIType == XFA_Element::Unknown ? XFA_Element::TextEdit - : eUIType); + eWidgetType = valueNodeType; } + } else { + NOTREACHED(); } if (!pUIChild) { - if (eUIType == XFA_Element::Unknown) - eUIType = XFA_Element::TextEdit; - pUIChild = pUI->JSObject()->GetOrCreateProperty(0, eUIType); + if (valueNodeType == XFA_Element::Unknown) + valueNodeType = XFA_Element::TextEdit; + pUIChild = + pUI->JSObject()->GetOrCreateProperty(0, valueNodeType); } CreateValueNodeIfNeeded(value, pUIChild); -- cgit v1.2.3