Cleanup default FWL params part I

This Cl removes some of the default FWL parameters.

Review-Url: https://codereview.chromium.org/2533623002
diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h
index 05c2375..66b47ce 100644
--- a/xfa/fwl/core/cfwl_barcode.h
+++ b/xfa/fwl/core/cfwl_barcode.h
@@ -46,8 +46,7 @@
   // CFWL_Widget
   FWL_Type GetClassID() const override;
   void Update() override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessEvent(CFWL_Event* pEvent) override;
 
   // CFWL_Edit
diff --git a/xfa/fwl/core/cfwl_caret.cpp b/xfa/fwl/core/cfwl_caret.cpp
index b42945c..0457347 100644
--- a/xfa/fwl/core/cfwl_caret.cpp
+++ b/xfa/fwl/core/cfwl_caret.cpp
@@ -59,7 +59,7 @@
   if (m_pTimerInfo)
     m_pTimerInfo->StopTimer();
   m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true);
-  SetStates(FWL_WGTSTATE_Invisible, false);
+  RemoveStates(FWL_WGTSTATE_Invisible);
 }
 
 void CFWL_Caret::HideCaret() {
@@ -67,7 +67,7 @@
     m_pTimerInfo->StopTimer();
     m_pTimerInfo = nullptr;
   }
-  SetStates(FWL_WGTSTATE_Invisible, true);
+  SetStates(FWL_WGTSTATE_Invisible);
 }
 
 void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics,
@@ -77,7 +77,7 @@
     return;
 
   CFX_RectF rect;
-  GetWidgetRect(rect);
+  GetWidgetRect(rect, false);
   rect.Set(0, 0, rect.width, rect.height);
 
   CFWL_ThemeBackground param;
@@ -102,11 +102,13 @@
 
 void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
   CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget);
-  pCaret->SetStates(FWL_STATE_CAT_HightLight,
-                    !(pCaret->GetStates() & FWL_STATE_CAT_HightLight));
+  if (!(pCaret->GetStates() & FWL_STATE_CAT_HightLight))
+    pCaret->SetStates(FWL_STATE_CAT_HightLight);
+  else
+    pCaret->RemoveStates(FWL_STATE_CAT_HightLight);
 
   CFX_RectF rt;
-  pCaret->GetWidgetRect(rt);
+  pCaret->GetWidgetRect(rt, false);
   rt.Set(0, 0, rt.width + 1, rt.height);
   pCaret->Repaint(&rt);
 }
diff --git a/xfa/fwl/core/cfwl_caret.h b/xfa/fwl/core/cfwl_caret.h
index ada0405..aa718b7 100644
--- a/xfa/fwl/core/cfwl_caret.h
+++ b/xfa/fwl/core/cfwl_caret.h
@@ -27,8 +27,7 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
                     const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp
index dc042d5..5b147bd 100644
--- a/xfa/fwl/core/cfwl_checkbox.cpp
+++ b/xfa/fwl/core/cfwl_checkbox.cpp
@@ -309,7 +309,7 @@
               pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
             pCheckBox->SetCheckState(0);
             CFX_RectF rt;
-            pCheckBox->GetWidgetRect(rt);
+            pCheckBox->GetWidgetRect(rt, false);
             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 71497a3..ace09e5 100644
--- a/xfa/fwl/core/cfwl_checkbox.h
+++ b/xfa/fwl/core/cfwl_checkbox.h
@@ -55,10 +55,9 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
+  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
 
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index c8486c3..70f8635 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -124,7 +124,7 @@
     m_pEdit->SetOuter(this);
     m_pEdit->SetParent(this);
   } else if (bRemoveDropDown && m_pEdit) {
-    m_pEdit->SetStates(FWL_WGTSTATE_Invisible, true);
+    m_pEdit->SetStates(FWL_WGTSTATE_Invisible);
   }
   CFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
 }
@@ -276,12 +276,20 @@
   m_iCurSel = bClearSel ? -1 : iSel;
 }
 
-void CFWL_ComboBox::SetStates(uint32_t dwStates, bool bSet) {
+void CFWL_ComboBox::SetStates(uint32_t dwStates) {
   if (IsDropDownStyle() && m_pEdit)
-    m_pEdit->SetStates(dwStates, bSet);
+    m_pEdit->SetStates(dwStates);
   if (m_pListBox)
-    m_pListBox->SetStates(dwStates, bSet);
-  CFWL_Widget::SetStates(dwStates, bSet);
+    m_pListBox->SetStates(dwStates);
+  CFWL_Widget::SetStates(dwStates);
+}
+
+void CFWL_ComboBox::RemoveStates(uint32_t dwStates) {
+  if (IsDropDownStyle() && m_pEdit)
+    m_pEdit->RemoveStates(dwStates);
+  if (m_pListBox)
+    m_pListBox->RemoveStates(dwStates);
+  CFWL_Widget::RemoveStates(dwStates);
 }
 
 void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
@@ -319,7 +327,7 @@
     return;
 
   CFX_RectF rtList;
-  m_pListBox->GetWidgetRect(rtList);
+  m_pListBox->GetWidgetRect(rtList, false);
   rtList.Offset(rect.left, rect.top);
   rect.Union(rtList);
 }
