Convert GetWidgetRect to return rect.
Current GetWidgetRect accepts the rect as an out-param. This CL converts the
code to return the rect instead.
Review-Url: https://codereview.chromium.org/2556873004
diff --git a/xfa/fwl/core/cfwl_caret.cpp b/xfa/fwl/core/cfwl_caret.cpp
index 0457347..f9e26a7 100644
--- a/xfa/fwl/core/cfwl_caret.cpp
+++ b/xfa/fwl/core/cfwl_caret.cpp
@@ -76,8 +76,7 @@
   if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight))
     return;
 
-  CFX_RectF rect;
-  GetWidgetRect(rect, false);
+  CFX_RectF rect = GetWidgetRect();
   rect.Set(0, 0, rect.width, rect.height);
 
   CFWL_ThemeBackground param;
@@ -107,8 +106,7 @@
   else
     pCaret->RemoveStates(FWL_STATE_CAT_HightLight);
 
-  CFX_RectF rt;
-  pCaret->GetWidgetRect(rt, false);
+  CFX_RectF rt = pCaret->GetWidgetRect();
   rt.Set(0, 0, rt.width + 1, rt.height);
   pCaret->Repaint(&rt);
 }
diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp
index 4183551..8d99d7a 100644
--- a/xfa/fwl/core/cfwl_checkbox.cpp
+++ b/xfa/fwl/core/cfwl_checkbox.cpp
@@ -50,29 +50,6 @@
   m_fBoxHeight = fHeight;
 }
 
-void CFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Set(0, 0, 0, 0);
-  if (!m_pProperties->m_pThemeProvider)
-    m_pProperties->m_pThemeProvider = GetAvailableTheme();
-  if (!m_pProperties->m_pThemeProvider)
-    return;
-
-  CFX_SizeF sz = CalcTextSize(
-      L"Check box", m_pProperties->m_pThemeProvider,
-      !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_MultiLine));
-  rect.Set(0, 0, sz.x, sz.y);
-  rect.Inflate(kCaptionMargin, kCaptionMargin);
-
-  rect.width += m_fBoxHeight;
-  rect.height = std::max(rect.height, m_fBoxHeight);
-  InflateWidgetRect(rect);
-}
-
 void CFWL_CheckBox::Update() {
   if (IsLocked())
     return;
@@ -308,8 +285,7 @@
           if (pCheckBox != this &&
               pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
             pCheckBox->SetCheckState(0);
-            CFX_RectF rt;
-            pCheckBox->GetWidgetRect(rt, false);
+            CFX_RectF rt = pCheckBox->GetWidgetRect();
             rt.left = rt.top = 0;
             m_pWidgetMgr->RepaintWidget(pCheckBox, &rt);
             break;
diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h
index ace09e5..f699aa0 100644
--- a/xfa/fwl/core/cfwl_checkbox.h
+++ b/xfa/fwl/core/cfwl_checkbox.h
@@ -55,7 +55,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
 
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index 3c0337e..bfc3f32 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -72,31 +72,6 @@
   return FWL_Type::ComboBox;
 }
 
-void CFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Reset();
-  if (IsDropDownStyle() && m_pEdit) {
-    m_pEdit->GetWidgetRect(rect, true);
-  } else {
-    rect.width = 100;
-    rect.height = 16;
-  }
-  if (!m_pProperties->m_pThemeProvider)
-    ResetTheme();
-
-  FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
-      GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
-  if (!pFWidth)
-    return;
-
-  rect.Inflate(0, 0, *pFWidth, 0);
-  InflateWidgetRect(rect);
-}
-
 void CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) {
   m_pListBox->AddString(wsText);
 }
@@ -320,8 +295,7 @@
   if (!m_pListBox || !IsDropListVisible())
     return rect;
 
-  CFX_RectF rtList;
-  m_pListBox->GetWidgetRect(rtList, false);
+  CFX_RectF rtList = m_pListBox->GetWidgetRect();
   rtList.Offset(rect.left, rect.top);
   rect.Union(rtList);
   return rect;
@@ -370,7 +344,7 @@
   uint32_t dwStyleAdd = m_pProperties->m_dwStyleExes &
                         (FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw);
   m_pListBox->ModifyStylesEx(dwStyleAdd, 0);
-  m_pListBox->GetWidgetRect(m_rtList, true);
+  m_rtList = m_pListBox->GetAutosizedWidgetRect();
 
   CFX_RectF rtAnchor;
   rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width,
@@ -646,8 +620,7 @@
     m_pListBox->SetStates(FWL_WGTSTATE_Invisible);
   }
 
-  CFX_RectF rect;
-  m_pListBox->GetWidgetRect(rect, false);
+  CFX_RectF rect = m_pListBox->GetWidgetRect();
   rect.Inflate(2, 2);
   Repaint(&rect);
 }
@@ -688,7 +661,7 @@
   if (m_rtBtn.Contains(fx, fy))
     return FWL_WidgetHit::Client;
   if (DisForm_IsDropListVisible()) {
-    m_pListBox->GetWidgetRect(rect, false);
+    rect = m_pListBox->GetWidgetRect();
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::Client;
   }
