From 7172b71a005c181e9f103ac0e19f6675bf3bc8e8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 23 Nov 2016 13:04:07 -0500 Subject: Remove IFWL_CombobBox::DataProvider The height value returned is always 0. This CL removes the plumbing and uses the 0 value directly. R=npm@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/2525003002 . --- xfa/fwl/core/cfwl_combobox.cpp | 7 +------ xfa/fwl/core/cfwl_combobox.h | 8 +------- xfa/fwl/core/ifwl_combobox.cpp | 14 +------------- xfa/fwl/core/ifwl_combobox.h | 6 ------ 4 files changed, 3 insertions(+), 32 deletions(-) diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 9af4b8da7d..7eb04b5118 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -21,8 +21,7 @@ IFWL_ComboBox* ToComboBox(IFWL_Widget* widget) { } // namespace -CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app) - : CFWL_Widget(app), m_fMaxListHeight(0) {} +CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app) : CFWL_Widget(app) {} CFWL_ComboBox::~CFWL_ComboBox() {} @@ -49,10 +48,6 @@ void CFWL_ComboBox::RemoveAll() { ToComboBox(GetWidget())->RemoveAll(); } -FX_FLOAT CFWL_ComboBox::GetListHeight(IFWL_Widget* pWidget) { - return m_fMaxListHeight; -} - void CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) const { if (!GetWidget()) diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 2b63c50aad..a670ef22cb 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -13,16 +13,13 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fwl/core/ifwl_combobox.h" -class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBox::DataProvider { +class CFWL_ComboBox : public CFWL_Widget, public IFWL_Widget::DataProvider { public: explicit CFWL_ComboBox(const CFWL_App* pApp); ~CFWL_ComboBox() override; void Initialize(); - // IFWL_ComboBox::DataProvider - FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; - void AddString(const CFX_WideStringC& wsText); bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. void RemoveAll(); @@ -54,9 +51,6 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBox::DataProvider { void GetBBox(CFX_RectF& rect); void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); - - private: - FX_FLOAT m_fMaxListHeight; }; #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_ diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index 906fe1d6ef..19d1c3f87f 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -337,12 +337,6 @@ void IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } -FX_FLOAT IFWL_ComboBox::GetDataProviderListHeight() { - return static_cast( - m_pProperties->m_pDataProvider) - ->GetListHeight(this); -} - void IFWL_ComboBox::DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; @@ -381,11 +375,6 @@ void IFWL_ComboBox::ShowDropList(bool bActivate) { (FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw); m_pListBox->ModifyStylesEx(dwStyleAdd, 0); m_pListBox->GetWidgetRect(m_rtList, true); - FX_FLOAT fHeight = GetDataProviderListHeight(); - if (fHeight > 0 && m_rtList.height > fHeight) { - m_rtList.height = fHeight; - m_pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll, 0); - } CFX_RectF rtAnchor; rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width, @@ -396,8 +385,7 @@ void IFWL_ComboBox::ShowDropList(bool bActivate) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListDrag) m_rtProxy.height += m_fComboFormHandler; - FX_FLOAT fMinHeight = 0; - GetPopupPos(fMinHeight, m_rtProxy.height, rtAnchor, m_rtProxy); + GetPopupPos(0, m_rtProxy.height, rtAnchor, m_rtProxy); if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListDrag) { FX_FLOAT fx = 0; FX_FLOAT fy = m_rtClient.top + m_rtClient.height / 2; diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h index 7ad7420c9b..dfe9d646cd 100644 --- a/xfa/fwl/core/ifwl_combobox.h +++ b/xfa/fwl/core/ifwl_combobox.h @@ -49,11 +49,6 @@ class IFWL_Widget; class IFWL_ComboBox : public IFWL_Widget { public: - class DataProvider : public IFWL_Widget::DataProvider { - public: - virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0; - }; - explicit IFWL_ComboBox(const CFWL_App* app, std::unique_ptr properties); ~IFWL_ComboBox() override; @@ -125,7 +120,6 @@ class IFWL_ComboBox : public IFWL_Widget { int32_t GetCurrentSelection() const { return m_iCurSel; } private: - FX_FLOAT GetDataProviderListHeight(); bool IsDropDownStyle() const { return !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown); } -- cgit v1.2.3