@@ -635,14 +643,16 @@
     SetFocus(true);
   }
 
-  m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate);
   if (bActivate) {
+    m_pListBox->RemoveStates(FWL_WGTSTATE_Invisible);
     CFWL_Event postEvent(CFWL_Event::Type::PostDropDown, this);
     DispatchEvent(&postEvent);
+  } else {
+    m_pListBox->SetStates(FWL_WGTSTATE_Invisible);
   }
 
   CFX_RectF rect;
-  m_pListBox->GetWidgetRect(rect);
+  m_pListBox->GetWidgetRect(rect, false);
   rect.Inflate(2, 2);
   Repaint(&rect);
 }
@@ -683,7 +693,7 @@
   if (m_rtBtn.Contains(fx, fy))
     return FWL_WidgetHit::Client;
   if (DisForm_IsDropListVisible()) {
-    m_pListBox->GetWidgetRect(rect);
+    m_pListBox->GetWidgetRect(rect, false);
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::Client;
   }
@@ -713,7 +723,7 @@
 
   if (m_pEdit) {
     CFX_RectF rtEdit;
-    m_pEdit->GetWidgetRect(rtEdit);
+    m_pEdit->GetWidgetRect(rtEdit, false);
     CFX_Matrix mt;
     mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top);
     mt.Concat(mtOrg);
@@ -721,7 +731,7 @@
   }
   if (m_pListBox && DisForm_IsDropListVisible()) {
     CFX_RectF rtList;
-    m_pListBox->GetWidgetRect(rtList);
+    m_pListBox->GetWidgetRect(rtList, false);
     CFX_Matrix mt;
     mt.Set(1, 0, 0, 1, rtList.left, rtList.top);
     mt.Concat(mtOrg);
@@ -735,7 +745,7 @@
     return;
 
   CFX_RectF rtList;
-  m_pListBox->GetWidgetRect(rtList);
+  m_pListBox->GetWidgetRect(rtList, false);
   rtList.Offset(rect.left, rect.top);
   rect.Union(rtList);
 }
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index b9f4897..dda8348 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -54,14 +54,14 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
+  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void ModifyStylesEx(uint32_t dwStylesExAdded,
                       uint32_t dwStylesExRemoved) override;
-  void SetStates(uint32_t dwStates, bool bSet = true) override;
+  void SetStates(uint32_t dwStates) override;
+  void RemoveStates(uint32_t dwStates) override;
   void Update() override;
   FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnProcessEvent(CFWL_Event* pEvent) override;
diff --git a/xfa/fwl/core/cfwl_comboboxproxy.cpp b/xfa/fwl/core/cfwl_comboboxproxy.cpp
index 4fb6bbb..be45f2b 100644
--- a/xfa/fwl/core/cfwl_comboboxproxy.cpp
+++ b/xfa/fwl/core/cfwl_comboboxproxy.cpp
@@ -71,7 +71,7 @@
   CFWL_NoteDriver* pDriver =
       static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
   CFX_RectF rtWidget;
-  GetWidgetRect(rtWidget);
+  GetWidgetRect(rtWidget, false);
   rtWidget.left = rtWidget.top = 0;
 
   CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
@@ -101,7 +101,7 @@
 
   CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
   CFX_RectF rect;
-  GetWidgetRect(rect);
+  GetWidgetRect(rect, false);
   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 ad80ac0..7532da2 100644