@@ -717,16 +690,14 @@
   pGraphics->RestoreGraphState();
 
   if (m_pEdit) {
-    CFX_RectF rtEdit;
-    m_pEdit->GetWidgetRect(rtEdit, false);
+    CFX_RectF rtEdit = m_pEdit->GetWidgetRect();
     CFX_Matrix mt;
     mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top);
     mt.Concat(mtOrg);
     m_pEdit->DrawWidget(pGraphics, &mt);
   }
   if (m_pListBox && DisForm_IsDropListVisible()) {
-    CFX_RectF rtList;
-    m_pListBox->GetWidgetRect(rtList, false);
+    CFX_RectF rtList = m_pListBox->GetWidgetRect();
     CFX_Matrix mt;
     mt.Set(1, 0, 0, 1, rtList.left, rtList.top);
     mt.Concat(mtOrg);
@@ -739,8 +710,7 @@
   if (!m_pListBox || !DisForm_IsDropListVisible())
     return rect;
 
-  CFX_RectF rtList;
-  m_pListBox->GetWidgetRect(rtList, false);
+  CFX_RectF rtList = m_pListBox->GetWidgetRect();
   rtList.Offset(rect.left, rect.top);
   rect.Union(rtList);
   return rect;
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index b10a571..26c54b5 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -54,7 +54,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void ModifyStylesEx(uint32_t dwStylesExAdded,
                       uint32_t dwStylesExRemoved) override;
   void SetStates(uint32_t dwStates) override;
diff --git a/xfa/fwl/core/cfwl_comboboxproxy.cpp b/xfa/fwl/core/cfwl_comboboxproxy.cpp
index be45f2b..b7c5637 100644
--- a/xfa/fwl/core/cfwl_comboboxproxy.cpp
+++ b/xfa/fwl/core/cfwl_comboboxproxy.cpp
@@ -70,8 +70,7 @@
 
   CFWL_NoteDriver* pDriver =
       static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
-  CFX_RectF rtWidget;
-  GetWidgetRect(rtWidget, false);
+  CFX_RectF rtWidget = GetWidgetRect();
   rtWidget.left = rtWidget.top = 0;
 
   CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
@@ -100,8 +99,7 @@
   }
 
   CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
-  CFX_RectF rect;
-  GetWidgetRect(rect, false);
+  CFX_RectF rect = GetWidgetRect();
   rect.left = rect.top = 0;
   if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) &&
       m_pComboBox->IsDropListVisible()) {
diff --git a/xfa/fwl/core/cfwl_combolist.cpp b/xfa/fwl/core/cfwl_combolist.cpp
index 7532da2..ff7bd27 100644
--- a/xfa/fwl/core/cfwl_combolist.cpp
+++ b/xfa/fwl/core/cfwl_combolist.cpp
@@ -86,8 +86,7 @@
     CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
     CFWL_ScrollBar* vertSB = GetVertScrollBar();
     if (IsShowScrollBar(true) && vertSB) {
-      CFX_RectF rect;
-      vertSB->GetWidgetRect(rect, false);
+      CFX_RectF rect = vertSB->GetWidgetRect();
       if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
         pMsg->m_fx -= rect.left;
         pMsg->m_fy -= rect.top;
@@ -140,8 +139,7 @@
 
     CFWL_ScrollBar* vertSB = GetVertScrollBar();
     if (IsShowScrollBar(true) && vertSB) {
-      CFX_RectF rect;
-      vertSB->GetWidgetRect(rect, false);
+      CFX_RectF rect = vertSB->GetWidgetRect();
       if (rect.Contains(pMsg->m_fx, pMsg->m_fy))
         return;
     }
@@ -176,8 +174,7 @@
 
   CFWL_ScrollBar* vertSB = GetVertScrollBar();
   if (IsShowScrollBar(true) && vertSB) {
-    CFX_RectF rect;
-    vertSB->GetWidgetRect(rect, false);
+    CFX_RectF rect = vertSB->GetWidgetRect();
     if (rect.Contains(pMsg->m_fx, pMsg->m_fy))
       return;
   }
diff --git a/xfa/fwl/core/cfwl_datetimeedit.cpp b/xfa/fwl/core/cfwl_datetimeedit.cpp
index fc3edcf..37d79b6 100644
--- a/xfa/fwl/core/cfwl_datetimeedit.cpp
+++ b/xfa/fwl/core/cfwl_datetimeedit.cpp
@@ -50,8 +50,7 @@
     CFWL_DateTimePicker* pDateTime =
         static_cast<CFWL_DateTimePicker*>(m_pOuter);
     if (pDateTime->IsMonthCalendarVisible()) {
-      CFX_RectF rtInvalidate;
-      pDateTime->GetWidgetRect(rtInvalidate, false);
+      CFX_RectF rtInvalidate = pDateTime->GetWidgetRect();
       pDateTime->ShowMonthCalendar(false);
       rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top);
       pDateTime->Repaint(&rtInvalidate);
diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp
index 651b1b3..63f8955 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -23,7 +23,6 @@
 
 namespace {
 
-const int kDateTimePickerWidth = 100;
 const int kDateTimePickerHeight = 20;
 
 }  // namespace
@@ -46,8 +45,7 @@
   m_pMonthCal.reset(
       new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this));
 
-  CFX_RectF rtMonthCal;
-  m_pMonthCal->GetWidgetRect(rtMonthCal, true);
+  CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
   rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
   m_pMonthCal->SetWidgetRect(rtMonthCal);
 
@@ -68,20 +66,6 @@
   return FWL_Type::DateTimePicker;
 }
 
