summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-24 16:01:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-24 16:01:05 +0000
commit73eae271218c69c1b55f4ed8606975e612d30673 (patch)
tree1357c68ffda0bf2e5b3ae39500023b36fafaf87f /xfa/fxfa/parser/cxfa_node.cpp
parent003e96c7c3e15afd2969d33bc91ca459bb73a3b5 (diff)
downloadpdfium-73eae271218c69c1b55f4ed8606975e612d30673.tar.xz
Clarify CreateUIChild is only for Field or Draw elements
This CL changes the code to only call CreateUIChild for Field and Draw elements. Other types are handled all the callsite. Change-Id: I2dd2553c14ebc1f0849b3bfd311e75ad8922aa0d Reviewed-on: https://pdfium-review.googlesource.com/23670 Reviewed-by: Ryan Harrison <rharrison@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.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 58d751e8e3..9ceedcc41e 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -457,11 +457,9 @@ void ReorderDataNodes(const std::set<CXFA_Node*>& sSet1,
std::pair<XFA_Element, CXFA_Node*> CreateUIChild(CXFA_Node* pNode) {
XFA_Element eType = pNode->GetElementType();
- XFA_Element eWidgetType = eType;
- if (eType != XFA_Element::Field && eType != XFA_Element::Draw)
- return {eWidgetType, nullptr};
+ ASSERT(eType == XFA_Element::Field || eType == XFA_Element::Draw);
- eWidgetType = XFA_Element::Unknown;
+ XFA_Element eWidgetType = XFA_Element::Unknown;
XFA_Element eUIType = XFA_Element::Unknown;
auto* defValue =
pNode->JSObject()->GetOrCreateProperty<CXFA_Value>(0, XFA_Element::Value);
@@ -2666,8 +2664,16 @@ Optional<int8_t> CXFA_Node::GetBarcodeAttribute_WideNarrowRatio() {
}
CXFA_Node* CXFA_Node::GetUIChild() {
- if (m_eUIType == XFA_Element::Unknown)
+ if (m_eUIType != XFA_Element::Unknown)
+ return m_pUiChildNode;
+
+ XFA_Element type = GetElementType();
+ if (type == XFA_Element::Field || type == XFA_Element::Draw) {
std::tie(m_eUIType, m_pUiChildNode) = CreateUIChild(this);
+ } else {
+ m_eUIType = GetElementType();
+ m_pUiChildNode = nullptr;
+ }
return m_pUiChildNode;
}