--- a/xfa/fwl/core/cfwl_combolist.cpp
+++ b/xfa/fwl/core/cfwl_combolist.cpp
@@ -87,7 +87,7 @@
     CFWL_ScrollBar* vertSB = GetVertScrollBar();
     if (IsShowScrollBar(true) && vertSB) {
       CFX_RectF rect;
-      vertSB->GetWidgetRect(rect);
+      vertSB->GetWidgetRect(rect, false);
       if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
         pMsg->m_fx -= rect.left;
         pMsg->m_fy -= rect.top;
@@ -141,7 +141,7 @@
     CFWL_ScrollBar* vertSB = GetVertScrollBar();
     if (IsShowScrollBar(true) && vertSB) {
       CFX_RectF rect;
-      vertSB->GetWidgetRect(rect);
+      vertSB->GetWidgetRect(rect, false);
       if (rect.Contains(pMsg->m_fx, pMsg->m_fy))
         return;
     }
@@ -177,7 +177,7 @@
   CFWL_ScrollBar* vertSB = GetVertScrollBar();
   if (IsShowScrollBar(true) && vertSB) {
     CFX_RectF rect;
-    vertSB->GetWidgetRect(rect);
+    vertSB->GetWidgetRect(rect, false);
     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 dc7aa1f..fc3edcf 100644
--- a/xfa/fwl/core/cfwl_datetimeedit.cpp
+++ b/xfa/fwl/core/cfwl_datetimeedit.cpp
@@ -51,7 +51,7 @@
         static_cast<CFWL_DateTimePicker*>(m_pOuter);
     if (pDateTime->IsMonthCalendarVisible()) {
       CFX_RectF rtInvalidate;
-      pDateTime->GetWidgetRect(rtInvalidate);
+      pDateTime->GetWidgetRect(rtInvalidate, false);
       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 28f174c..29aaaf0 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -129,7 +129,7 @@
     return FWL_WidgetHit::Client;
   if (IsMonthCalendarVisible()) {
     CFX_RectF rect;
-    m_pMonthCal->GetWidgetRect(rect);
+    m_pMonthCal->GetWidgetRect(rect, false);
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::Client;
   }
@@ -210,7 +210,7 @@
   rect = m_pProperties->m_rtWidget;
   if (IsMonthCalendarVisible()) {
     CFX_RectF rtMonth;
-    m_pMonthCal->GetWidgetRect(rtMonth);
+    m_pMonthCal->GetWidgetRect(rtMonth, false);
     rtMonth.Offset(m_pProperties->m_rtWidget.left,
                    m_pProperties->m_rtWidget.top);
     rect.Union(rtMonth);
@@ -268,7 +268,7 @@
   }
 
   CFX_RectF rtMonth;
-  m_pMonthCal->GetWidgetRect(rtMonth);
+  m_pMonthCal->GetWidgetRect(rtMonth, false);
 
   CFX_RectF rtAnchor;
   rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width,
@@ -277,7 +277,10 @@
   m_pForm->SetWidgetRect(rtMonth);
 
   rtMonth.left = rtMonth.top = 0;
-  m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate);
+  if (bActivate)
+    m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible);
+  else
+    m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible);
   m_pMonthCal->SetWidgetRect(rtMonth);
   m_pMonthCal->Update();
   m_pForm->DoModal();
@@ -395,7 +398,10 @@
       m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay);
     m_pMonthCal->Update();
   }
-  m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate);
+  if (bActivate)
+    m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible);
+  else
+    m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible);
 
   if (bActivate) {
     CFWL_MsgSetFocus msg(m_pEdit.get(), m_pMonthCal.get());
@@ -405,7 +411,7 @@
   CFX_RectF rtInvalidate, rtCal;
   rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
                    m_pProperties->m_rtWidget.height);
-  m_pMonthCal->GetWidgetRect(rtCal);
+  m_pMonthCal->GetWidgetRect(rtCal, false);
   rtInvalidate.Union(rtCal);
   rtInvalidate.Inflate(2, 2);
   Repaint(&rtInvalidate);
@@ -423,7 +429,7 @@
   if (rect.Contains(fx, fy))
     return FWL_WidgetHit::Client;
   if (IsMonthCalendarVisible()) {
-    m_pMonthCal->GetWidgetRect(rect);
+    m_pMonthCal->GetWidgetRect(rect, false);
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::Client;
   }
@@ -482,7 +488,7 @@
     return;
 
   CFX_RectF rtMonth;
-  m_pMonthCal->GetWidgetRect(rtMonth);
+  m_pMonthCal->GetWidgetRect(rtMonth, false);
   rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top);
   rect.Union(rtMonth);
 }
@@ -493,7 +499,7 @@
     return;
   if (m_pEdit) {
     CFX_RectF rtEdit;
-    m_pEdit->GetWidgetRect(rtEdit);
+    m_pEdit->GetWidgetRect(rtEdit, false);
 
     CFX_Matrix mt;
     mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top);
@@ -505,7 +511,7 @@
     return;
 
   CFX_RectF rtMonth;
-  m_pMonthCal->GetWidgetRect(rtMonth);
+  m_pMonthCal->GetWidgetRect(rtMonth, false);
   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 69e4ef3..9856274 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.h
+++ b/xfa/fwl/core/cfwl_datetimepicker.h
@@ -42,11 +42,10 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) 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 = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void SetThemeProvider(IFWL_ThemeProvider* pTP) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
@@ -89,7 +88,7 @@
   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 = false);
+  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 = nullptr);
diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp
index 0844da3..a2fee2a 100644
--- a/xfa/fwl/core/cfwl_edit.cpp
+++ b/xfa/fwl/core/cfwl_edit.cpp
@@ -122,12 +122,12 @@
   CFWL_Widget::GetWidgetRect(rect, true);
 }
 
