summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_object.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-08 15:12:10 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-08 20:34:05 +0000
commit94fc2af0c9a800f39e4dbcac859f1ad490f7d725 (patch)
tree3543b5cd38104b00027adde5a8bfe1f5152360c1 /fxjs/xfa/cjx_object.cpp
parent625de446907e8720f0114422683b78a898dd6878 (diff)
downloadpdfium-94fc2af0c9a800f39e4dbcac859f1ad490f7d725.tar.xz
Move CXFA_WidgetAcc from CJX_Object to CXFA_Object
This CL change the CJX code to not store the pointer to the CXFA_WidgetAcc. If needed the CJX object gets the Acc from the Node itself. Change-Id: I5a5a500b8fbc1749d362346d72678acd5250d112 Reviewed-on: https://pdfium-review.googlesource.com/22411 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.cpp37
1 files changed, 10 insertions, 27 deletions
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index de747f4419..0528bd5edd 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -1304,10 +1304,7 @@ void CJX_Object::Script_Attribute_Integer(CFXJSE_Value* pValue,
void CJX_Object::Script_Som_FontColor(CFXJSE_Value* pValue,
bool bSetting,
XFA_Attribute eAttribute) {
- if (!widget_data_)
- return;
-
- CXFA_Font* font = widget_data_->GetNode()->GetFont(true);
+ CXFA_Font* font = ToNode(object_.Get())->GetFont(true);
if (!font)
return;
@@ -1332,10 +1329,7 @@ void CJX_Object::Script_Som_FontColor(CFXJSE_Value* pValue,
void CJX_Object::Script_Som_FillColor(CFXJSE_Value* pValue,
bool bSetting,
XFA_Attribute eAttribute) {
- if (!widget_data_)
- return;
-
- CXFA_Border* border = widget_data_->GetNode()->GetBorder(true);
+ CXFA_Border* border = ToNode(object_.Get())->GetBorder(true);
CXFA_Fill* borderfill = border->GetFill(true);
if (!borderfill)
return;
@@ -1363,10 +1357,7 @@ void CJX_Object::Script_Som_FillColor(CFXJSE_Value* pValue,
void CJX_Object::Script_Som_BorderColor(CFXJSE_Value* pValue,
bool bSetting,
XFA_Attribute eAttribute) {
- if (!widget_data_)
- return;
-
- CXFA_Border* border = widget_data_->GetNode()->GetBorder(true);
+ CXFA_Border* border = ToNode(object_.Get())->GetBorder(true);
int32_t iSize = border->CountEdges();
if (bSetting) {
int32_t r = 0;
@@ -1393,10 +1384,7 @@ void CJX_Object::Script_Som_BorderColor(CFXJSE_Value* pValue,
void CJX_Object::Script_Som_BorderWidth(CFXJSE_Value* pValue,
bool bSetting,
XFA_Attribute eAttribute) {
- if (!widget_data_)
- return;
-
- CXFA_Border* border = widget_data_->GetNode()->GetBorder(true);
+ CXFA_Border* border = ToNode(object_.Get())->GetBorder(true);
if (bSetting) {
CXFA_Measurement thickness = border->GetEdge(0)->GetMSThickness();
pValue->SetString(thickness.ToString().UTF8Encode().AsStringView());
@@ -1413,13 +1401,10 @@ void CJX_Object::Script_Som_BorderWidth(CFXJSE_Value* pValue,
void CJX_Object::Script_Som_Message(CFXJSE_Value* pValue,
bool bSetting,
XFA_SOM_MESSAGETYPE iMessageType) {
- if (!widget_data_)
- return;
-
bool bNew = false;
- CXFA_Validate* validate = widget_data_->GetNode()->GetValidate(false);
+ CXFA_Validate* validate = ToNode(object_.Get())->GetValidate(false);
if (!validate) {
- validate = widget_data_->GetNode()->GetValidate(true);
+ validate = ToNode(object_.Get())->GetValidate(true);
bNew = true;
}
@@ -1483,11 +1468,12 @@ void CJX_Object::Script_Field_Length(CFXJSE_Value* pValue,
ThrowInvalidPropertyException();
return;
}
- if (!widget_data_) {
+ if (!ToNode(object_.Get())->GetWidgetAcc()) {
pValue->SetInteger(0);
return;
}
- pValue->SetInteger(widget_data_->CountChoiceListItems(true));
+ pValue->SetInteger(
+ ToNode(object_.Get())->GetWidgetAcc()->CountChoiceListItems(true));
}
void CJX_Object::Script_Som_DefaultValue(CFXJSE_Value* pValue,
@@ -1600,10 +1586,7 @@ void CJX_Object::Script_Som_DataNode(CFXJSE_Value* pValue,
void CJX_Object::Script_Som_Mandatory(CFXJSE_Value* pValue,
bool bSetting,
XFA_Attribute eAttribute) {
- if (!widget_data_)
- return;
-
- CXFA_Validate* validate = widget_data_->GetNode()->GetValidate(true);
+ CXFA_Validate* validate = ToNode(object_.Get())->GetValidate(true);
if (!validate)
return;