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
diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp
index 5b147bd..4183551 100644
--- a/xfa/fwl/core/cfwl_checkbox.cpp
+++ b/xfa/fwl/core/cfwl_checkbox.cpp
@@ -70,7 +70,7 @@
 
   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 8cc1e18..3c0337e 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -94,7 +94,7 @@
     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 5207c9a..651b1b3 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -79,7 +79,7 @@
   }
 
   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 c5c69a3..28ab71b 100644
--- a/xfa/fwl/core/cfwl_edit.cpp
+++ b/xfa/fwl/core/cfwl_edit.cpp
@@ -119,7 +119,7 @@
         !!(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 48f8c26..5dd37d1 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -61,7 +61,7 @@
 
   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 7b5c171..c182338 100644
--- a/xfa/fwl/core/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/core/cfwl_monthcalendar.cpp
@@ -168,7 +168,7 @@
 
   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 cb4cff3..3c95033 100644
--- a/xfa/fwl/core/cfwl_picturebox.cpp
+++ b/xfa/fwl/core/cfwl_picturebox.cpp
@@ -30,8 +30,7 @@
   }
 
   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 9e1e693..a2f9b5f1 100644
--- a/xfa/fwl/core/cfwl_pushbutton.cpp
+++ b/xfa/fwl/core/cfwl_pushbutton.cpp
@@ -48,7 +48,7 @@
   FX_FLOAT* fcaption =
       static_cast<FX_FLOAT*>(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 46068dc..8b3ce51 100644
--- a/xfa/fwl/core/cfwl_scrollbar.cpp
+++ b/xfa/fwl/core/cfwl_scrollbar.cpp
@@ -77,7 +77,8 @@
     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 8780fed..03ec5af 100644
--- a/xfa/fwl/core/cfwl_spinbutton.cpp
+++ b/xfa/fwl/core/cfwl_spinbutton.cpp
@@ -56,7 +56,7 @@
   }
 
   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 2dff10a..80ff57c 100644
--- a/xfa/fwl/core/cfwl_widget.cpp
+++ b/xfa/fwl/core/cfwl_widget.cpp
@@ -70,7 +70,10 @@
     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 4961055..3272e9d 100644
--- a/xfa/fwl/core/cfwl_widget.h
+++ b/xfa/fwl/core/cfwl_widget.h
@@ -69,6 +69,7 @@
   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);