-void CFWL_Edit::SetStates(uint32_t dwStates, bool bSet) {
+void CFWL_Edit::SetStates(uint32_t dwStates) {
   if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) ||
       (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
     HideCaret(nullptr);
   }
-  CFWL_Widget::SetStates(dwStates, bSet);
+  CFWL_Widget::SetStates(dwStates);
 }
 
 void CFWL_Edit::Update() {
@@ -150,13 +150,13 @@
   if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
     if (IsShowScrollBar(true)) {
       CFX_RectF rect;
-      m_pVertScrollBar->GetWidgetRect(rect);
+      m_pVertScrollBar->GetWidgetRect(rect, false);
       if (rect.Contains(fx, fy))
         return FWL_WidgetHit::VScrollBar;
     }
     if (IsShowScrollBar(false)) {
       CFX_RectF rect;
-      m_pHorzScrollBar->GetWidgetRect(rect);
+      m_pHorzScrollBar->GetWidgetRect(rect, false);
       if (rect.Contains(fx, fy))
         return FWL_WidgetHit::HScrollBar;
     }
@@ -432,7 +432,7 @@
   if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) {
     CFWL_ScrollBar* pScroll = UpdateScroll();
     if (pScroll) {
-      pScroll->GetWidgetRect(rtInvalid);
+      pScroll->GetWidgetRect(rtInvalid, false);
       bRepaintScroll = true;
     }
   }
@@ -529,13 +529,13 @@
   if (!IsShowScrollBar(true) || !IsShowScrollBar(false))
     return;
 
-  CFX_RectF rtScorll;
-  m_pHorzScrollBar->GetWidgetRect(rtScorll);
+  CFX_RectF rtScroll;
+  m_pHorzScrollBar->GetWidgetRect(rtScroll, false);
 
   CFX_RectF rtStatic;
-  rtStatic.Set(m_rtClient.right() - rtScorll.height,
-               m_rtClient.bottom() - rtScorll.height, rtScorll.height,
-               rtScorll.height);
+  rtStatic.Set(m_rtClient.right() - rtScroll.height,
+               m_rtClient.bottom() - rtScroll.height, rtScroll.height,
+               rtScroll.height);
   param.m_bStaticBackground = true;
   param.m_bMaximize = true;
   param.m_rtPart = rtStatic;
@@ -914,7 +914,7 @@
   CFWL_ScrollBar* pRepaint = nullptr;
   if (bShowHorz) {
     CFX_RectF rtScroll;
-    m_pHorzScrollBar->GetWidgetRect(rtScroll);
+    m_pHorzScrollBar->GetWidgetRect(rtScroll, false);
     if (rtScroll.width < rtFDE.width) {
       m_pHorzScrollBar->LockUpdate();
       FX_FLOAT fRange = rtFDE.width - rtScroll.width;
@@ -925,14 +925,14 @@
       m_pHorzScrollBar->SetTrackPos(fPos);
       m_pHorzScrollBar->SetPageSize(rtScroll.width);
       m_pHorzScrollBar->SetStepSize(rtScroll.width / 10);
-      m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, false);
+      m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Disabled);
       m_pHorzScrollBar->UnlockUpdate();
       m_pHorzScrollBar->Update();
       pRepaint = m_pHorzScrollBar.get();
     } else if ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) {
       m_pHorzScrollBar->LockUpdate();
       m_pHorzScrollBar->SetRange(0, -1);
-      m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, true);
+      m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled);
       m_pHorzScrollBar->UnlockUpdate();
       m_pHorzScrollBar->Update();
       pRepaint = m_pHorzScrollBar.get();
@@ -941,7 +941,7 @@
 
   if (bShowVert) {
     CFX_RectF rtScroll;
-    m_pVertScrollBar->GetWidgetRect(rtScroll);
+    m_pVertScrollBar->GetWidgetRect(rtScroll, false);
     if (rtScroll.height < rtFDE.height) {
       m_pVertScrollBar->LockUpdate();
       FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace;
@@ -953,14 +953,14 @@
       m_pVertScrollBar->SetTrackPos(fPos);
       m_pVertScrollBar->SetPageSize(rtScroll.height);
       m_pVertScrollBar->SetStepSize(fStep);
-      m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, false);
+      m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Disabled);
       m_pVertScrollBar->UnlockUpdate();
       m_pVertScrollBar->Update();
       pRepaint = m_pVertScrollBar.get();
     } else if ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) {
       m_pVertScrollBar->LockUpdate();
       m_pVertScrollBar->SetRange(0, -1);
-      m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, true);
+      m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled);
       m_pVertScrollBar->UnlockUpdate();
       m_pVertScrollBar->Update();
       pRepaint = m_pVertScrollBar.get();
@@ -1054,10 +1054,10 @@
     }
 
     m_pVertScrollBar->SetWidgetRect(rtVertScr);
-    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false);
+    m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
     m_pVertScrollBar->Update();
   } else if (m_pVertScrollBar) {
-    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true);
+    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible);
   }
 
   if (bShowHorzScrollbar) {
@@ -1075,10 +1075,10 @@
       m_rtEngine.height -= fWidth;
     }
     m_pHorzScrollBar->SetWidgetRect(rtHoriScr);
