diff options
author | dsinclair <dsinclair@chromium.org> | 2016-12-14 06:25:02 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-14 06:25:02 -0800 |
commit | 603f57b85c0643f0598f03b97c4525501f3e1221 (patch) | |
tree | 85c9521a8f0fec47ba84041d64cb84e6bc019638 /xfa/fxfa | |
parent | a9caab94c1f16929e5acf2676117224617d80f53 (diff) | |
download | pdfium-603f57b85c0643f0598f03b97c4525501f3e1221.tar.xz |
Update CFWL_ListBox to return instead of using out params.
This CL updates the CFWL_ListBox code to work with return values instead
of out params. This also extracts the CFWL_ListItem code out of CFWL_ListBox
and puts into the correct class.
Review-Url: https://codereview.chromium.org/2572783002
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/app/xfa_ffchoicelist.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 14 |
2 files changed, 8 insertions, 12 deletions
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index d19fd6876b..2764d725af 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -104,7 +104,7 @@ bool CXFA_FFListBox::IsDataChanged() { for (int32_t i = 0; i < iSels; ++i) { CFWL_ListItem* hlistItem = pListBox->GetItem(nullptr, iSelArray[i]); - if (!(pListBox->GetItemStates(hlistItem) & FWL_ITEMSTATE_LTB_Selected)) + if (!(hlistItem->GetStates() & FWL_ITEMSTATE_LTB_Selected)) return true; } return false; @@ -163,8 +163,8 @@ void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget, CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; int32_t iSels = pListBox->CountSelItems(); if (iSels > 0) { - eParam.m_wsNewText = - pListBox->GetItemText(nullptr, pListBox->GetSelItem(0)); + CFWL_ListItem* item = pListBox->GetSelItem(0); + eParam.m_wsNewText = item ? item->GetText() : L""; } m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 50b087315d..74bd99a55d 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -505,16 +505,12 @@ bool CXFA_FFDateTimeEdit::GetBBox(CFX_RectF& rtBox, } bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { - return false; - } - CFX_RectF rtWidget; - ((CFWL_DateTimePicker*)m_pNormalWidget)->GetBBox(rtWidget); - if (rtWidget.Contains(fx, fy)) { - return true; - } - return false; + return m_pNormalWidget && + static_cast<CFWL_DateTimePicker*>(m_pNormalWidget) + ->GetBBox() + .Contains(fx, fy); } + bool CXFA_FFDateTimeEdit::LoadWidget() { CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); m_pNormalWidget = pWidget; |