-void CFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (m_pWidgetMgr->IsFormDisabled()) {
-    DisForm_GetWidgetRect(rect, bAutoSize);
-    return;
-  }
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight);
-  InflateWidgetRect(rect);
-}
-
 void CFWL_DateTimePicker::Update() {
   if (m_pWidgetMgr->IsFormDisabled()) {
     DisForm_Update();
@@ -112,8 +96,7 @@
   if (!(m_pMonthCal->GetThemeProvider()))
     m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
 
-  CFX_RectF rtMonthCal;
-  m_pMonthCal->GetWidgetRect(rtMonthCal, true);
+  CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
   CFX_RectF rtPopUp;
   rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight,
               rtMonthCal.width, rtMonthCal.height);
@@ -128,8 +111,7 @@
   if (m_rtClient.Contains(fx, fy))
     return FWL_WidgetHit::Client;
   if (IsMonthCalendarVisible()) {
-    CFX_RectF rect;
-    m_pMonthCal->GetWidgetRect(rect, false);
+    CFX_RectF rect = m_pMonthCal->GetWidgetRect();
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::Client;
   }
@@ -208,8 +190,7 @@
 
   rect = m_pProperties->m_rtWidget;
   if (IsMonthCalendarVisible()) {
-    CFX_RectF rtMonth;
-    m_pMonthCal->GetWidgetRect(rtMonth, false);
+    CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
     rtMonth.Offset(m_pProperties->m_rtWidget.left,
                    m_pProperties->m_rtWidget.top);
     rect.Union(rtMonth);
@@ -266,8 +247,7 @@
     return;
   }
 
-  CFX_RectF rtMonth;
-  m_pMonthCal->GetWidgetRect(rtMonth, false);
+  CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
 
   CFX_RectF rtAnchor;
   rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width,
@@ -383,8 +363,7 @@
     return;
 
   if (bActivate) {
-    CFX_RectF rtMonthCal;
-    m_pMonthCal->GetWidgetRect(rtMonthCal, true);
+    CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
     FX_FLOAT fPopupMin = rtMonthCal.height;
     FX_FLOAT fPopupMax = rtMonthCal.height;
     CFX_RectF rtAnchor(m_pProperties->m_rtWidget);
@@ -407,10 +386,11 @@
     m_pEdit->GetDelegate()->OnProcessMessage(&msg);
   }
 
-  CFX_RectF rtInvalidate, rtCal;
+  CFX_RectF rtInvalidate;
   rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
                    m_pProperties->m_rtWidget.height);
-  m_pMonthCal->GetWidgetRect(rtCal, false);
+
+  CFX_RectF rtCal = m_pMonthCal->GetWidgetRect();
   rtInvalidate.Union(rtCal);
   rtInvalidate.Inflate(2, 2);
   Repaint(&rtInvalidate);
@@ -428,8 +408,7 @@
   if (rect.Contains(fx, fy))
     return FWL_WidgetHit::Client;
   if (IsMonthCalendarVisible()) {
-    m_pMonthCal->GetWidgetRect(rect, false);
-    if (rect.Contains(fx, fy))
+    if (m_pMonthCal->GetWidgetRect().Contains(fx, fy))
       return FWL_WidgetHit::Client;
   }
   return FWL_WidgetHit::Unknown;
@@ -462,9 +441,7 @@
     return;
 
   m_fBtn = *pWidth;
-  CFX_RectF rtMonthCal;
-  m_pMonthCal->GetWidgetRect(rtMonthCal, true);
-
+  CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
   CFX_RectF rtPopUp;
   rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight,
               rtMonthCal.width, rtMonthCal.height);
@@ -472,13 +449,6 @@
   m_pMonthCal->Update();
 }
 
-void CFWL_DateTimePicker::DisForm_GetWidgetRect(CFX_RectF& rect,
-                                                bool bAutoSize) {
-  rect = m_pProperties->m_rtWidget;
-  if (DisForm_IsNeedShowButton())
-    rect.width += m_fBtn;
-}
-
 void CFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) const {
   rect = m_pProperties->m_rtWidget;
   if (DisForm_IsNeedShowButton())
@@ -486,8 +456,7 @@
   if (!IsMonthCalendarVisible())
     return;
 
-  CFX_RectF rtMonth;
-  m_pMonthCal->GetWidgetRect(rtMonth, false);
+  CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
   rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top);
   rect.Union(rtMonth);
 }