-    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false);
+    m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
     m_pHorzScrollBar->Update();
   } else if (m_pHorzScrollBar) {
-    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true);
+    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible);
   }
 }
 
@@ -1110,9 +1110,9 @@
       m_pVertScrollBar->SetWidgetRect(rtVertScr);
       m_pVertScrollBar->Update();
     }
-    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false);
+    m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
   } else if (m_pVertScrollBar) {
-    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true);
+    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible);
   }
 
   if (bShowHorzScrollbar) {
@@ -1137,9 +1137,9 @@
       m_pHorzScrollBar->SetWidgetRect(rtHoriScr);
       m_pHorzScrollBar->Update();
     }
-    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false);
+    m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
   } else if (m_pHorzScrollBar) {
-    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true);
+    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible);
   }
   if (bShowVertScrollbar || bShowHorzScrollbar)
     UpdateScroll();
@@ -1182,7 +1182,7 @@
     pOuter = pOuter->GetOuter();
 
     CFX_RectF rtOuter;
-    pOuter->GetWidgetRect(rtOuter);
+    pOuter->GetWidgetRect(rtOuter, false);
     pRect->Offset(rtOuter.left, rtOuter.top);
   }
 
@@ -1648,7 +1648,7 @@
   UpdateCaret();
 
   CFX_RectF rect;
-  GetWidgetRect(rect);
+  GetWidgetRect(rect, false);
   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 b8b3b14..0e5f0dc 100644
--- a/xfa/fwl/core/cfwl_edit.h
+++ b/xfa/fwl/core/cfwl_edit.h
@@ -65,12 +65,11 @@
 
   // CFWL_Widget:
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
+  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
   FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
-  void SetStates(uint32_t dwStates, bool bSet = true) override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void SetStates(uint32_t dwStates) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnProcessEvent(CFWL_Event* pEvent) override;
diff --git a/xfa/fwl/core/cfwl_form.cpp b/xfa/fwl/core/cfwl_form.cpp
index 00d47d4..1fe5e90 100644
--- a/xfa/fwl/core/cfwl_form.cpp
+++ b/xfa/fwl/core/cfwl_form.cpp
@@ -281,7 +281,7 @@
 
   pDriver->PushNoteLoop(m_pNoteLoop.get());
   m_bDoModalFlag = true;
-  SetStates(FWL_WGTSTATE_Invisible, false);
+  RemoveStates(FWL_WGTSTATE_Invisible);
   pDriver->Run();
 
 #if _FX_OS_ != _FX_MACOSX_
@@ -310,9 +310,9 @@
     return;
 
   pDriver->PopNoteLoop();
-  SetStates(FWL_WGTSTATE_Invisible, true);
+  SetStates(FWL_WGTSTATE_Invisible);
 #else
-  SetStates(FWL_WGTSTATE_Invisible, true);
+  SetStates(FWL_WGTSTATE_Invisible);
   m_pNoteLoop->EndModalLoop();
 #endif
 }
diff --git a/xfa/fwl/core/cfwl_form.h b/xfa/fwl/core/cfwl_form.h
index db09c66..fc7c47b 100644
--- a/xfa/fwl/core/cfwl_form.h
+++ b/xfa/fwl/core/cfwl_form.h
@@ -43,12 +43,11 @@
   // CFWL_Widget
   FWL_Type GetClassID() const override;
   bool IsInstance(const CFX_WideStringC& wsClass) const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) 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;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
                     const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_formproxy.h b/xfa/fwl/core/cfwl_formproxy.h
index db8323b..9c12597 100644
--- a/xfa/fwl/core/cfwl_formproxy.h
+++ b/xfa/fwl/core/cfwl_formproxy.h
@@ -24,8 +24,7 @@
   FWL_Type GetClassID() const override;
   bool IsInstance(const CFX_WideStringC& wsClass) const override;
   void Update() override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
 };
 
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index be9e8b9..7589623 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -96,13 +96,13 @@
 FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
   if (IsShowScrollBar(false)) {
     CFX_RectF rect;
-    m_pHorzScrollBar->GetWidgetRect(rect);
+    m_pHorzScrollBar->GetWidgetRect(rect, false);
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::HScrollBar;
   }
   if (IsShowScrollBar(true)) {
     CFX_RectF rect;
-    m_pVertScrollBar->GetWidgetRect(rect);
+    m_pVertScrollBar->GetWidgetRect(rect, false);
     if (rect.Contains(fx, fy))
       return FWL_WidgetHit::VScrollBar;
   }
