summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-04 11:03:26 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-04 16:46:22 +0000
commitd9dfb6cc16f689753e9b3f896fbda1aec791051a (patch)
tree8063ebecea18abc6989cac8b67b0d2fb03a4877a /xfa/fxfa/parser/cxfa_node.cpp
parent8ee5207f4f792295badd21f90727e8c810e7dbdf (diff)
downloadpdfium-d9dfb6cc16f689753e9b3f896fbda1aec791051a.tar.xz
Merge CXFA_WidgetData into CXFA_WidgetAcc
This CL merges the CXFA_WidgetData class into the only subclass, CXFA_WidgetAcc. Code has been updated as needed. Change-Id: I3f5bc83b1422bcbe065276b16bfb91e656f5c174 Reviewed-on: https://pdfium-review.googlesource.com/22252 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.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 9a1dec6716..d7d187d168 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -557,11 +557,11 @@ bool CXFA_Node::HasBindItem() {
return GetPacketType() == XFA_PacketType::Datasets && GetBindingNode();
}
-CXFA_WidgetData* CXFA_Node::GetWidgetData() {
- return JSObject()->GetWidgetData();
+CXFA_WidgetAcc* CXFA_Node::GetWidgetAcc() {
+ return JSObject()->GetWidgetAcc();
}
-CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() {
+CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
if (GetPacketType() != XFA_PacketType::Form)
return nullptr;
XFA_Element eType = GetElementType();
@@ -572,35 +572,34 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() {
return nullptr;
if (eType == XFA_Element::Field) {
- CXFA_WidgetData* pFieldWidgetData = GetWidgetData();
- if (pFieldWidgetData && pFieldWidgetData->IsChoiceListMultiSelect())
+ CXFA_WidgetAcc* pFieldWidgetAcc = GetWidgetAcc();
+ if (pFieldWidgetAcc && pFieldWidgetAcc->IsChoiceListMultiSelect())
return nullptr;
WideString wsPicture;
- if (pFieldWidgetData) {
- wsPicture =
- pFieldWidgetData->GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ if (pFieldWidgetAcc) {
+ wsPicture = pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind);
}
if (!wsPicture.IsEmpty())
- return pFieldWidgetData;
+ return pFieldWidgetAcc;
CXFA_Node* pDataNode = GetBindData();
if (!pDataNode)
return nullptr;
- pFieldWidgetData = nullptr;
+ pFieldWidgetAcc = nullptr;
for (const auto& pFormNode : *(pDataNode->GetBindItems())) {
if (!pFormNode || pFormNode->HasRemovedChildren())
continue;
- pFieldWidgetData = pFormNode->GetWidgetData();
- if (pFieldWidgetData) {
+ pFieldWidgetAcc = pFormNode->GetWidgetAcc();
+ if (pFieldWidgetAcc) {
wsPicture =
- pFieldWidgetData->GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind);
}
if (!wsPicture.IsEmpty())
break;
- pFieldWidgetData = nullptr;
+ pFieldWidgetAcc = nullptr;
}
- return pFieldWidgetData;
+ return pFieldWidgetAcc;
}
CXFA_Node* pGrandNode =
@@ -617,7 +616,7 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() {
}
CXFA_Node* pParentOfValueNode =
pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr;
- return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetData()
+ return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetAcc()
: nullptr;
}
@@ -1539,3 +1538,12 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
if (pParent)
pLayoutPro->AddChangedContainer(pParent);
}
+
+void CXFA_Node::SyncValue(const WideString& wsValue, bool bNotify) {
+ WideString wsFormatValue = wsValue;
+ CXFA_WidgetAcc* pContainerWidgetAcc = GetContainerWidgetAcc();
+ if (pContainerWidgetAcc)
+ wsFormatValue = pContainerWidgetAcc->GetFormatDataValue(wsValue);
+
+ JSObject()->SetContent(wsValue, wsFormatValue, bNotify, false, true);
+}