summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-23 21:17:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-23 21:17:43 +0000
commit414cc9c9676b01587010ec5475d495eef6e05ba3 (patch)
treec4474fdd1cd945a16eb70cb0cb24b074e2010f22 /fpdfsdk
parent9b85f4ba6fdd86c488498003a2db5854d4ece036 (diff)
downloadpdfium-414cc9c9676b01587010ec5475d495eef6e05ba3.tar.xz
Remove GetWidgetAcc calls
This CL removes the calls to CXFA_Node::GetWidgetAcc() as they redundantly return the node they were called upon. Change-Id: I46e66cf98137a1dee7cd3fa8bc7d379eb97fded5 Reviewed-on: https://pdfium-review.googlesource.com/23630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp86
1 files changed, 34 insertions, 52 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 5b8910993f..8243d31383 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -298,37 +298,31 @@ void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) {
CPDF_FormControl* pFormCtrl = GetFormControl();
XFA_CHECKSTATE eCheckState =
pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off;
- node->GetWidgetAcc()->SetCheckState(eCheckState, true);
+ node->SetCheckState(eCheckState, true);
break;
}
case FormFieldType::kTextField:
- node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit,
- pFormField->GetValue());
+ node->SetValue(XFA_VALUEPICTURE_Edit, pFormField->GetValue());
break;
case FormFieldType::kListBox: {
- node->GetWidgetAcc()->ClearAllSelections();
+ node->ClearAllSelections();
for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
int nIndex = pFormField->GetSelectedIndex(i);
- if (nIndex > -1 &&
- nIndex < node->GetWidgetAcc()->CountChoiceListItems(false)) {
- node->GetWidgetAcc()->SetItemState(nIndex, true, false, false, true);
- }
+ if (nIndex > -1 && nIndex < node->CountChoiceListItems(false))
+ node->SetItemState(nIndex, true, false, false, true);
}
break;
}
case FormFieldType::kComboBox: {
- node->GetWidgetAcc()->ClearAllSelections();
+ node->ClearAllSelections();
for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
int nIndex = pFormField->GetSelectedIndex(i);
- if (nIndex > -1 &&
- nIndex < node->GetWidgetAcc()->CountChoiceListItems(false)) {
- node->GetWidgetAcc()->SetItemState(nIndex, true, false, false, true);
- }
+ if (nIndex > -1 && nIndex < node->CountChoiceListItems(false))
+ node->SetItemState(nIndex, true, false, false, true);
}
- node->GetWidgetAcc()->SetValue(XFA_VALUEPICTURE_Edit,
- pFormField->GetValue());
+ node->SetValue(XFA_VALUEPICTURE_Edit, pFormField->GetValue());
break;
}
default:
@@ -378,9 +372,9 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
switch (pFormField->GetFieldType()) {
case FormFieldType::kCheckBox: {
if (node->IsWidgetReady()) {
- pFormField->CheckControl(
- pFormField->GetControlIndex(pFormControl),
- node->GetWidgetAcc()->GetCheckState() == XFA_CHECKSTATE_On, true);
+ pFormField->CheckControl(pFormField->GetControlIndex(pFormControl),
+ node->GetCheckState() == XFA_CHECKSTATE_On,
+ true);
}
break;
}
@@ -388,26 +382,23 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
// TODO(weili): Check whether we need to handle checkbox and radio
// button differently, otherwise, merge these two cases.
if (node->IsWidgetReady()) {
- pFormField->CheckControl(
- pFormField->GetControlIndex(pFormControl),
- node->GetWidgetAcc()->GetCheckState() == XFA_CHECKSTATE_On, true);
+ pFormField->CheckControl(pFormField->GetControlIndex(pFormControl),
+ node->GetCheckState() == XFA_CHECKSTATE_On,
+ true);
}
break;
}
case FormFieldType::kTextField: {
- if (node->IsWidgetReady()) {
- pFormField->SetValue(
- node->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display), true);
- }
+ if (node->IsWidgetReady())
+ pFormField->SetValue(node->GetValue(XFA_VALUEPICTURE_Display), true);
break;
}
case FormFieldType::kListBox: {
pFormField->ClearSelection(false);
if (node->IsWidgetReady()) {
- for (int i = 0, sz = node->GetWidgetAcc()->CountSelectedItems(); i < sz;
- i++) {
- int nIndex = node->GetWidgetAcc()->GetSelectedItem(i);
+ for (int i = 0, sz = node->CountSelectedItems(); i < sz; i++) {
+ int nIndex = node->GetSelectedItem(i);
if (nIndex > -1 && nIndex < pFormField->CountOptions()) {
pFormField->SetItemSelection(nIndex, true, true);
@@ -420,16 +411,12 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
pFormField->ClearSelection(false);
if (node->IsWidgetReady()) {
- for (int i = 0, sz = node->GetWidgetAcc()->CountSelectedItems(); i < sz;
- i++) {
- int nIndex = node->GetWidgetAcc()->GetSelectedItem(i);
-
- if (nIndex > -1 && nIndex < pFormField->CountOptions()) {
+ for (int i = 0, sz = node->CountSelectedItems(); i < sz; i++) {
+ int nIndex = node->GetSelectedItem(i);
+ if (nIndex > -1 && nIndex < pFormField->CountOptions())
pFormField->SetItemSelection(nIndex, true, true);
- }
}
- pFormField->SetValue(
- node->GetWidgetAcc()->GetValue(XFA_VALUEPICTURE_Display), true);
+ pFormField->SetValue(node->GetValue(XFA_VALUEPICTURE_Display), true);
}
break;
}
@@ -451,11 +438,9 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
pFormField->ClearOptions(true);
if (node->IsWidgetReady()) {
- for (int i = 0, sz = node->GetWidgetAcc()->CountChoiceListItems(false);
- i < sz; i++) {
+ for (int i = 0, sz = node->CountChoiceListItems(false); i < sz; i++) {
pFormField->InsertOption(
- node->GetWidgetAcc()->GetChoiceListItem(i, false).value_or(L""),
- i, true);
+ node->GetChoiceListItem(i, false).value_or(L""), i, true);
}
}
break;
@@ -465,11 +450,9 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
pFormField->ClearOptions(false);
if (node->IsWidgetReady()) {
- for (int i = 0, sz = node->GetWidgetAcc()->CountChoiceListItems(false);
- i < sz; i++) {
+ for (int i = 0, sz = node->CountChoiceListItems(false); i < sz; i++) {
pFormField->InsertOption(
- node->GetWidgetAcc()->GetChoiceListItem(i, false).value_or(L""),
- i, false);
+ node->GetChoiceListItem(i, false).value_or(L""), i, false);
}
}
@@ -620,8 +603,8 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
CXFA_Node* node = hWidget->GetNode();
if (node->IsWidgetReady()) {
- if (nIndex < node->GetWidgetAcc()->CountSelectedItems())
- return node->GetWidgetAcc()->GetSelectedItem(nIndex);
+ if (nIndex < node->CountSelectedItems())
+ return node->GetSelectedItem(nIndex);
}
}
#endif // PDF_ENABLE_XFA
@@ -634,8 +617,8 @@ WideString CPDFSDK_Widget::GetValue(bool bDisplay) const {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
CXFA_Node* node = hWidget->GetNode();
if (node->IsWidgetReady()) {
- return node->GetWidgetAcc()->GetValue(bDisplay ? XFA_VALUEPICTURE_Display
- : XFA_VALUEPICTURE_Edit);
+ return node->GetValue(bDisplay ? XFA_VALUEPICTURE_Display
+ : XFA_VALUEPICTURE_Edit);
}
}
#else
@@ -665,9 +648,8 @@ bool CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
CXFA_Node* node = hWidget->GetNode();
if (node->IsWidgetReady()) {
- if (nIndex > -1 &&
- nIndex < node->GetWidgetAcc()->CountChoiceListItems(false))
- return node->GetWidgetAcc()->GetItemState(nIndex);
+ if (nIndex > -1 && nIndex < node->CountChoiceListItems(false))
+ return node->GetItemState(nIndex);
return false;
}
@@ -687,7 +669,7 @@ bool CPDFSDK_Widget::IsChecked() const {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
CXFA_Node* node = hWidget->GetNode();
if (node->IsWidgetReady())
- return node->GetWidgetAcc()->GetCheckState() == XFA_CHECKSTATE_On;
+ return node->GetCheckState() == XFA_CHECKSTATE_On;
}
#endif // PDF_ENABLE_XFA
CPDF_FormControl* pFormCtrl = GetFormControl();