@@ -645,13 +645,13 @@
     if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ==
             0 ||
         (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)) {
-      m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false);
+      m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
     }
     m_pVertScrollBar->Update();
   } else if (m_pVertScrollBar) {
     m_pVertScrollBar->SetPos(0);
     m_pVertScrollBar->SetTrackPos(0);
-    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true);
+    m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible);
   }
   if (bShowHorzScr) {
     if (!m_pHorzScrollBar)
@@ -676,13 +676,13 @@
     if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) ==
             0 ||
         (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)) {
-      m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false);
+      m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
     }
     m_pHorzScrollBar->Update();
   } else if (m_pHorzScrollBar) {
     m_pHorzScrollBar->SetPos(0);
     m_pHorzScrollBar->SetTrackPos(0);
-    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true);
+    m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible);
   }
   if (bShowVertScr && bShowHorzScr) {
     m_rtStatic.Set(m_rtClient.right() - m_fScorllBarWidth,
@@ -830,10 +830,18 @@
 
 void CFWL_ListBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
   if (GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) {
-    if (m_pVertScrollBar)
-      m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet);
-    if (m_pHorzScrollBar)
-      m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet);
+    if (m_pVertScrollBar) {
+      if (bSet)
+        m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
+      else
+        m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible);
+    }
+    if (m_pHorzScrollBar) {
+      if (bSet)
+        m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible);
+      else
+        m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible);
+    }
   }
   if (bSet)
     m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused);
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index d2f439e..e9e59eb 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -47,11 +47,10 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) 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 = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnProcessEvent(CFWL_Event* pEvent) override;
diff --git a/xfa/fwl/core/cfwl_monthcalendar.cpp b/xfa/fwl/core/cfwl_monthcalendar.cpp
index a550d31..76426cd 100644
--- a/xfa/fwl/core/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/core/cfwl_monthcalendar.cpp
@@ -995,7 +995,7 @@
   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);
+  pIPicker->GetFormProxy()->GetWidgetRect(rt, false);
   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 6c004aa..1a983ab 100644
--- a/xfa/fwl/core/cfwl_monthcalendar.h
+++ b/xfa/fwl/core/cfwl_monthcalendar.h
@@ -35,10 +35,9 @@
 
   // FWL_WidgetImp
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
+  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
                     const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h
index f409733..3712704 100644
--- a/xfa/fwl/core/cfwl_picturebox.h
+++ b/xfa/fwl/core/cfwl_picturebox.h
@@ -37,10 +37,9 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
+  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
                     const CFX_Matrix* pMatrix) override;
 
diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp
index 295de1e..9e1e693 100644
--- a/xfa/fwl/core/cfwl_pushbutton.cpp
+++ b/xfa/fwl/core/cfwl_pushbutton.cpp
@@ -51,12 +51,12 @@
   CFWL_Widget::GetWidgetRect(rect, true);
 }
 