@@ -497,8 +466,7 @@
   if (!pGraphics)
     return;
   if (m_pEdit) {
-    CFX_RectF rtEdit;
-    m_pEdit->GetWidgetRect(rtEdit, false);
+    CFX_RectF rtEdit = m_pEdit->GetWidgetRect();
 
     CFX_Matrix mt;
     mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top);
@@ -509,8 +477,7 @@
   if (!IsMonthCalendarVisible())
     return;
 
-  CFX_RectF rtMonth;
-  m_pMonthCal->GetWidgetRect(rtMonth, false);
+  CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
   CFX_Matrix mt;
   mt.Set(1, 0, 0, 1, rtMonth.left, rtMonth.top);
   if (pMatrix)
diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h
index d6d47eb..e88cdc2 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.h
+++ b/xfa/fwl/core/cfwl_datetimepicker.h
@@ -42,7 +42,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
   FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
@@ -93,7 +92,6 @@
   FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) const;
   bool DisForm_IsNeedShowButton() const;
   void DisForm_Update();
-  void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize);
   void DisForm_GetBBox(CFX_RectF& rect) const;
   void DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
   void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet);
diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp
index 28ab71b..c6c0ce2 100644
--- a/xfa/fwl/core/cfwl_edit.cpp
+++ b/xfa/fwl/core/cfwl_edit.cpp
@@ -89,37 +89,35 @@
   return FWL_Type::Edit;
 }
 
-void CFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
-      if (IsShowScrollBar(true)) {
-        FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
-            GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
-        rect.width += *pfWidth;
-        rect.width += kEditMargin;
-      }
-      if (IsShowScrollBar(false)) {
-        FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
-            GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
-        rect.height += *pfWidth;
-        rect.height += kEditMargin;
-      }
+CFX_RectF CFWL_Edit::GetWidgetRect() {
+  CFX_RectF rect = m_pProperties->m_rtWidget;
+  if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
+    if (IsShowScrollBar(true)) {
+      FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
+          GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
+      rect.width += *pfWidth;
+      rect.width += kEditMargin;
     }
-    return;
+    if (IsShowScrollBar(false)) {
+      FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
+          GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
+      rect.height += *pfWidth;
+      rect.height += kEditMargin;
+    }
   }
+  return rect;
+}
 
-  rect.Set(0, 0, 0, 0);
-
-  int32_t iTextLen = m_EdtEngine.GetTextLength();
-  if (iTextLen > 0) {
-    CFX_WideString wsText = m_EdtEngine.GetText(0, -1);
+CFX_RectF CFWL_Edit::GetAutosizedWidgetRect() {
+  CFX_RectF rect;
+  if (m_EdtEngine.GetTextLength() > 0) {
     CFX_SizeF sz = CalcTextSize(
-        wsText, m_pProperties->m_pThemeProvider,
+        m_EdtEngine.GetText(0, -1), m_pProperties->m_pThemeProvider,
         !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine));
     rect.Set(0, 0, sz.x, sz.y);
   }
   InflateWidgetRect(rect);
+  return rect;
 }
 
 void CFWL_Edit::SetStates(uint32_t dwStates) {
@@ -149,15 +147,11 @@
 FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
   if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
     if (IsShowScrollBar(true)) {
-      CFX_RectF rect;
-      m_pVertScrollBar->GetWidgetRect(rect, false);
-      if (rect.Contains(fx, fy))
+      if (m_pVertScrollBar->GetWidgetRect().Contains(fx, fy))
         return FWL_WidgetHit::VScrollBar;
     }
     if (IsShowScrollBar(false)) {
-      CFX_RectF rect;
-      m_pHorzScrollBar->GetWidgetRect(rect, false);
-      if (rect.Contains(fx, fy))
+      if (m_pHorzScrollBar->GetWidgetRect().Contains(fx, fy))
         return FWL_WidgetHit::HScrollBar;
     }
   }
@@ -428,7 +422,7 @@
   if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) {
     CFWL_ScrollBar* pScroll = UpdateScroll();
     if (pScroll) {
-      pScroll->GetWidgetRect(rtInvalid, false);
+      rtInvalid = pScroll->GetWidgetRect();
       bRepaintScroll = true;
     }
   }
@@ -519,8 +513,7 @@
   if (!IsShowScrollBar(true) || !IsShowScrollBar(false))
     return;
 
