From 72f957a0bafaf7c9628980e404c471b54f42de8f Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 16 Nov 2016 07:01:26 -0800 Subject: Cleaning up nits in fwl/core files. This Cl cleans up the nits in the first set of cfwl_* files. The unused Event and Message classes are removed. Review-Url: https://codereview.chromium.org/2505703003 --- xfa/fwl/core/cfwl_combobox.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'xfa/fwl/core/cfwl_combobox.cpp') diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index d1f95035d6..a8211e9773 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -47,9 +47,9 @@ int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { } bool CFWL_ComboBox::RemoveAt(int32_t iIndex) { - if (iIndex < 0 || static_cast(iIndex) >= m_ItemArray.size()) { + if (iIndex < 0 || static_cast(iIndex) >= m_ItemArray.size()) return false; - } + m_ItemArray.erase(m_ItemArray.begin() + iIndex); return true; } @@ -167,7 +167,6 @@ CFWL_ListItem* CFWL_ComboBox::GetItem(const IFWL_Widget* pWidget, int32_t nIndex) const { if (nIndex < 0 || static_cast(nIndex) >= m_ItemArray.size()) return nullptr; - return m_ItemArray[nIndex].get(); } @@ -183,9 +182,7 @@ int32_t CFWL_ComboBox::GetItemIndex(IFWL_Widget* pWidget, uint32_t CFWL_ComboBox::GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { - if (!pItem) - return 0; - return static_cast(pItem)->m_dwStyles; + return pItem ? static_cast(pItem)->m_dwStyles : 0; } void CFWL_ComboBox::GetItemText(IFWL_Widget* pWidget, @@ -200,6 +197,7 @@ void CFWL_ComboBox::GetItemRect(IFWL_Widget* pWidget, CFX_RectF& rtItem) { if (!pItem) return; + CFWL_ListItem* pComboItem = static_cast(pItem); rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top, pComboItem->m_rtItem.width, pComboItem->m_rtItem.height); -- cgit v1.2.3