-void CFWL_PushButton::SetStates(uint32_t dwStates, bool bSet) {
-  if ((dwStates & FWL_WGTSTATE_Disabled) && bSet) {
+void CFWL_PushButton::SetStates(uint32_t dwStates) {
+  if (dwStates & FWL_WGTSTATE_Disabled) {
     m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled;
     return;
   }
-  CFWL_Widget::SetStates(dwStates, bSet);
+  CFWL_Widget::SetStates(dwStates);
 }
 
 void CFWL_PushButton::Update() {
diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h
index 3bfae6c..68f2278 100644
--- a/xfa/fwl/core/cfwl_pushbutton.h
+++ b/xfa/fwl/core/cfwl_pushbutton.h
@@ -39,11 +39,10 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
-  void SetStates(uint32_t dwStates, bool bSet = true) 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 = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
                     const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_scrollbar.h b/xfa/fwl/core/cfwl_scrollbar.h
index 98bcaf2..5e9c0b5 100644
--- a/xfa/fwl/core/cfwl_scrollbar.h
+++ b/xfa/fwl/core/cfwl_scrollbar.h
@@ -29,10 +29,9 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
+  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override;
   void Update() override;
-  void DrawWidget(CFX_Graphics* pGraphics,
-                  const CFX_Matrix* pMatrix = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(CFX_Graphics* pGraphics,
                     const CFX_Matrix* pMatrix) override;
diff --git a/xfa/fwl/core/cfwl_spinbutton.h b/xfa/fwl/core/cfwl_spinbutton.h
index 391d55c..2993663 100644
--- a/xfa/fwl/core/cfwl_spinbutton.h
+++ b/xfa/fwl/core/cfwl_spinbutton.h
@@ -26,11 +26,10 @@
 
   // CFWL_Widget
   FWL_Type GetClassID() const override;
-  void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) 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 = nullptr) override;
+  void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
   void OnProcessMessage(CFWL_Message* pMessage) override;
   void OnDrawWidget(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 d487aad..8989563 100644
--- a/xfa/fwl/core/cfwl_widget.cpp
+++ b/xfa/fwl/core/cfwl_widget.cpp
@@ -136,10 +136,9 @@
   }
 }
 
-void CFWL_Widget::SetStates(uint32_t dwStates, bool bSet) {
-  bSet ? (m_pProperties->m_dwStates |= dwStates)
-       : (m_pProperties->m_dwStates &= ~dwStates);
-  if (!(dwStates & FWL_WGTSTATE_Invisible) || !bSet)
+void CFWL_Widget::SetStates(uint32_t dwStates) {
+  m_pProperties->m_dwStates |= dwStates;
+  if (!(dwStates & FWL_WGTSTATE_Invisible))
     return;
 
   CFWL_NoteDriver* noteDriver =
@@ -155,6 +154,10 @@
   return;
 }
 
+void CFWL_Widget::RemoveStates(uint32_t dwStates) {
+  m_pProperties->m_dwStates &= ~dwStates;
+}
+
 FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
   CFX_RectF rtClient;
   GetClientRect(rtClient);
@@ -195,7 +198,7 @@
   CFX_Matrix m;
   CFWL_Widget* parent = GetParent();
   if (parent) {
-    GetWidgetRect(r);
+    GetWidgetRect(r, false);
     fx += r.left;
     fy += r.top;
     GetMatrix(m, true);
@@ -205,7 +208,7 @@
   if (!form1)
     return;
   if (!pWidget) {
-    form1->GetWidgetRect(r);
+    form1->GetWidgetRect(r, false);
     fx += r.left;
     fy += r.top;
     return;
@@ -214,10 +217,10 @@
   if (!form2)
     return;
   if (form1 != form2) {
-    form1->GetWidgetRect(r);
+    form1->GetWidgetRect(r, false);
     fx += r.left;
     fy += r.top;
-    form2->GetWidgetRect(r);
+    form2->GetWidgetRect(r, false);
     fx -= r.left;
     fy -= r.top;
   }
@@ -228,7 +231,7 @@
     m1.SetIdentity();
     m1.SetReverse(m);
     m1.TransformPoint(fx, fy);
-    pWidget->GetWidgetRect(r);
+    pWidget->GetWidgetRect(r, false);
     fx -= r.left;
     fy -= r.top;
   }
@@ -255,7 +258,7 @@
   for (int32_t i = count - 2; i >= 0; i--) {
     parent = parents.GetAt(i);
     parent->GetMatrix(ctmOnParent, false);
-    parent->GetWidgetRect(rect);
+    parent->GetWidgetRect(rect, false);
     matrix.Concat(ctmOnParent, true);
     matrix.Translate(rect.left, rect.top, true);
   }
@@ -684,7 +687,7 @@
   CFWL_Widget* pDstWidget = GetParent();
   while (pDstWidget && pDstWidget != pParent) {
     CFX_RectF rtDst;
-    pDstWidget->GetWidgetRect(rtDst);
+    pDstWidget->GetWidgetRect(rtDst, false);
     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 5e9660c..a17c623 100644
--- a/xfa/fwl/core/cfwl_widget.h
+++ b/xfa/fwl/core/cfwl_widget.h
@@ -51,15 +51,16 @@
 
   virtual FWL_Type GetClassID() const = 0;
   virtual bool IsInstance(const CFX_WideStringC& wsClass) const;
-  virtual void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false);
+  virtual void GetWidgetRect(CFX_RectF& rect, bool bAutoSize);
   virtual void GetClientRect(CFX_RectF& rect);
   virtual void ModifyStylesEx(uint32_t dwStylesExAdded,
                               uint32_t dwStylesExRemoved);
-  virtual void SetStates(uint32_t dwStates, bool bSet = true);
+  virtual void SetStates(uint32_t dwStates);
+  virtual void RemoveStates(uint32_t dwStates);
   virtual void Update() = 0;
   virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
   virtual void DrawWidget(CFX_Graphics* pGraphics,
-                          const CFX_Matrix* pMatrix = nullptr) = 0;
+                          const CFX_Matrix* pMatrix) = 0;
   virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
 
   // IFWL_WidgetDelegate.
diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp
index 1514aee..fc9f150 100644
--- a/xfa/fwl/core/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/core/cfwl_widgetmgr.cpp
@@ -184,7 +184,7 @@
     CFWL_Widget* pOuter = pWidget->GetOuter();
     while (pOuter) {
       CFX_RectF rtTemp;
-      pNative->GetWidgetRect(rtTemp);
+      pNative->GetWidgetRect(rtTemp, false);
       rect.left += rtTemp.left;
       rect.top += rtTemp.top;
       pNative = pOuter;
@@ -333,7 +333,7 @@
       m.SetReverse(matrixOnParent);
       m.TransformPoint(x1, y1);
       CFX_RectF bounds;
-      child->GetWidgetRect(bounds);
+      child->GetWidgetRect(bounds, false);
       if (bounds.Contains(x1, y1)) {
         x1 -= bounds.left;
         y1 -= bounds.top;
@@ -502,7 +502,7 @@
 
   CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix);
   CFX_RectF clipCopy;
-  pWidget->GetWidgetRect(clipCopy);
+  pWidget->GetWidgetRect(clipCopy, false);
   clipCopy.left = clipCopy.top = 0;
 
   if (UseOffscreenDirect(pWidget)) {
@@ -556,7 +556,7 @@
       continue;
 
     CFX_RectF rtWidget;
-    child->GetWidgetRect(rtWidget);
+    child->GetWidgetRect(rtWidget, false);
     if (rtWidget.IsEmpty())
       continue;
 
@@ -601,7 +601,7 @@
   if (!pItem->pOffscreen) {
     pItem->pOffscreen.reset(new CFX_Graphics);
     CFX_RectF rect;
-    pWidget->GetWidgetRect(rect);
+    pWidget->GetWidgetRect(rect, false);
     pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height,
                               FXDIB_Argb);
   }
@@ -637,7 +637,7 @@
   }
 
   CFX_RectF rtWidget;
-  pWidget->GetWidgetRect(rtWidget);
+  pWidget->GetWidgetRect(rtWidget, false);
   rtWidget.left = rtWidget.top = 0;
   pMatrix->TransformRect(rtWidget);
   if (!rtWidget.IntersectWith(rtDirty))
@@ -674,7 +674,7 @@
       rtWidget.height + rtWidget.top;
   do {
     CFX_RectF rect;
-    pChild->GetWidgetRect(rect);
+    pChild->GetWidgetRect(rect, false);
     CFX_RectF r = rect;
     r.left += rtWidget.left;
     r.top += rtWidget.top;
@@ -735,7 +735,7 @@
 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
   if (pItem->bOutsideChanged) {
     CFX_RectF r;
-    pWidget->GetWidgetRect(r);
+    pWidget->GetWidgetRect(r, false);
     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 f89f846..8c42bcf 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -158,7 +158,7 @@
   DrawBorder(pGS, borderUI, m_rtUI, &mtRotate);
   RenderCaption(pGS, &mtRotate);
   CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget);
+  m_pNormalWidget->GetWidgetRect(rtWidget, false);
   CFX_Matrix mt;
   mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
   mt.Concat(mtRotate);
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index dab6b2c..47b628c 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -277,10 +277,12 @@
 }
 void CXFA_FFCheckButton::SetFWLCheckState(XFA_CHECKSTATE eCheckState) {
   if (eCheckState == XFA_CHECKSTATE_Neutral) {
-    m_pNormalWidget->SetStates(FWL_STATE_CKB_Neutral, true);
+    m_pNormalWidget->SetStates(FWL_STATE_CKB_Neutral);
   } else {
-    m_pNormalWidget->SetStates(FWL_STATE_CKB_Checked,
-                               eCheckState == XFA_CHECKSTATE_On);
+    if (eCheckState == XFA_CHECKSTATE_On)
+      m_pNormalWidget->SetStates(FWL_STATE_CKB_Checked);
+    else
+      m_pNormalWidget->RemoveStates(FWL_STATE_CKB_Checked);
   }
 }
 bool CXFA_FFCheckButton::UpdateFWLData() {
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 689a0b5..136a99c 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -70,7 +70,7 @@
   RenderCaption(pGS, &mtRotate);
   DrawHighlight(pGS, &mtRotate, dwStatus, false);
   CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget);
+  m_pNormalWidget->GetWidgetRect(rtWidget, false);
   CFX_Matrix mt;
   mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top);
   mt.Concat(mtRotate);
@@ -368,7 +368,7 @@
     return;
   }
   CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget);
