diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-29 19:52:07 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-29 19:52:07 +0000 |
commit | 5e332f1275dd6f4b6d487d313f4db8497df339ab (patch) | |
tree | f15dbf8d89ed59808c7ff21ef8685ea8d1e65797 /xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | |
parent | d6e92bd6e874a4709144effc79163ef3c13d4b2e (diff) | |
download | pdfium-5e332f1275dd6f4b6d487d313f4db8497df339ab.tar.xz |
Cleanup the FFWidget determination code.
This CL converts the UIType to an XFA_FFWidgetType instead of reusing
the XFA_Element type. The creation code is cleaned up to make it clearer
what's happening.
Change-Id: I5d3e4967d5c8b8a50dbb25e574b0d31fe0cf407a
Reviewed-on: https://pdfium-review.googlesource.com/24390
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/xfa_document_datamerger_imp.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 7875ff89d1..5b098cce42 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -71,8 +71,8 @@ CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) { void FormValueNode_MatchNoneCreateChild(CXFA_Node* pFormNode) { ASSERT(pFormNode->IsWidgetReady()); - // GetUIChild has the side effect of creating the UI child. - pFormNode->GetUIChild(); + // GetUIChildNode has the side effect of creating the UI child. + pFormNode->GetUIChildNode(); } bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, @@ -137,8 +137,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, 0, XFA_Element::Value); if (!bDataToForm) { WideString wsValue; - switch (pFormNode->GetUIType()) { - case XFA_Element::ImageEdit: { + switch (pFormNode->GetFFWidgetType()) { + case XFA_FFWidgetType::kImageEdit: { CXFA_Image* image = defValue ? defValue->GetImageIfExists() : nullptr; WideString wsContentType; WideString wsHref; @@ -160,7 +160,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; } - case XFA_Element::ChoiceList: + case XFA_FFWidgetType::kChoiceList: wsValue = defValue ? defValue->GetChildValueContent() : L""; if (pFormNode->IsChoiceListMultiSelect()) { std::vector<WideString> wsSelTextArray = @@ -187,7 +187,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, wsValue, pFormNode->GetFormatDataValue(wsValue), false, false); } break; - case XFA_Element::CheckButton: + case XFA_FFWidgetType::kCheckButton: wsValue = defValue ? defValue->GetChildValueContent() : L""; if (wsValue.IsEmpty()) break; @@ -195,7 +195,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, pDataNode->JSObject()->SetAttributeValue( wsValue, pFormNode->GetFormatDataValue(wsValue), false, false); break; - case XFA_Element::ExclGroup: { + case XFA_FFWidgetType::kExclGroup: { CXFA_Node* pChecked = nullptr; CXFA_Node* pChild = pFormNode->GetFirstChild(); for (; pChild; pChild = pChild->GetNextSibling()) { @@ -257,7 +257,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, } break; } - case XFA_Element::NumericEdit: { + case XFA_FFWidgetType::kNumericEdit: { wsValue = defValue ? defValue->GetChildValueContent() : L""; if (wsValue.IsEmpty()) break; @@ -288,8 +288,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, pDataNode->JSObject()->SetAttributeValue(wsNormalizeValue, wsXMLValue, false, false); - switch (pFormNode->GetUIType()) { - case XFA_Element::ImageEdit: { + switch (pFormNode->GetFFWidgetType()) { + case XFA_FFWidgetType::kImageEdit: { FormValueNode_SetChildContent(defValue, wsNormalizeValue, XFA_Element::Image); CXFA_Image* image = defValue ? defValue->GetImageIfExists() : nullptr; @@ -312,7 +312,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, } break; } - case XFA_Element::ChoiceList: + case XFA_FFWidgetType::kChoiceList: if (pFormNode->IsChoiceListMultiSelect()) { std::vector<CXFA_Node*> items = pDataNode->GetNodeList( XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties, @@ -341,20 +341,16 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element::Text); } break; - case XFA_Element::CheckButton: - FormValueNode_SetChildContent(defValue, wsNormalizeValue, - XFA_Element::Text); - break; - case XFA_Element::ExclGroup: { + case XFA_FFWidgetType::kExclGroup: { pFormNode->SetSelectedMemberByValue(wsNormalizeValue.AsStringView(), false, false, false); break; } - case XFA_Element::DateTimeEdit: + case XFA_FFWidgetType::kDateTimeEdit: FormValueNode_SetChildContent(defValue, wsNormalizeValue, XFA_Element::DateTime); break; - case XFA_Element::NumericEdit: { + case XFA_FFWidgetType::kNumericEdit: { WideString wsPicture = pFormNode->GetPictureContent(XFA_VALUEPICTURE_DataBind); if (wsPicture.IsEmpty()) @@ -364,11 +360,6 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element::Float); break; } - case XFA_Element::Barcode: - case XFA_Element::Button: - case XFA_Element::PasswordEdit: - case XFA_Element::Signature: - case XFA_Element::TextEdit: default: FormValueNode_SetChildContent(defValue, wsNormalizeValue, XFA_Element::Text); |