summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-24 20:08:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-24 20:08:18 +0000
commitd4ae37be89d348ee6668884b71b1a2d1147e574c (patch)
treef64d5e71866cca5e494293b63ea58a21b069c442 /xfa/fxfa/parser/cxfa_node.cpp
parent03f04e276655f744d481295d0cacb6f6d62fcbf2 (diff)
downloadpdfium-d4ae37be89d348ee6668884b71b1a2d1147e574c.tar.xz
Move retrieval of UIChild earlier in CreateUIChild
This CL shifts the retrieval of the UI child earlier in the method so we can group all of the code which sets the widget type. Change-Id: Iabdbd7ae2e6d3f648ce78e93c263be66f62946ba Reviewed-on: https://pdfium-review.googlesource.com/23790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index f9452c046c..9312b6dc2b 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -2520,6 +2520,22 @@ std::pair<XFA_Element, CXFA_Node*> CXFA_Node::CreateUIChild() {
XFA_Element eType = GetElementType();
ASSERT(eType == XFA_Element::Field || eType == XFA_Element::Draw);
+ // Both Field and Draw have a UI property. We should always be able to
+ // retrieve or create the UI element. If we can't something is wrong.
+ CXFA_Ui* pUI = JSObject()->GetOrCreateProperty<CXFA_Ui>(0, XFA_Element::Ui);
+ ASSERT(pUI);
+
+ CXFA_Node* pUIChild = nullptr;
+ // Search through the children of the UI node to see if we have any of our
+ // One-Of entries. If so, that is the node associated with our UI.
+ for (CXFA_Node* pChild = pUI->GetFirstChild(); pChild;
+ pChild = pChild->GetNextSibling()) {
+ if (pUI->IsAOneOfChild(pChild)) {
+ pUIChild = pChild;
+ break;
+ }
+ }
+
XFA_Element eWidgetType = XFA_Element::Unknown;
XFA_Element valueNodeType = XFA_Element::Unknown;
@@ -2569,22 +2585,6 @@ std::pair<XFA_Element, CXFA_Node*> CXFA_Node::CreateUIChild() {
}
}
- // Both Field and Draw have a UI property. We should always be able to
- // retrieve or create the UI element. If we can't something is wrong.
- CXFA_Ui* pUI = JSObject()->GetOrCreateProperty<CXFA_Ui>(0, XFA_Element::Ui);
- ASSERT(pUI);
-
- CXFA_Node* pUIChild = nullptr;
- // Search through the children of the UI node to see if we have any of our
- // One-Of entries. If so, that is the node associated with our UI.
- for (CXFA_Node* pChild = pUI->GetFirstChild(); pChild;
- pChild = pChild->GetNextSibling()) {
- if (pUI->IsAOneOfChild(pChild)) {
- pUIChild = pChild;
- break;
- }
- }
-
if (eType == XFA_Element::Draw) {
if (pUIChild && pUIChild->GetElementType() == XFA_Element::TextEdit) {
eWidgetType = XFA_Element::Text;