+  m_pNormalWidget->GetWidgetRect(rtWidget, false);
   fx -= rtWidget.left;
   fy -= rtWidget.top;
 }
@@ -593,7 +593,7 @@
     return false;
   }
   CFX_RectF rtWidget;
-  m_pNormalWidget->GetWidgetRect(rtWidget);
+  m_pNormalWidget->GetWidgetRect(rtWidget, false);
   if (rtWidget.Contains(fx, fy)) {
     return true;
   }
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index 3506cc9..e9156ba 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -62,7 +62,7 @@
   RenderCaption(pGS, &mtRotate);
   if (CFX_DIBitmap* pDIBitmap = m_pDataAcc->GetImageEditImage()) {
     CFX_RectF rtImage;
-    m_pNormalWidget->GetWidgetRect(rtImage);
+    m_pNormalWidget->GetWidgetRect(rtImage, false);
     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 df093a0..a26714a 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -215,7 +215,7 @@
     if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
         (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
       CFX_RectF rtFill;
-      m_pNormalWidget->GetWidgetRect(rtFill);
+      m_pNormalWidget->GetWidgetRect(rtFill, false);
       rtFill.left = rtFill.top = 0;
       FX_FLOAT fLineWith = GetLineWidth();
       rtFill.Deflate(fLineWith, fLineWith);
@@ -237,7 +237,7 @@
       CFX_Path path;
       path.Create();
       CFX_RectF rect;
-      m_pNormalWidget->GetWidgetRect(rect);
+      m_pNormalWidget->GetWidgetRect(rect, false);
       path.AddRectangle(0, 0, rect.width, rect.height);
       pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix);
     }