From 67c6ca3cd86b6a31c888264bb8067c6c4324e56c Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 7 Dec 2016 18:24:00 -0800 Subject: Split CFWL_Widget::GetWidgetRect into two parts This CL splits the inflation logic out of GetWidgetRect to allow subclasses to call that directly instead of the CFWL_Widget::GetWidgetRect method. Review-Url: https://codereview.chromium.org/2555253002 --- xfa/fwl/core/cfwl_checkbox.cpp | 2 +- xfa/fwl/core/cfwl_combobox.cpp | 2 +- xfa/fwl/core/cfwl_datetimepicker.cpp | 2 +- xfa/fwl/core/cfwl_edit.cpp | 2 +- xfa/fwl/core/cfwl_listbox.cpp | 2 +- xfa/fwl/core/cfwl_monthcalendar.cpp | 2 +- xfa/fwl/core/cfwl_picturebox.cpp | 3 +-- xfa/fwl/core/cfwl_pushbutton.cpp | 2 +- xfa/fwl/core/cfwl_scrollbar.cpp | 3 ++- xfa/fwl/core/cfwl_spinbutton.cpp | 2 +- xfa/fwl/core/cfwl_widget.cpp | 3 +++ xfa/fwl/core/cfwl_widget.h | 1 + 12 files changed, 15 insertions(+), 11 deletions(-) (limited to 'xfa/fwl') diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp index 5b147bd55a..4183551f68 100644 --- a/xfa/fwl/core/cfwl_checkbox.cpp +++ b/xfa/fwl/core/cfwl_checkbox.cpp @@ -70,7 +70,7 @@ void CFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { rect.width += m_fBoxHeight; rect.height = std::max(rect.height, m_fBoxHeight); - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_CheckBox::Update() { diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 8cc1e18873..3c0337ed57 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -94,7 +94,7 @@ void CFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { return; rect.Inflate(0, 0, *pFWidth, 0); - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp index 5207c9a492..651b1b38c8 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.cpp +++ b/xfa/fwl/core/cfwl_datetimepicker.cpp @@ -79,7 +79,7 @@ void CFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_DateTimePicker::Update() { diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp index c5c69a3a94..28ab71bac0 100644 --- a/xfa/fwl/core/cfwl_edit.cpp +++ b/xfa/fwl/core/cfwl_edit.cpp @@ -119,7 +119,7 @@ void CFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine)); rect.Set(0, 0, sz.x, sz.y); } - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_Edit::SetStates(uint32_t dwStates) { diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index 48f8c262f5..5dd37d15d7 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -61,7 +61,7 @@ void CFWL_ListBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { CFX_SizeF fs = CalcSize(true); rect.Set(0, 0, fs.x, fs.y); - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_ListBox::Update() { diff --git a/xfa/fwl/core/cfwl_monthcalendar.cpp b/xfa/fwl/core/cfwl_monthcalendar.cpp index 7b5c171a3a..c182338460 100644 --- a/xfa/fwl/core/cfwl_monthcalendar.cpp +++ b/xfa/fwl/core/cfwl_monthcalendar.cpp @@ -168,7 +168,7 @@ void CFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { CFX_SizeF fs = CalcSize(); rect.Set(0, 0, fs.x, fs.y); - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_MonthCalendar::Update() { diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp index cb4cff35d1..3c95033aa0 100644 --- a/xfa/fwl/core/cfwl_picturebox.cpp +++ b/xfa/fwl/core/cfwl_picturebox.cpp @@ -30,8 +30,7 @@ void CFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } rect.Set(0, 0, 0, 0); - - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_PictureBox::Update() { diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp index 9e1e693ff0..a2f9b5f1cf 100644 --- a/xfa/fwl/core/cfwl_pushbutton.cpp +++ b/xfa/fwl/core/cfwl_pushbutton.cpp @@ -48,7 +48,7 @@ void CFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { FX_FLOAT* fcaption = static_cast(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); rect.Inflate(*fcaption, *fcaption); - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_PushButton::SetStates(uint32_t dwStates) { diff --git a/xfa/fwl/core/cfwl_scrollbar.cpp b/xfa/fwl/core/cfwl_scrollbar.cpp index 46068dc89c..8b3ce51195 100644 --- a/xfa/fwl/core/cfwl_scrollbar.cpp +++ b/xfa/fwl/core/cfwl_scrollbar.cpp @@ -77,7 +77,8 @@ void CFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); else rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth)); - CFWL_Widget::GetWidgetRect(rect, true); + + InflateWidgetRect(rect); } void CFWL_ScrollBar::Update() { diff --git a/xfa/fwl/core/cfwl_spinbutton.cpp b/xfa/fwl/core/cfwl_spinbutton.cpp index 8780fed1a9..03ec5afdf8 100644 --- a/xfa/fwl/core/cfwl_spinbutton.cpp +++ b/xfa/fwl/core/cfwl_spinbutton.cpp @@ -56,7 +56,7 @@ void CFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } rect.Set(0, 0, kMinWidth, kMinHeight); - CFWL_Widget::GetWidgetRect(rect, true); + InflateWidgetRect(rect); } void CFWL_SpinButton::Update() { diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index 2dff10adc7..80ff57ce13 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -70,7 +70,10 @@ void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { rect = m_pProperties->m_rtWidget; return; } + InflateWidgetRect(rect); +} +void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) { if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); rect.Inflate(fEdge, fEdge); diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h index 4961055954..3272e9d011 100644 --- a/xfa/fwl/core/cfwl_widget.h +++ b/xfa/fwl/core/cfwl_widget.h @@ -69,6 +69,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; + void InflateWidgetRect(CFX_RectF& rect); void SetWidgetRect(const CFX_RectF& rect); void SetParent(CFWL_Widget* pParent); -- cgit v1.2.3