Chromium Code Reviews| Index: fpdfsdk/formfiller/cffl_listbox.cpp |
| diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp |
| index b668b67edb0dc07e9488d86535db95f985fce528..a0e3c837449a8aa370ceaf538e0f49b16b8c660a 100644 |
| --- a/fpdfsdk/formfiller/cffl_listbox.cpp |
| +++ b/fpdfsdk/formfiller/cffl_listbox.cpp |
| @@ -111,40 +111,24 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { |
| } |
| void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { |
| - ASSERT(m_pWidget); |
| - |
| - if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { |
| - CFX_IntArray aOldSelect, aNewSelect; |
| - |
| - { |
| - for (int i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { |
| - if (m_pWidget->IsOptionSelected(i)) { |
| - aOldSelect.Add(i); |
| - } |
| - } |
| - } |
| - |
| - int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); |
| - |
| - m_pWidget->ClearSelection(FALSE); |
| + CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE); |
|
dsinclair
2016/04/21 20:28:05
nit: static_cast
|
| + if (!pListBox) |
| + return; |
| - if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { |
| - for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { |
| - if (pListBox->IsItemSelected(i)) { |
| - m_pWidget->SetOptionSelection(i, TRUE, FALSE); |
| - aNewSelect.Add(i); |
| - } |
| - } |
| - } else { |
| - m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE); |
| - aNewSelect.Add(pListBox->GetCurSel()); |
| + int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); |
| + m_pWidget->ClearSelection(FALSE); |
| + if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { |
| + for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { |
| + if (pListBox->IsItemSelected(i)) |
| + m_pWidget->SetOptionSelection(i, TRUE, FALSE); |
| } |
| - |
| - m_pWidget->SetTopVisibleIndex(nNewTopIndex); |
| - m_pWidget->ResetFieldAppearance(TRUE); |
| - m_pWidget->UpdateField(); |
| - SetChangeMark(); |
| + } else { |
| + m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE); |
| } |
| + m_pWidget->SetTopVisibleIndex(nNewTopIndex); |
| + m_pWidget->ResetFieldAppearance(TRUE); |
| + m_pWidget->UpdateField(); |
| + SetChangeMark(); |
| } |
| void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, |