diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-23 15:52:14 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-23 15:52:14 +0000 |
commit | 1e5f87e7e1c1e5868ec675a0c45ddd97d2b4db2e (patch) | |
tree | 268e5b54868a00d8bba5ffc3125b7fbe2589cf2c /fxjs/xfa/cjx_field.cpp | |
parent | 08915150a3fb64aa1ebf9bdf20d1158a20b4266f (diff) | |
download | pdfium-1e5f87e7e1c1e5868ec675a0c45ddd97d2b4db2e.tar.xz |
Use accessor for WidgetAcc
This CL removes places where we store CXFA_WidgetAcc into a variable and
uses the accessor from CXFA_Node instead. This will ease the removal of
CXFA_WidgetAcc.
Change-Id: I7a6cb0079bb119481a5ae60679a537799b3be2c9
Reviewed-on: https://pdfium-review.googlesource.com/23510
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_field.cpp')
-rw-r--r-- | fxjs/xfa/cjx_field.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp index 34b944f66d..e27f153646 100644 --- a/fxjs/xfa/cjx_field.cpp +++ b/fxjs/xfa/cjx_field.cpp @@ -191,14 +191,13 @@ CJS_Return CJX_Field::setItemState( if (!node->IsWidgetReady()) return CJS_Return(true); - CXFA_WidgetAcc* pWidgetAcc = node->GetWidgetAcc(); int32_t iIndex = runtime->ToInt32(params[0]); if (runtime->ToInt32(params[1]) != 0) { - pWidgetAcc->SetItemState(iIndex, true, true, true, true); + node->GetWidgetAcc()->SetItemState(iIndex, true, true, true, true); return CJS_Return(true); } - if (pWidgetAcc->GetItemState(iIndex)) - pWidgetAcc->SetItemState(iIndex, false, true, true, true); + if (node->GetWidgetAcc()->GetItemState(iIndex)) + node->GetWidgetAcc()->SetItemState(iIndex, false, true, true, true); return CJS_Return(true); } @@ -246,7 +245,6 @@ void CJX_Field::defaultValue(CFXJSE_Value* pValue, if (!xfaNode->IsWidgetReady()) return; - CXFA_WidgetAcc* pWidgetAcc = xfaNode->GetWidgetAcc(); if (bSetting) { if (pValue) { xfaNode->SetPreNull(xfaNode->IsNull()); @@ -258,8 +256,9 @@ void CJX_Field::defaultValue(CFXJSE_Value* pValue, wsNewText = pValue->ToWideString(); if (xfaNode->GetUIChild()->GetElementType() == XFA_Element::NumericEdit) { - wsNewText = pWidgetAcc->NumericLimit( - wsNewText, pWidgetAcc->GetLeadDigits(), pWidgetAcc->GetFracDigits()); + wsNewText = xfaNode->GetWidgetAcc()->NumericLimit( + wsNewText, xfaNode->GetWidgetAcc()->GetLeadDigits(), + xfaNode->GetWidgetAcc()->GetFracDigits()); } CXFA_Node* pContainerNode = xfaNode->GetContainerNode(); @@ -308,13 +307,15 @@ void CJX_Field::editValue(CFXJSE_Value* pValue, if (!node->IsWidgetReady()) return; - CXFA_WidgetAcc* pWidgetAcc = node->GetWidgetAcc(); if (bSetting) { - pWidgetAcc->SetValue(XFA_VALUEPICTURE_Edit, pValue->ToWideString()); + node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit, + pValue->ToWideString()); return; } - pValue->SetString( - pWidgetAcc->GetValue(XFA_VALUEPICTURE_Edit).UTF8Encode().AsStringView()); + pValue->SetString(node->GetWidgetAcc() + ->GetValue(XFA_VALUEPICTURE_Edit) + .UTF8Encode() + .AsStringView()); } void CJX_Field::formatMessage(CFXJSE_Value* pValue, @@ -330,12 +331,13 @@ void CJX_Field::formattedValue(CFXJSE_Value* pValue, if (!node->IsWidgetReady()) return; - CXFA_WidgetAcc* pWidgetAcc = node->GetWidgetAcc(); if (bSetting) { - pWidgetAcc->SetValue(XFA_VALUEPICTURE_Display, pValue->ToWideString()); + node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Display, + pValue->ToWideString()); return; } - pValue->SetString(pWidgetAcc->GetValue(XFA_VALUEPICTURE_Display) + pValue->SetString(node->GetWidgetAcc() + ->GetValue(XFA_VALUEPICTURE_Display) .UTF8Encode() .AsStringView()); } @@ -357,19 +359,18 @@ void CJX_Field::selectedIndex(CFXJSE_Value* pValue, if (!node->IsWidgetReady()) return; - CXFA_WidgetAcc* pWidgetAcc = node->GetWidgetAcc(); if (!bSetting) { - pValue->SetInteger(pWidgetAcc->GetSelectedItem(0)); + pValue->SetInteger(node->GetWidgetAcc()->GetSelectedItem(0)); return; } int32_t iIndex = pValue->ToInteger(); if (iIndex == -1) { - pWidgetAcc->ClearAllSelections(); + node->GetWidgetAcc()->ClearAllSelections(); return; } - pWidgetAcc->SetItemState(iIndex, true, true, true, true); + node->GetWidgetAcc()->SetItemState(iIndex, true, true, true, true); } void CJX_Field::access(CFXJSE_Value* pValue, |