summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-22 20:38:27 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-22 20:38:27 +0000
commitec06e1186d0dc1b5bcac6a0d73c5d51e8a4682df (patch)
tree02de96ff9e65a8d13e1d9f18579d313cf2604586
parent6221f22c79a532f7dd422cc51afb91cb35bc349d (diff)
downloadpdfium-ec06e1186d0dc1b5bcac6a0d73c5d51e8a4682df.tar.xz
Change GetContainerWidgetAcc to GetContainerNode
This Cl converts the code which retrieved the containers WidgetAcc to retrieve the container itself and then get the WidgetAcc from the container. Change-Id: Ib279a150500d1204e3d18f11f6a638c1f6c368ec Reviewed-on: https://pdfium-review.googlesource.com/23350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--fxjs/xfa/cjx_boolean.cpp9
-rw-r--r--fxjs/xfa/cjx_field.cpp8
-rw-r--r--fxjs/xfa/cjx_object.cpp25
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp15
-rw-r--r--xfa/fxfa/parser/cxfa_node.h2
5 files changed, 31 insertions, 28 deletions
diff --git a/fxjs/xfa/cjx_boolean.cpp b/fxjs/xfa/cjx_boolean.cpp
index 761d0a2be9..6f62fcbe31 100644
--- a/fxjs/xfa/cjx_boolean.cpp
+++ b/fxjs/xfa/cjx_boolean.cpp
@@ -36,10 +36,11 @@ void CJX_Boolean::defaultValue(CFXJSE_Value* pValue,
int32_t iValue = FXSYS_atoi(newValue.c_str());
WideString wsNewValue(iValue == 0 ? L"0" : L"1");
WideString wsFormatValue(wsNewValue);
- CXFA_WidgetAcc* pContainerWidgetAcc =
- ToNode(GetXFAObject())->GetContainerWidgetAcc();
- if (pContainerWidgetAcc)
- wsFormatValue = pContainerWidgetAcc->GetFormatDataValue(wsNewValue);
+ CXFA_Node* pContainerNode = ToNode(GetXFAObject())->GetContainerNode();
+ if (pContainerNode && pContainerNode->GetWidgetAcc()) {
+ wsFormatValue =
+ pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewValue);
+ }
SetContent(wsNewValue, wsFormatValue, true, true, true);
}
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index 828bfb9a0d..e1e3881aa1 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -261,10 +261,12 @@ void CJX_Field::defaultValue(CFXJSE_Value* pValue,
wsNewText, pWidgetAcc->GetLeadDigits(), pWidgetAcc->GetFracDigits());
}
- CXFA_WidgetAcc* pContainerWidgetAcc = xfaNode->GetContainerWidgetAcc();
+ CXFA_Node* pContainerNode = xfaNode->GetContainerNode();
WideString wsFormatText(wsNewText);
- if (pContainerWidgetAcc)
- wsFormatText = pContainerWidgetAcc->GetFormatDataValue(wsNewText);
+ if (pContainerNode && pContainerNode->GetWidgetAcc()) {
+ wsFormatText =
+ pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewText);
+ }
SetContent(wsNewText, wsFormatText, true, true, true);
return;
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 4f3b6adbc8..73ec3fa5c0 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -1158,9 +1158,9 @@ void CJX_Object::MoveBufferMapData(CXFA_Object* pDstModule) {
WideString wsValue = ToNode(pDstModule)->JSObject()->GetContent(false);
WideString wsFormatValue(wsValue);
- CXFA_WidgetAcc* pWidgetAcc = ToNode(pDstModule)->GetContainerWidgetAcc();
- if (pWidgetAcc)
- wsFormatValue = pWidgetAcc->GetFormatDataValue(wsValue);
+ CXFA_Node* pNode = ToNode(pDstModule)->GetContainerNode();
+ if (pNode && pNode->GetWidgetAcc())
+ wsFormatValue = pNode->GetWidgetAcc()->GetFormatDataValue(wsValue);
ToNode(pDstModule)
->JSObject()
@@ -1516,30 +1516,31 @@ void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue,
wsNewValue = pValue->ToWideString();
WideString wsFormatValue(wsNewValue);
- CXFA_WidgetAcc* pContainerWidgetAcc = nullptr;
+ CXFA_Node* pContainerNode = nullptr;
if (ToNode(GetXFAObject())->GetPacketType() == XFA_PacketType::Datasets) {
WideString wsPicture;
for (const auto& pFormNode : *(ToNode(GetXFAObject())->GetBindItems())) {
if (!pFormNode || pFormNode->HasRemovedChildren())
continue;
- pContainerWidgetAcc = pFormNode->GetContainerWidgetAcc();
- if (pContainerWidgetAcc) {
- wsPicture =
- pContainerWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind);
+ pContainerNode = pFormNode->GetContainerNode();
+ if (pContainerNode && pContainerNode->GetWidgetAcc()) {
+ wsPicture = pContainerNode->GetWidgetAcc()->GetPictureContent(
+ XFA_VALUEPICTURE_DataBind);
}
if (!wsPicture.IsEmpty())
break;
- pContainerWidgetAcc = nullptr;
+ pContainerNode = nullptr;
}
} else if (ToNode(GetXFAObject())->GetPacketType() ==
XFA_PacketType::Form) {
- pContainerWidgetAcc = ToNode(GetXFAObject())->GetContainerWidgetAcc();
+ pContainerNode = ToNode(GetXFAObject())->GetContainerNode();
}
- if (pContainerWidgetAcc)
- wsFormatValue = pContainerWidgetAcc->GetFormatDataValue(wsNewValue);
+ if (pContainerNode && pContainerNode->GetWidgetAcc())
+ wsFormatValue =
+ pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsNewValue);
SetContent(wsNewValue, wsFormatValue, true, true, true);
return;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 90103673cd..026e013dae 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -724,7 +724,7 @@ bool CXFA_Node::HasBindItem() {
return GetPacketType() == XFA_PacketType::Datasets && GetBindingNode();
}
-CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
+CXFA_Node* CXFA_Node::GetContainerNode() {
if (GetPacketType() != XFA_PacketType::Form)
return nullptr;
XFA_Element eType = GetElementType();
@@ -744,7 +744,7 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
wsPicture = pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind);
}
if (!wsPicture.IsEmpty())
- return pFieldWidgetAcc;
+ return this;
CXFA_Node* pDataNode = GetBindData();
if (!pDataNode)
@@ -763,7 +763,7 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
break;
pFieldWidgetAcc = nullptr;
}
- return pFieldWidgetAcc;
+ return pFieldWidgetAcc ? pFieldWidgetAcc->GetNode() : nullptr;
}
CXFA_Node* pGrandNode = pParentNode ? pParentNode->GetParent() : nullptr;
@@ -779,8 +779,7 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() {
}
CXFA_Node* pParentOfValueNode =
pValueNode ? pValueNode->GetParent() : nullptr;
- return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetAcc()
- : nullptr;
+ return pParentOfValueNode ? pParentOfValueNode->GetContainerNode() : nullptr;
}
IFX_Locale* CXFA_Node::GetLocale() {
@@ -1695,9 +1694,9 @@ void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
void CXFA_Node::SyncValue(const WideString& wsValue, bool bNotify) {
WideString wsFormatValue = wsValue;
- CXFA_WidgetAcc* pContainerWidgetAcc = GetContainerWidgetAcc();
- if (pContainerWidgetAcc)
- wsFormatValue = pContainerWidgetAcc->GetFormatDataValue(wsValue);
+ CXFA_Node* pContainerNode = GetContainerNode();
+ if (pContainerNode && pContainerNode->GetWidgetAcc())
+ wsFormatValue = pContainerNode->GetWidgetAcc()->GetFormatDataValue(wsValue);
JSObject()->SetContent(wsValue, wsFormatValue, bNotify, false, true);
}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index fa455ba21b..9cda17c527 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -194,7 +194,7 @@ class CXFA_Node : public CXFA_Object {
int32_t AddBindItem(CXFA_Node* pFormNode);
int32_t RemoveBindItem(CXFA_Node* pFormNode);
bool HasBindItem();
- CXFA_WidgetAcc* GetContainerWidgetAcc();
+ CXFA_Node* GetContainerNode();
IFX_Locale* GetLocale();
Optional<WideString> GetLocaleName();
XFA_AttributeEnum GetIntact();