-  CFX_RectF rtScroll;
-  m_pHorzScrollBar->GetWidgetRect(rtScroll, false);
+  CFX_RectF rtScroll = m_pHorzScrollBar->GetWidgetRect();
 
   CFX_RectF rtStatic;
   rtStatic.Set(m_rtClient.right() - rtScroll.height,
@@ -903,8 +896,7 @@
   const CFX_RectF& rtFDE = pPage->GetContentsBox();
   CFWL_ScrollBar* pRepaint = nullptr;
   if (bShowHorz) {
-    CFX_RectF rtScroll;
-    m_pHorzScrollBar->GetWidgetRect(rtScroll, false);
+    CFX_RectF rtScroll = m_pHorzScrollBar->GetWidgetRect();
     if (rtScroll.width < rtFDE.width) {
       m_pHorzScrollBar->LockUpdate();
       FX_FLOAT fRange = rtFDE.width - rtScroll.width;
@@ -930,8 +922,7 @@
   }
 
   if (bShowVert) {
-    CFX_RectF rtScroll;
-    m_pVertScrollBar->GetWidgetRect(rtScroll, false);
+    CFX_RectF rtScroll = m_pVertScrollBar->GetWidgetRect();
     if (rtScroll.height < rtFDE.height) {
       m_pVertScrollBar->LockUpdate();
       FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace;
@@ -1180,8 +1171,7 @@
   while (pOuter->GetOuter()) {
     pOuter = pOuter->GetOuter();
 
-    CFX_RectF rtOuter;
-    pOuter->GetWidgetRect(rtOuter, false);
+    CFX_RectF rtOuter = pOuter->GetWidgetRect();
     pRect->Offset(rtOuter.left, rtOuter.top);
   }
 
@@ -1646,8 +1636,7 @@
   UpdateOffset(pScrollBar, fPos - iCurPos);
   UpdateCaret();
 
-  CFX_RectF rect;
-  GetWidgetRect(rect, false);
+  CFX_RectF rect = GetWidgetRect();
   CFX_RectF rtInvalidate;
   rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
   Repaint(&rtInvalidate);
diff --git a/xfa/fwl/core/cfwl_edit.h b/xfa/fwl/core/cfwl_edit.h
index 8143c7d..d31f148 100644
--- a/xfa/fwl/core/cfwl_edit.h
+++ b/xfa/fwl/core/cfwl_edit.h
@@ -65,7 +65,8 @@
 
   // CFWL_Widget:
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
+  CFX_RectF GetAutosizedWidgetRect() override;
+  CFX_RectF GetWidgetRect() override;
   void Update() override;
   FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
   void SetStates(uint32_t dwStates) override;
diff --git a/xfa/fwl/core/cfwl_form.cpp b/xfa/fwl/core/cfwl_form.cpp
index 60f0de3..5b494fe 100644
--- a/xfa/fwl/core/cfwl_form.cpp
+++ b/xfa/fwl/core/cfwl_form.cpp
@@ -80,20 +80,6 @@
   return CFWL_Widget::IsInstance(wsClass);
 }
 
-void CFWL_Form::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Reset();
-  FX_FLOAT fCXBorder = GetBorderSize(true);
-  FX_FLOAT fCYBorder = GetBorderSize(false);
-  FX_FLOAT fEdge = GetEdgeWidth();
-  rect.height += fCYBorder + fEdge + fEdge;
-  rect.width += fCXBorder + fCXBorder + fEdge + fEdge;
-}
-
 void CFWL_Form::GetClientRect(CFX_RectF& rect) {
   rect = m_pProperties->m_rtWidget;
   rect.Offset(-rect.left, -rect.top);
diff --git a/xfa/fwl/core/cfwl_form.h b/xfa/fwl/core/cfwl_form.h
index fc7c47b..847256a 100644
--- a/xfa/fwl/core/cfwl_form.h
+++ b/xfa/fwl/core/cfwl_form.h
@@ -43,7 +43,6 @@
   // CFWL_Widget
   FWL_Type GetClassID() const override;
   bool IsInstance(const CFX_WideStringC& wsClass) const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void GetClientRect(CFX_RectF& rect) override;
   void Update() override;
   FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index 5dd37d1..45898b1 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -49,21 +49,6 @@
   return FWL_Type::ListBox;
 }
 
-void CFWL_ListBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Set(0, 0, 0, 0);
-  if (!m_pProperties->m_pThemeProvider)
-    m_pProperties->m_pThemeProvider = GetAvailableTheme();
-
-  CFX_SizeF fs = CalcSize(true);
-  rect.Set(0, 0, fs.x, fs.y);
-  InflateWidgetRect(rect);
-}
-
 void CFWL_ListBox::Update() {
   if (IsLocked())
     return;
@@ -95,14 +80,12 @@
 
 FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
   if (IsShowScrollBar(false)) {
-    CFX_RectF rect;
-    m_pHorzScrollBar->GetWidgetRect(rect, false);
+    CFX_RectF rect = m_pHorzScrollBar->GetWidgetRect();
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::HScrollBar;
   }
   if (IsShowScrollBar(true)) {
-    CFX_RectF rect;
-    m_pVertScrollBar->GetWidgetRect(rect, false);
+    CFX_RectF rect = m_pVertScrollBar->GetWidgetRect();
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::VScrollBar;
   }
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index 0cfe1f0..905a040 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -47,7 +47,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
   FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_monthcalendar.cpp b/xfa/fwl/core/cfwl_monthcalendar.cpp
index c182338..8a284aa 100644
--- a/xfa/fwl/core/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/core/cfwl_monthcalendar.cpp
@@ -160,15 +160,12 @@
   return FWL_Type::MonthCalendar;
 }
 
-void CFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
+CFX_RectF CFWL_MonthCalendar::GetAutosizedWidgetRect() {
   CFX_SizeF fs = CalcSize();
+  CFX_RectF rect;
   rect.Set(0, 0, fs.x, fs.y);
   InflateWidgetRect(rect);
+  return rect;
 }
 
 void CFWL_MonthCalendar::Update() {
@@ -976,9 +973,8 @@
     iOldSel = m_arrSelDays[0];
 
   int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
-  CFX_RectF rt;
   CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter);
-  pIPicker->GetFormProxy()->GetWidgetRect(rt, false);
+  CFX_RectF rt = pIPicker->GetFormProxy()->GetWidgetRect();
   rt.Set(0, 0, rt.width, rt.height);
   if (iCurSel > 0) {
     DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1);
diff --git a/xfa/fwl/core/cfwl_monthcalendar.h b/xfa/fwl/core/cfwl_monthcalendar.h
index 15912e5..7586a58 100644
--- a/xfa/fwl/core/cfwl_monthcalendar.h
+++ b/xfa/fwl/core/cfwl_monthcalendar.h
@@ -35,7 +35,7 @@
 
   // FWL_WidgetImp
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
+  CFX_RectF GetAutosizedWidgetRect() override;
   void Update() override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp
index 3c95033..96a52c9 100644
--- a/xfa/fwl/core/cfwl_picturebox.cpp
+++ b/xfa/fwl/core/cfwl_picturebox.cpp
@@ -23,16 +23,6 @@
   return FWL_Type::PictureBox;
 }
 
