diff options
author | dsinclair <dsinclair@chromium.org> | 2016-12-07 18:10:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-07 18:10:16 -0800 |
commit | a2cbc570a035186529be151af0b3d44cf4106eee (patch) | |
tree | 1fbe99b81299839ff9c304739a85151d20c626b3 /xfa/fwl | |
parent | 442997cbb3a9e970946dd294acd1498e9fa9bfc7 (diff) | |
download | pdfium-a2cbc570a035186529be151af0b3d44cf4106eee.tar.xz |
Cleanup return values in CFWL_ComboBox
This CL changes methods in CFWL_ComboBox to return values instead of taking
out params.
Review-Url: https://codereview.chromium.org/2555103005
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.cpp | 26 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.h | 6 |
2 files changed, 15 insertions, 17 deletions
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 2d59b7d5ec..8cc1e18873 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -252,12 +252,10 @@ void CFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pEdit->SetThemeProvider(pThemeProvider); } -void CFWL_ComboBox::GetTextByIndex(int32_t iIndex, - CFX_WideString& wsText) const { +CFX_WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const { CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>( m_pListBox->GetItem(m_pListBox.get(), iIndex)); - if (pItem) - wsText = pItem->m_wsText; + return pItem ? pItem->m_wsText : L""; } void CFWL_ComboBox::SetCurSel(int32_t iSel) { @@ -314,20 +312,19 @@ void CFWL_ComboBox::OpenDropDownList(bool bActivate) { ShowDropList(bActivate); } -void CFWL_ComboBox::GetBBox(CFX_RectF& rect) const { - if (m_pWidgetMgr->IsFormDisabled()) { - DisForm_GetBBox(rect); - return; - } +CFX_RectF CFWL_ComboBox::GetBBox() const { + if (m_pWidgetMgr->IsFormDisabled()) + return DisForm_GetBBox(); - rect = m_pProperties->m_rtWidget; + CFX_RectF rect = m_pProperties->m_rtWidget; if (!m_pListBox || !IsDropListVisible()) - return; + return rect; CFX_RectF rtList; m_pListBox->GetWidgetRect(rtList, false); rtList.Offset(rect.left, rect.top); rect.Union(rtList); + return rect; } void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, @@ -737,15 +734,16 @@ void CFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, } } -void CFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) const { - rect = m_pProperties->m_rtWidget; +CFX_RectF CFWL_ComboBox::DisForm_GetBBox() const { + CFX_RectF rect = m_pProperties->m_rtWidget; if (!m_pListBox || !DisForm_IsDropListVisible()) - return; + return rect; CFX_RectF rtList; m_pListBox->GetWidgetRect(rtList, false); rtList.Offset(rect.left, rect.top); rect.Union(rtList); + return rect; } void CFWL_ComboBox::DisForm_Layout() { diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 812a6d0a29..b10a571b2c 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -68,7 +68,7 @@ class CFWL_ComboBox : public CFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - void GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) const; + CFX_WideString GetTextByIndex(int32_t iIndex) const; int32_t GetCurSel() const { return m_iCurSel; } void SetCurSel(int32_t iSel); @@ -101,7 +101,7 @@ class CFWL_ComboBox : public CFWL_Widget { void EditDelete() { m_pEdit->ClearText(); } void EditDeSelect() { m_pEdit->ClearSelections(); } - void GetBBox(CFX_RectF& rect) const; + CFX_RectF GetBBox() const; void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); @@ -146,7 +146,7 @@ class CFWL_ComboBox : public CFWL_Widget { void DisForm_Update(); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); void DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); - void DisForm_GetBBox(CFX_RectF& rect) const; + CFX_RectF DisForm_GetBBox() const; void DisForm_Layout(); void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); |