summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_object.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-14 19:48:44 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-14 19:48:44 +0000
commitdcbb8e53e604178dc97d12846ddbdef88be41297 (patch)
treedc58158143f2a6a590007dfe137e7053b25357e5 /fxjs/xfa/cjx_object.cpp
parentfe9d640ea90cfccac39b6475dad9df62072542fc (diff)
downloadpdfium-dcbb8e53e604178dc97d12846ddbdef88be41297.tar.xz
Fold CXFA_ValidateData into CXFA_Validate
The ValidateData class is a thin wrapper around the Validate class. Now that the Validate class exists we can fold the methods from ValidateData into Validate. Change-Id: I1e72f4b7bddeb22a311f4fe9a5940204221b6d2a Reviewed-on: https://pdfium-review.googlesource.com/21150 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_object.cpp')
-rw-r--r--fxjs/xfa/cjx_object.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index c1503af22d..77de53ec64 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -27,6 +27,7 @@
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_object.h"
#include "xfa/fxfa/parser/cxfa_occurdata.h"
+#include "xfa/fxfa/parser/cxfa_validate.h"
#include "xfa/fxfa/parser/xfa_utils.h"
namespace {
@@ -1403,31 +1404,31 @@ void CJX_Object::Script_Som_Message(CFXJSE_Value* pValue,
return;
bool bNew = false;
- CXFA_ValidateData validateData = widget_data_->GetValidateData(false);
- if (!validateData.HasValidNode()) {
- validateData = widget_data_->GetValidateData(true);
+ CXFA_Validate* validate = widget_data_->GetValidate(false);
+ if (!validate) {
+ validate = widget_data_->GetValidate(true);
bNew = true;
}
if (bSetting) {
switch (iMessageType) {
case XFA_SOM_ValidationMessage:
- validateData.SetScriptMessageText(pValue->ToWideString());
+ validate->SetScriptMessageText(pValue->ToWideString());
break;
case XFA_SOM_FormatMessage:
- validateData.SetFormatMessageText(pValue->ToWideString());
+ validate->SetFormatMessageText(pValue->ToWideString());
break;
case XFA_SOM_MandatoryMessage:
- validateData.SetNullMessageText(pValue->ToWideString());
+ validate->SetNullMessageText(pValue->ToWideString());
break;
default:
break;
}
if (!bNew) {
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
- if (!pNotify) {
+ if (!pNotify)
return;
- }
+
pNotify->AddCalcValidate(ToNode(GetXFAObject()));
}
return;
@@ -1436,13 +1437,13 @@ void CJX_Object::Script_Som_Message(CFXJSE_Value* pValue,
WideString wsMessage;
switch (iMessageType) {
case XFA_SOM_ValidationMessage:
- wsMessage = validateData.GetScriptMessageText();
+ wsMessage = validate->GetScriptMessageText();
break;
case XFA_SOM_FormatMessage:
- wsMessage = validateData.GetFormatMessageText();
+ wsMessage = validate->GetFormatMessageText();
break;
case XFA_SOM_MandatoryMessage:
- wsMessage = validateData.GetNullMessageText();
+ wsMessage = validate->GetNullMessageText();
break;
default:
break;
@@ -1589,13 +1590,16 @@ void CJX_Object::Script_Som_Mandatory(CFXJSE_Value* pValue,
if (!widget_data_)
return;
- CXFA_ValidateData validateData = widget_data_->GetValidateData(true);
+ CXFA_Validate* validate = widget_data_->GetValidate(true);
+ if (!validate)
+ return;
+
if (bSetting) {
- validateData.SetNullTest(pValue->ToWideString());
+ validate->SetNullTest(pValue->ToWideString());
return;
}
- WideString str = CXFA_Node::AttributeEnumToName(validateData.GetNullTest());
+ WideString str = CXFA_Node::AttributeEnumToName(validate->GetNullTest());
pValue->SetString(str.UTF8Encode().AsStringView());
}