-void CFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Set(0, 0, 0, 0);
-  InflateWidgetRect(rect);
-}
-
 void CFWL_PictureBox::Update() {
   if (IsLocked())
     return;
diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h
index 3712704..f4ece5b 100644
--- a/xfa/fwl/core/cfwl_picturebox.h
+++ b/xfa/fwl/core/cfwl_picturebox.h
@@ -37,7 +37,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp
index a2f9b5f1..d3bf7e6 100644
--- a/xfa/fwl/core/cfwl_pushbutton.cpp
+++ b/xfa/fwl/core/cfwl_pushbutton.cpp
@@ -35,22 +35,6 @@
   return FWL_Type::PushButton;
 }
 
-void CFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Set(0, 0, 0, 0);
-  if (!m_pProperties->m_pThemeProvider)
-    m_pProperties->m_pThemeProvider = GetAvailableTheme();
-
-  FX_FLOAT* fcaption =
-      static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin));
-  rect.Inflate(*fcaption, *fcaption);
-  InflateWidgetRect(rect);
-}
-
 void CFWL_PushButton::SetStates(uint32_t dwStates) {
   if (dwStates & FWL_WGTSTATE_Disabled) {
     m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled;
diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h
index 68f2278..e5bd295 100644
--- a/xfa/fwl/core/cfwl_pushbutton.h
+++ b/xfa/fwl/core/cfwl_pushbutton.h
@@ -39,7 +39,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void SetStates(uint32_t dwStates) override;
   void Update() override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_scrollbar.cpp b/xfa/fwl/core/cfwl_scrollbar.cpp
index 8b3ce51..6c2ad99 100644
--- a/xfa/fwl/core/cfwl_scrollbar.cpp
+++ b/xfa/fwl/core/cfwl_scrollbar.cpp
@@ -62,25 +62,6 @@
   return FWL_Type::ScrollBar;
 }
 
-void CFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Set(0, 0, 0, 0);
-  FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>(
-      GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
-  if (!pfMinWidth)
-    return;
-  if (IsVertical())
-    rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3);
-  else
-    rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth));
-
-  InflateWidgetRect(rect);
-}
-
 void CFWL_ScrollBar::Update() {
   if (IsLocked())
     return;
diff --git a/xfa/fwl/core/cfwl_scrollbar.h b/xfa/fwl/core/cfwl_scrollbar.h
index fb44af6..f1eb35b 100644
--- a/xfa/fwl/core/cfwl_scrollbar.h
+++ b/xfa/fwl/core/cfwl_scrollbar.h
@@ -29,7 +29,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
diff --git a/xfa/fwl/core/cfwl_spinbutton.cpp b/xfa/fwl/core/cfwl_spinbutton.cpp
index 03ec5af..68844f9 100644
--- a/xfa/fwl/core/cfwl_spinbutton.cpp
+++ b/xfa/fwl/core/cfwl_spinbutton.cpp
@@ -20,9 +20,6 @@
 #include "xfa/fwl/core/ifwl_themeprovider.h"
 
 namespace {
-
-const int kMinWidth = 18;
-const int kMinHeight = 32;
 const int kElapseTime = 200;
 
 }  // namespace
@@ -49,16 +46,6 @@
   return FWL_Type::SpinButton;
 }
 
-void CFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-
-  rect.Set(0, 0, kMinWidth, kMinHeight);
-  InflateWidgetRect(rect);
-}
-
 void CFWL_SpinButton::Update() {
   if (IsLocked())
     return;
diff --git a/xfa/fwl/core/cfwl_spinbutton.h b/xfa/fwl/core/cfwl_spinbutton.h
index fd2f02e..dc48007 100644
--- a/xfa/fwl/core/cfwl_spinbutton.h
+++ b/xfa/fwl/core/cfwl_spinbutton.h
@@ -26,7 +26,6 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
   FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
   void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp
index 80ff57c..225721b 100644
--- a/xfa/fwl/core/cfwl_widget.cpp
+++ b/xfa/fwl/core/cfwl_widget.cpp
@@ -65,12 +65,12 @@
   return false;
 }
 
-void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
-  if (!bAutoSize) {
-    rect = m_pProperties->m_rtWidget;
-    return;
-  }
-  InflateWidgetRect(rect);
+CFX_RectF CFWL_Widget::GetAutosizedWidgetRect() {
+  return CFX_RectF();
+}
+
+CFX_RectF CFWL_Widget::GetWidgetRect() {
+  return m_pProperties->m_rtWidget;
 }
 
 void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) {
@@ -201,7 +201,7 @@
   CFX_Matrix m;
   CFWL_Widget* parent = GetParent();
   if (parent) {
-    GetWidgetRect(r, false);
+    r = GetWidgetRect();
     fx += r.left;
     fy += r.top;
     GetMatrix(m, true);
@@ -210,8 +210,9 @@
   CFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this);
   if (!form1)
     return;
+
   if (!pWidget) {
-    form1->GetWidgetRect(r, false);
+    r = form1->GetWidgetRect();
     fx += r.left;
     fy += r.top;
     return;
@@ -220,10 +221,10 @@
   if (!form2)
     return;
   if (form1 != form2) {
-    form1->GetWidgetRect(r, false);
+    r = form1->GetWidgetRect();
     fx += r.left;
     fy += r.top;
-    form2->GetWidgetRect(r, false);
+    r = form2->GetWidgetRect();
     fx -= r.left;
     fy -= r.top;
   }
@@ -234,7 +235,7 @@
     m1.SetIdentity();
     m1.SetReverse(m);
     m1.TransformPoint(fx, fy);
-    pWidget->GetWidgetRect(r, false);
+    r = pWidget->GetWidgetRect();
     fx -= r.left;
     fy -= r.top;
   }
@@ -261,7 +262,7 @@
   for (int32_t i = count - 2; i >= 0; i--) {
     parent = parents.GetAt(i);
     parent->GetMatrix(ctmOnParent, false);
-    parent->GetWidgetRect(rect, false);
+    rect = parent->GetWidgetRect();
     matrix.Concat(ctmOnParent, true);
     matrix.Translate(rect.left, rect.top, true);
   }
@@ -686,8 +687,7 @@
 
   CFWL_Widget* pDstWidget = GetParent();
   while (pDstWidget && pDstWidget != pParent) {
-    CFX_RectF rtDst;
-    pDstWidget->GetWidgetRect(rtDst, false);
+    CFX_RectF rtDst = pDstWidget->GetWidgetRect();
     szRet += CFX_SizeF(rtDst.left, rtDst.top);
     pDstWidget = pWidgetMgr->GetParentWidget(pDstWidget);
   }
diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h
index 3272e9d..15acbf5 100644
--- a/xfa/fwl/core/cfwl_widget.h
+++ b/xfa/fwl/core/cfwl_widget.h
@@ -51,7 +51,8 @@
 
   virtual FWL_Type GetClassID() const = 0;
   virtual bool IsInstance(const CFX_WideStringC& wsClass) const;
-  virtual void GetWidgetRect(CFX_RectF& rect, bool bAutoSize);
+  virtual CFX_RectF GetAutosizedWidgetRect();
+  virtual CFX_RectF GetWidgetRect();
   virtual void GetClientRect(CFX_RectF& rect);
   virtual void ModifyStylesEx(uint32_t dwStylesExAdded,
                               uint32_t dwStylesExRemoved);
diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp
index 1649ee7..5bcef7b 100644
--- a/xfa/fwl/core/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/core/cfwl_widgetmgr.cpp
@@ -157,8 +157,7 @@
   if (IsFormDisabled()) {
     CFWL_Widget* pOuter = pWidget->GetOuter();
     while (pOuter) {
-      CFX_RectF rtTemp;
-      pNative->GetWidgetRect(rtTemp, false);
+      CFX_RectF rtTemp = pNative->GetWidgetRect();
       rect.left += rtTemp.left;
       rect.top += rtTemp.top;
       pNative = pOuter;
@@ -304,8 +303,7 @@
       m.SetIdentity();
       m.SetReverse(matrixOnParent);
       m.TransformPoint(x1, y1);
-      CFX_RectF bounds;
-      child->GetWidgetRect(bounds, false);
+      CFX_RectF bounds = child->GetWidgetRect();
       if (bounds.Contains(x1, y1)) {
         x1 -= bounds.left;
         y1 -= bounds.top;
@@ -473,8 +471,7 @@
     return;
 
   CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix);
-  CFX_RectF clipCopy;
-  pWidget->GetWidgetRect(clipCopy, false);
+  CFX_RectF clipCopy = pWidget->GetWidgetRect();
   clipCopy.left = clipCopy.top = 0;
 
   if (UseOffscreenDirect(pWidget)) {
@@ -527,8 +524,7 @@
     if (child->GetStates() & FWL_WGTSTATE_Invisible)
       continue;
 
-    CFX_RectF rtWidget;
-    child->GetWidgetRect(rtWidget, false);
+    CFX_RectF rtWidget = child->GetWidgetRect();
     if (rtWidget.IsEmpty())
       continue;
 
@@ -572,8 +568,7 @@
   Item* pItem = GetWidgetMgrItem(pWidget);
   if (!pItem->pOffscreen) {
     pItem->pOffscreen.reset(new CFX_Graphics);
-    CFX_RectF rect;
-    pWidget->GetWidgetRect(rect, false);
+    CFX_RectF rect = pWidget->GetWidgetRect();
     pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height,
                               FXDIB_Argb);
   }
@@ -608,8 +603,7 @@
     return true;
   }
 
-  CFX_RectF rtWidget;
-  pWidget->GetWidgetRect(rtWidget, false);
+  CFX_RectF rtWidget = pWidget->GetWidgetRect();
   rtWidget.left = rtWidget.top = 0;
   pMatrix->TransformRect(rtWidget);
   if (!rtWidget.IntersectWith(rtDirty))
@@ -645,8 +639,7 @@
   hitPoint[10].hitPoint.y = hitPoint[11].hitPoint.y =
       rtWidget.height + rtWidget.top;
   do {
-    CFX_RectF rect;
-    pChild->GetWidgetRect(rect, false);
+    CFX_RectF rect = pChild->GetWidgetRect();
     CFX_RectF r = rect;
     r.left += rtWidget.left;
     r.top += rtWidget.top;
@@ -706,8 +699,7 @@
 
 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
   if (pItem->bOutsideChanged) {
-    CFX_RectF r;
-    pWidget->GetWidgetRect(r, false);
+    CFX_RectF r = pWidget->GetWidgetRect();
     CFX_RectF temp(m_rtScreen);
     temp.Deflate(50, 50);
     if (!temp.Contains(r))
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index 8c42bcf..6f83173 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -157,8 +157,7 @@
   CXFA_Border borderUI = m_pDataAcc->GetUIBorder();
   DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
   RenderCaption(pGS, &mtRotate);
-  CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget, false);
+  CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
   CFX_Matrix mt;
   mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
   mt.Concat(mtRotate);
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 136a99c..9b55047 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -69,8 +69,8 @@
   DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
   RenderCaption(pGS, &mtRotate);
   DrawHighlight(pGS, &mtRotate, dwStatus, false);
-  CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget, false);
+
+  CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
   CFX_Matrix mt;
   mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
   mt.Concat(mtRotate);
@@ -363,15 +363,16 @@
   TranslateFWLMessage(&ms);
   return true;
 }
+
 void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) {
-  if (!m_pNormalWidget) {
+  if (!m_pNormalWidget)
     return;
-  }
-  CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget, false);
+
+  CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect();
   fx -= rtWidget.left;
   fy -= rtWidget.top;
 }
+
 bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
   if (!m_pNormalWidget) {
     return false;
@@ -585,20 +586,15 @@
     return FWL_WidgetHit::Titlebar;
   return FWL_WidgetHit::Border;
 }
+
 bool CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) {
   return true;
 }
+
 bool CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
-  if (!m_pNormalWidget) {
-    return false;
-  }
-  CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget, false);
-  if (rtWidget.Contains(fx, fy)) {
-    return true;
-  }
-  return false;
+  return m_pNormalWidget && m_pNormalWidget->GetWidgetRect().Contains(fx, fy);
 }
+
 void CXFA_FFField::LayoutCaption() {
   CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
   if (!pCapTextLayout)
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index e9156ba..8ee6510 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -61,8 +61,7 @@
   DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
   RenderCaption(pGS, &mtRotate);
   if (CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage()) {
-    CFX_RectF rtImage;
-    m_pNormalWidget->GetWidgetRect(rtImage, false);
+    CFX_RectF rtImage = m_pNormalWidget->GetWidgetRect();
     int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left;
     int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top;
     if (CXFA_Para para = m_pDataAcc->GetPara()) {
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index a26714a..a2b11e8 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -214,8 +214,7 @@
   if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) {
     if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
         (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
-      CFX_RectF rtFill;
-      m_pNormalWidget->GetWidgetRect(rtFill, false);
+      CFX_RectF rtFill = m_pNormalWidget->GetWidgetRect();
       rtFill.left = rtFill.top = 0;
       FX_FLOAT fLineWith = GetLineWidth();
       rtFill.Deflate(fLineWith, fLineWith);
@@ -236,8 +235,8 @@
       pGraphics->SetLineWidth(fLineWidth);
       CFX_Path path;
       path.Create();
-      CFX_RectF rect;
-      m_pNormalWidget->GetWidgetRect(rect, false);
+
+      CFX_RectF rect = m_pNormalWidget->GetWidgetRect();
       path.AddRectangle(0, 0, rect.width, rect.height);
       pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix);
     }