Make CFWL_ThemePart::m_iPart const and private

Bug: pdfium:1680
Change-Id: I45cca06b38a92fe26848e5a1b20060fe6563728d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/96650
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp
index eb9075a..9f7d439 100644
--- a/xfa/fwl/cfwl_barcode.cpp
+++ b/xfa/fwl/cfwl_barcode.cpp
@@ -145,7 +145,7 @@
     return;
 
   IFWL_ThemeProvider* pTheme = GetThemeProvider();
-  CFWL_ThemePart part(this);
+  CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
   if (RetainPtr<CFGAS_GEFont> pFont = pTheme->GetFont(part)) {
     if (CFX_Font* pCXFont = pFont->GetDevFont())
       m_pBarcodeEngine->SetFont(pCXFont);
diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp
index 5535d87..6e0eea9 100644
--- a/xfa/fwl/cfwl_caret.cpp
+++ b/xfa/fwl/cfwl_caret.cpp
@@ -61,9 +61,9 @@
   if (!(m_Properties.m_dwStates & kStateHighlight))
     return;
 
-  CFWL_ThemeBackground param(this, pGraphics);
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
+                             pGraphics);
   param.m_PartRect = CFX_RectF(0, 0, GetWidgetRect().Size());
-  param.m_iPart = CFWL_ThemePart::Part::kBackground;
   param.m_dwStates = CFWL_PartState::kHightLight;
   param.m_matrix = mtMatrix;
   GetThemeProvider()->DrawBackground(param);
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index bb6c5ea..3c91fc5 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -59,23 +59,26 @@
     DrawBorder(pGraphics, CFWL_ThemePart::Part::kBorder, matrix);
 
   Mask<CFWL_PartState> dwStates = GetPartStates();
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kBackground;
+  IFWL_ThemeProvider* pTheme = GetThemeProvider();
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
+                             pGraphics);
   param.m_dwStates = dwStates;
   param.m_matrix = matrix;
   param.m_PartRect = m_ClientRect;
   if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
     param.m_pRtData = &m_FocusRect;
-
-  IFWL_ThemeProvider* pTheme = GetThemeProvider();
   pTheme->DrawBackground(param);
 
-  param.m_iPart = CFWL_ThemePart::Part::kCheckBox;
-  param.m_PartRect = m_BoxRect;
-  pTheme->DrawBackground(param);
+  CFWL_ThemeBackground checkParam(CFWL_ThemePart::Part::kCheckBox, this,
+                                  pGraphics);
+  checkParam.m_dwStates = dwStates;
+  checkParam.m_matrix = matrix;
+  checkParam.m_PartRect = m_BoxRect;
+  if (m_Properties.m_dwStates & FWL_STATE_WGT_Focused)
+    checkParam.m_pRtData = &m_FocusRect;
+  pTheme->DrawBackground(checkParam);
 
-  CFWL_ThemeText textParam(this, pGraphics);
-  textParam.m_iPart = CFWL_ThemePart::Part::kCaption;
+  CFWL_ThemeText textParam(CFWL_ThemePart::Part::kCaption, this, pGraphics);
   textParam.m_dwStates = dwStates;
   textParam.m_matrix = matrix;
   textParam.m_PartRect = m_CaptionRect;
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index c9d3a52..fccba32 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -106,8 +106,8 @@
   if (!m_BtnRect.IsEmpty(0.1f)) {
     CFGAS_GEGraphics::StateRestorer restorer(pGraphics);
     pGraphics->ConcatMatrix(matrix);
-    CFWL_ThemeBackground param(this, pGraphics);
-    param.m_iPart = CFWL_ThemePart::Part::kDropDownButton;
+    CFWL_ThemeBackground param(CFWL_ThemePart::Part::kDropDownButton, this,
+                               pGraphics);
     param.m_dwStates = m_iBtnState;
     param.m_PartRect = m_BtnRect;
     GetThemeProvider()->DrawBackground(param);
@@ -279,7 +279,7 @@
                   fBtn - borderWidth, m_ClientRect.height - 2 * borderWidth);
   }
 
-  CFWL_ThemePart part(this);
+  CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
   CFX_RectF pUIMargin = theme->GetUIMargin(part);
   m_ContentRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
                         pUIMargin.height);
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index f15df41..ca3b13c 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -183,8 +183,8 @@
 
 void CFWL_DateTimePicker::DrawDropDownButton(CFGAS_GEGraphics* pGraphics,
                                              const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kDropDownButton;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kDropDownButton, this,
+                             pGraphics);
   param.m_dwStates = m_iBtnState;
   param.m_PartRect = m_BtnRect;
   param.m_matrix = mtMatrix;
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index bdd3e0a..eec85b1 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -323,9 +323,9 @@
       path.AddLine(CFX_PointF(fLeft, m_ClientRect.top),
                    CFX_PointF(fLeft, m_ClientRect.bottom()));
     }
-    CFWL_ThemeBackground param(this, pGraphics);
+    CFWL_ThemeBackground param(CFWL_ThemePart::Part::kCombTextLine, this,
+                               pGraphics);
     param.m_matrix = mtMatrix;
-    param.m_iPart = CFWL_ThemePart::Part::kCombTextLine;
     param.SetPath(&path);
     GetThemeProvider()->DrawBackground(param);
   }
@@ -358,9 +358,9 @@
     }
     pGraphics->SetClipRect(rtClip);
 
-    CFWL_ThemeBackground param(this, pGraphics);
+    CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
+                               pGraphics);
     param.m_matrix = mtMatrix;
-    param.m_iPart = CFWL_ThemePart::Part::kBackground;
     param.SetPath(&path);
     GetThemeProvider()->DrawBackground(param);
   }
@@ -461,7 +461,7 @@
   m_pEditEngine->LimitHorizontalScroll(!auto_hscroll);
 
   IFWL_ThemeProvider* theme = GetThemeProvider();
-  CFWL_ThemePart part(this);
+  CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
   m_fFontSize = theme->GetFontSize(part);
 
   RetainPtr<CFGAS_GEFont> pFont = theme->GetFont(part);
@@ -530,7 +530,7 @@
 
 void CFWL_Edit::UpdateVAlignment() {
   IFWL_ThemeProvider* theme = GetThemeProvider();
-  CFWL_ThemePart part(this);
+  CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
   const CFX_SizeF pSpace = theme->GetSpaceAboveBelow(part);
   const float fSpaceAbove = pSpace.width >= 0.1f ? pSpace.width : 0.0f;
   const float fSpaceBelow = pSpace.height >= 0.1f ? pSpace.height : 0.0f;
@@ -622,12 +622,12 @@
   IFWL_ThemeProvider* theme = GetThemeProvider();
   float fWidth = theme->GetScrollBarWidth();
   if (!GetOuter()) {
-    CFWL_ThemePart part(this);
+    CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
     CFX_RectF pUIMargin = theme->GetUIMargin(part);
     m_EngineRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
                          pUIMargin.height);
   } else if (GetOuter()->GetClassID() == FWL_Type::DateTimePicker) {
-    CFWL_ThemePart part(GetOuter());
+    CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, GetOuter());
     CFX_RectF pUIMargin = theme->GetUIMargin(part);
     m_EngineRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
                          pUIMargin.height);
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index ce2ddff..6fafb64 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -317,8 +317,8 @@
   if (!pGraphics)
     return;
 
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kBackground;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
+                             pGraphics);
   param.m_matrix = mtMatrix;
   param.m_PartRect = m_ClientRect;
   if (IsShowHorzScrollBar() && IsShowVertScrollBar())
@@ -377,8 +377,8 @@
   }
 
   CFX_RectF rtFocus(rtItem);  // Must outlive |bg_param|.
-  CFWL_ThemeBackground bg_param(this, pGraphics);
-  bg_param.m_iPart = CFWL_ThemePart::Part::kListItem;
+  CFWL_ThemeBackground bg_param(CFWL_ThemePart::Part::kListItem, this,
+                                pGraphics);
   bg_param.m_dwStates = dwPartStates;
   bg_param.m_matrix = mtMatrix;
   bg_param.m_PartRect = rtItem;
@@ -403,8 +403,7 @@
   CFX_RectF rtText(rtItem);
   rtText.Deflate(kItemTextMargin, kItemTextMargin);
 
-  CFWL_ThemeText textParam(this, pGraphics);
-  textParam.m_iPart = CFWL_ThemePart::Part::kListItem;
+  CFWL_ThemeText textParam(CFWL_ThemePart::Part::kListItem, this, pGraphics);
   textParam.m_dwStates = dwPartStates;
   textParam.m_matrix = mtMatrix;
   textParam.m_PartRect = rtText;
@@ -420,7 +419,7 @@
   m_ContentRect = m_ClientRect;
   CFX_RectF rtUIMargin;
   if (!GetOuter()) {
-    CFWL_ThemePart part(this);
+    CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
     CFX_RectF pUIMargin = GetThemeProvider()->GetUIMargin(part);
     m_ContentRect.Deflate(pUIMargin.left, pUIMargin.top, pUIMargin.width,
                           pUIMargin.height);
@@ -547,7 +546,7 @@
 }
 
 float CFWL_ListBox::CalcItemHeight() {
-  CFWL_ThemePart part(this);
+  CFWL_ThemePart part(CFWL_ThemePart::Part::kNone, this);
   return GetThemeProvider()->GetFontSize(part) + 2 * kItemTextMargin;
 }
 
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index cd2cb68..ea2d303 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -151,8 +151,8 @@
 
 void CFWL_MonthCalendar::DrawBackground(CFGAS_GEGraphics* pGraphics,
                                         const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kBackground;
+  CFWL_ThemeBackground params(CFWL_ThemePart::Part::kBackground, this,
+                              pGraphics);
   params.m_PartRect = m_ClientRect;
   params.m_matrix = mtMatrix;
   GetThemeProvider()->DrawBackground(params);
@@ -160,8 +160,7 @@
 
 void CFWL_MonthCalendar::DrawHeadBK(CFGAS_GEGraphics* pGraphics,
                                     const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kHeader;
+  CFWL_ThemeBackground params(CFWL_ThemePart::Part::kHeader, this, pGraphics);
   params.m_PartRect = m_HeadRect;
   params.m_matrix = mtMatrix;
   GetThemeProvider()->DrawBackground(params);
@@ -169,8 +168,7 @@
 
 void CFWL_MonthCalendar::DrawLButton(CFGAS_GEGraphics* pGraphics,
                                      const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kLBtn;
+  CFWL_ThemeBackground params(CFWL_ThemePart::Part::kLBtn, this, pGraphics);
   params.m_dwStates = m_iLBtnPartStates;
   params.m_PartRect = m_LBtnRect;
   params.m_matrix = mtMatrix;
@@ -179,8 +177,7 @@
 
 void CFWL_MonthCalendar::DrawRButton(CFGAS_GEGraphics* pGraphics,
                                      const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kRBtn;
+  CFWL_ThemeBackground params(CFWL_ThemePart::Part::kRBtn, this, pGraphics);
   params.m_dwStates = m_iRBtnPartStates;
   params.m_PartRect = m_RBtnRect;
   params.m_matrix = mtMatrix;
@@ -189,8 +186,7 @@
 
 void CFWL_MonthCalendar::DrawCaption(CFGAS_GEGraphics* pGraphics,
                                      const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeText textParam(this, pGraphics);
-  textParam.m_iPart = CFWL_ThemePart::Part::kCaption;
+  CFWL_ThemeText textParam(CFWL_ThemePart::Part::kCaption, this, pGraphics);
   textParam.m_wsText = GetHeadText(m_iCurYear, m_iCurMonth);
   m_HeadSize = CalcTextSize(textParam.m_wsText, false);
   CalcHeadSize();
@@ -203,8 +199,8 @@
 
 void CFWL_MonthCalendar::DrawSeparator(CFGAS_GEGraphics* pGraphics,
                                        const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kHSeparator;
+  CFWL_ThemeBackground params(CFWL_ThemePart::Part::kHSeparator, this,
+                              pGraphics);
   params.m_PartRect = m_HSepRect;
   params.m_matrix = mtMatrix;
   GetThemeProvider()->DrawBackground(params);
@@ -212,8 +208,7 @@
 
 void CFWL_MonthCalendar::DrawDatesInBK(CFGAS_GEGraphics* pGraphics,
                                        const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kDateInBK;
+  CFWL_ThemeBackground params(CFWL_ThemePart::Part::kDateInBK, this, pGraphics);
   params.m_matrix = mtMatrix;
 
   IFWL_ThemeProvider* pTheme = GetThemeProvider();
@@ -239,8 +234,7 @@
 
 void CFWL_MonthCalendar::DrawWeek(CFGAS_GEGraphics* pGraphics,
                                   const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeText params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kWeek;
+  CFWL_ThemeText params(CFWL_ThemePart::Part::kWeek, this, pGraphics);
   params.m_iTTOAlign = FDE_TextAlignment::kCenter;
   params.m_dwTTOStyles.single_line_ = true;
   params.m_matrix = mtMatrix;
@@ -260,8 +254,7 @@
 
 void CFWL_MonthCalendar::DrawToday(CFGAS_GEGraphics* pGraphics,
                                    const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeText params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kToday;
+  CFWL_ThemeText params(CFWL_ThemePart::Part::kToday, this, pGraphics);
   params.m_iTTOAlign = FDE_TextAlignment::kCenterLeft;
   params.m_wsText = GetTodayText(m_iYear, m_iMonth, m_iDay);
   m_TodaySize = CalcTextSize(params.m_wsText, false);
@@ -274,8 +267,7 @@
 
 void CFWL_MonthCalendar::DrawDatesIn(CFGAS_GEGraphics* pGraphics,
                                      const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeText params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kDatesIn;
+  CFWL_ThemeText params(CFWL_ThemePart::Part::kDatesIn, this, pGraphics);
   params.m_iTTOAlign = FDE_TextAlignment::kCenter;
   params.m_matrix = mtMatrix;
 
@@ -296,8 +288,7 @@
 
 void CFWL_MonthCalendar::DrawDatesOut(CFGAS_GEGraphics* pGraphics,
                                       const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeText params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kDatesOut;
+  CFWL_ThemeText params(CFWL_ThemePart::Part::kDatesOut, this, pGraphics);
   params.m_iTTOAlign = FDE_TextAlignment::kCenter;
   params.m_matrix = mtMatrix;
   GetThemeProvider()->DrawText(params);
@@ -315,8 +306,8 @@
   if (!pDate)
     return;
 
-  CFWL_ThemeBackground params(this, pGraphics);
-  params.m_iPart = CFWL_ThemePart::Part::kDateInCircle;
+  CFWL_ThemeBackground params(CFWL_ThemePart::Part::kDateInCircle, this,
+                              pGraphics);
   params.m_PartRect = pDate->rect;
   params.m_matrix = mtMatrix;
   GetThemeProvider()->DrawBackground(params);
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index 9d17565..04df051 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -55,8 +55,8 @@
 
 void CFWL_PushButton::DrawBkground(CFGAS_GEGraphics* pGraphics,
                                    const CFX_Matrix& matrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kBackground;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackground, this,
+                             pGraphics);
   param.m_dwStates = GetPartStates();
   param.m_matrix = matrix;
   param.m_PartRect = m_ClientRect;
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index 4176d46..499daa5 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -74,8 +74,8 @@
 
 void CFWL_ScrollBar::DrawUpperTrack(CFGAS_GEGraphics* pGraphics,
                                     const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kUpperTrack;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kUpperTrack, this,
+                             pGraphics);
   param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
                          ? CFWL_PartState::kDisabled
                          : m_iMaxTrackState;
@@ -86,8 +86,8 @@
 
 void CFWL_ScrollBar::DrawLowerTrack(CFGAS_GEGraphics* pGraphics,
                                     const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kLowerTrack;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kLowerTrack, this,
+                             pGraphics);
   param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
                          ? CFWL_PartState::kDisabled
                          : m_iMinTrackState;
@@ -98,8 +98,7 @@
 
 void CFWL_ScrollBar::DrawMaxArrowBtn(CFGAS_GEGraphics* pGraphics,
                                      const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kBackArrow;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kBackArrow, this, pGraphics);
   param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
                          ? CFWL_PartState::kDisabled
                          : m_iMaxButtonState;
@@ -111,8 +110,7 @@
 
 void CFWL_ScrollBar::DrawMinArrowBtn(CFGAS_GEGraphics* pGraphics,
                                      const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kForeArrow;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kForeArrow, this, pGraphics);
   param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
                          ? CFWL_PartState::kDisabled
                          : m_iMinButtonState;
@@ -124,8 +122,7 @@
 
 void CFWL_ScrollBar::DrawThumb(CFGAS_GEGraphics* pGraphics,
                                const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = CFWL_ThemePart::Part::kThumb;
+  CFWL_ThemeBackground param(CFWL_ThemePart::Part::kThumb, this, pGraphics);
   param.m_dwStates = (m_Properties.m_dwStates & FWL_STATE_WGT_Disabled)
                          ? CFWL_PartState::kDisabled
                          : m_iThumbButtonState;
diff --git a/xfa/fwl/cfwl_themebackground.cpp b/xfa/fwl/cfwl_themebackground.cpp
index 54d5cb9..de633f9 100644
--- a/xfa/fwl/cfwl_themebackground.cpp
+++ b/xfa/fwl/cfwl_themebackground.cpp
@@ -6,8 +6,9 @@
 
 #include "xfa/fwl/cfwl_themebackground.h"
 
-CFWL_ThemeBackground::CFWL_ThemeBackground(CFWL_Widget* pWidget,
+CFWL_ThemeBackground::CFWL_ThemeBackground(Part iPart,
+                                           CFWL_Widget* pWidget,
                                            CFGAS_GEGraphics* pGraphics)
-    : CFWL_ThemePart(pWidget), m_pGraphics(pGraphics) {}
+    : CFWL_ThemePart(iPart, pWidget), m_pGraphics(pGraphics) {}
 
 CFWL_ThemeBackground::~CFWL_ThemeBackground() = default;
diff --git a/xfa/fwl/cfwl_themebackground.h b/xfa/fwl/cfwl_themebackground.h
index c252cf8..ac678ab 100644
--- a/xfa/fwl/cfwl_themebackground.h
+++ b/xfa/fwl/cfwl_themebackground.h
@@ -18,7 +18,9 @@
  public:
   FX_STACK_ALLOCATED();
 
-  CFWL_ThemeBackground(CFWL_Widget* pWidget, CFGAS_GEGraphics* pGraphics);
+  CFWL_ThemeBackground(Part iPart,
+                       CFWL_Widget* pWidget,
+                       CFGAS_GEGraphics* pGraphics);
   ~CFWL_ThemeBackground();
 
   CFGAS_GEGraphics* GetGraphics() const { return m_pGraphics.Get(); }
diff --git a/xfa/fwl/cfwl_themepart.cpp b/xfa/fwl/cfwl_themepart.cpp
index 090712e..d9029bd 100644
--- a/xfa/fwl/cfwl_themepart.cpp
+++ b/xfa/fwl/cfwl_themepart.cpp
@@ -6,7 +6,8 @@
 
 #include "xfa/fwl/cfwl_themepart.h"
 
-CFWL_ThemePart::CFWL_ThemePart(CFWL_Widget* pWidget) : m_pWidget(pWidget) {}
+CFWL_ThemePart::CFWL_ThemePart(Part iPart, CFWL_Widget* pWidget)
+    : m_iPart(iPart), m_pWidget(pWidget) {}
 
 CFWL_ThemePart::~CFWL_ThemePart() = default;
 
diff --git a/xfa/fwl/cfwl_themepart.h b/xfa/fwl/cfwl_themepart.h
index e286620..f728acb 100644
--- a/xfa/fwl/cfwl_themepart.h
+++ b/xfa/fwl/cfwl_themepart.h
@@ -84,9 +84,10 @@
 
   FX_STACK_ALLOCATED();
 
-  explicit CFWL_ThemePart(CFWL_Widget* pWidget);
+  CFWL_ThemePart(Part iPart, CFWL_Widget* pWidget);
   ~CFWL_ThemePart();
 
+  Part GetPart() const { return m_iPart; }
   CFWL_Widget* GetWidget() const { return m_pWidget.Get(); }
   FWLTHEME_STATE GetThemeState() const;
 
@@ -94,11 +95,11 @@
   CFX_RectF m_PartRect;
   UnownedPtr<const CFX_RectF> m_pRtData;
   Mask<CFWL_PartState> m_dwStates = CFWL_PartState::kNormal;
-  Part m_iPart = Part::kNone;
   bool m_bMaximize = false;
   bool m_bStaticBackground = false;
 
  private:
+  const Part m_iPart;
   UnownedPtr<CFWL_Widget> const m_pWidget;
 };
 
diff --git a/xfa/fwl/cfwl_themetext.cpp b/xfa/fwl/cfwl_themetext.cpp
index 7349aa8..c60d60a 100644
--- a/xfa/fwl/cfwl_themetext.cpp
+++ b/xfa/fwl/cfwl_themetext.cpp
@@ -6,8 +6,9 @@
 
 #include "xfa/fwl/cfwl_themetext.h"
 
-CFWL_ThemeText::CFWL_ThemeText(CFWL_Widget* pWidget,
+CFWL_ThemeText::CFWL_ThemeText(Part iPart,
+                               CFWL_Widget* pWidget,
                                CFGAS_GEGraphics* pGraphics)
-    : CFWL_ThemePart(pWidget), m_pGraphics(pGraphics) {}
+    : CFWL_ThemePart(iPart, pWidget), m_pGraphics(pGraphics) {}
 
 CFWL_ThemeText::~CFWL_ThemeText() = default;
diff --git a/xfa/fwl/cfwl_themetext.h b/xfa/fwl/cfwl_themetext.h
index aa164f7..faf1df8 100644
--- a/xfa/fwl/cfwl_themetext.h
+++ b/xfa/fwl/cfwl_themetext.h
@@ -19,7 +19,7 @@
  public:
   FX_STACK_ALLOCATED();
 
-  CFWL_ThemeText(CFWL_Widget* pWidget, CFGAS_GEGraphics* pGraphics);
+  CFWL_ThemeText(Part iPart, CFWL_Widget* pWidget, CFGAS_GEGraphics* pGraphics);
   ~CFWL_ThemeText();
 
   CFGAS_GEGraphics* GetGraphics() const { return m_pGraphics.Get(); }
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index a5328ac..b6f1860 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -228,7 +228,7 @@
 }
 
 CFX_SizeF CFWL_Widget::CalcTextSize(const WideString& wsText, bool bMultiLine) {
-  CFWL_ThemeText calPart(this, nullptr);
+  CFWL_ThemeText calPart(CFWL_ThemePart::Part::kNone, this, nullptr);
   calPart.m_wsText = wsText;
   if (bMultiLine)
     calPart.m_dwTTOStyles.line_wrap_ = true;
@@ -246,7 +246,7 @@
                                const FDE_TextStyle& dwTTOStyles,
                                FDE_TextAlignment iTTOAlign,
                                CFX_RectF* pRect) {
-  CFWL_ThemeText calPart(this, nullptr);
+  CFWL_ThemeText calPart(CFWL_ThemePart::Part::kNone, this, nullptr);
   calPart.m_wsText = wsText;
   calPart.m_dwTTOStyles = dwTTOStyles;
   calPart.m_iTTOAlign = iTTOAlign;
@@ -279,8 +279,7 @@
 void CFWL_Widget::DrawBackground(CFGAS_GEGraphics* pGraphics,
                                  CFWL_ThemePart::Part iPartBk,
                                  const CFX_Matrix& mtMatrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = iPartBk;
+  CFWL_ThemeBackground param(iPartBk, this, pGraphics);
   param.m_matrix = mtMatrix;
   param.m_PartRect = GetRelativeRect();
   GetThemeProvider()->DrawBackground(param);
@@ -289,8 +288,7 @@
 void CFWL_Widget::DrawBorder(CFGAS_GEGraphics* pGraphics,
                              CFWL_ThemePart::Part iPartBorder,
                              const CFX_Matrix& matrix) {
-  CFWL_ThemeBackground param(this, pGraphics);
-  param.m_iPart = iPartBorder;
+  CFWL_ThemeBackground param(iPartBorder, this, pGraphics);
   param.m_matrix = matrix;
   param.m_PartRect = GetRelativeRect();
   GetThemeProvider()->DrawBackground(param);
diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp
index 12f071c..dad6e03 100644
--- a/xfa/fwl/theme/cfwl_barcodetp.cpp
+++ b/xfa/fwl/theme/cfwl_barcodetp.cpp
@@ -15,7 +15,7 @@
 CFWL_BarcodeTP::~CFWL_BarcodeTP() = default;
 
 void CFWL_BarcodeTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder:
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index b40b810..59a5de4 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -18,7 +18,7 @@
 CFWL_CaretTP::~CFWL_CaretTP() = default;
 
 void CFWL_CaretTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBackground: {
       if (!(pParams.m_dwStates & CFWL_PartState::kHightLight))
         return;
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index cee86f7..389f878 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -207,7 +207,7 @@
 }
 
 void CFWL_CheckBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  if (pParams.m_iPart != CFWL_ThemePart::Part::kCheckBox)
+  if (pParams.GetPart() != CFWL_ThemePart::Part::kCheckBox)
     return;
 
   if ((pParams.m_dwStates & CFWL_PartState::kChecked) ||
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index 65f8f19..50931d2 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -18,7 +18,7 @@
 CFWL_ComboBoxTP::~CFWL_ComboBoxTP() = default;
 
 void CFWL_ComboBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder: {
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
index 24df85b..ee4b068 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
@@ -15,7 +15,7 @@
 
 void CFWL_DateTimePickerTP::DrawBackground(
     const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder:
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index cc52473..db80be2 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -18,7 +18,7 @@
 CFWL_EditTP::~CFWL_EditTP() = default;
 
 void CFWL_EditTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder: {
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index d0ed06f..bd8ec80 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -19,7 +19,7 @@
 CFWL_ListBoxTP::~CFWL_ListBoxTP() = default;
 
 void CFWL_ListBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder: {
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index d04976f..a45a0c5 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -33,7 +33,7 @@
 CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() = default;
 
 void CFWL_MonthCalendarTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder: {
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
@@ -85,12 +85,12 @@
 
 void CFWL_MonthCalendarTP::DrawText(const CFWL_ThemeText& pParams) {
   EnsureTTOInitialized(pParams.GetWidget()->GetThemeProvider());
-  if (pParams.m_iPart == CFWL_ThemePart::Part::kDatesIn &&
+  if (pParams.GetPart() == CFWL_ThemePart::Part::kDatesIn &&
       !(pParams.m_dwStates & CFWL_PartState::kFlagged) &&
       (pParams.m_dwStates & Mask<CFWL_PartState>{CFWL_PartState::kHovered,
                                                  CFWL_PartState::kSelected})) {
     m_pTextOut->SetTextColor(0xFFFFFFFF);
-  } else if (pParams.m_iPart == CFWL_ThemePart::Part::kCaption) {
+  } else if (pParams.GetPart() == CFWL_ThemePart::Part::kCaption) {
     m_pTextOut->SetTextColor(kCaptionColor);
   } else {
     m_pTextOut->SetTextColor(0xFF000000);
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
index 5a16e4a..ef0c785 100644
--- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
@@ -15,7 +15,7 @@
 CFWL_PictureBoxTP::~CFWL_PictureBoxTP() = default;
 
 void CFWL_PictureBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder:
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 5571d85..3dd3ad7 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -27,7 +27,7 @@
 CFWL_PushButtonTP::~CFWL_PushButtonTP() = default;
 
 void CFWL_PushButtonTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kBorder: {
       DrawBorder(pParams.GetGraphics(), pParams.m_PartRect, pParams.m_matrix);
       break;
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 1e75e9f..143588a 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -24,7 +24,7 @@
   CFWL_Widget* pWidget = pParams.GetWidget();
   CFGAS_GEGraphics* pGraphics = pParams.GetGraphics();
   bool bVert = !!pWidget->GetStyleExts();
-  switch (pParams.m_iPart) {
+  switch (pParams.GetPart()) {
     case CFWL_ThemePart::Part::kForeArrow: {
       DrawMaxMinBtn(pGraphics, pParams.m_PartRect,
                     bVert ? FWLTHEME_DIRECTION::kUp : FWLTHEME_DIRECTION::kLeft,
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index 3457fae..99110d6 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -98,14 +98,14 @@
     m_pTextOut->SetFont(m_pCalendarFont);
     m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
     m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
-    if ((pParams.m_iPart == CFWL_ThemePart::Part::kDatesIn) &&
+    if ((pParams.GetPart() == CFWL_ThemePart::Part::kDatesIn) &&
         !(pParams.m_dwStates & CFWL_PartState::kFlagged) &&
         (pParams.m_dwStates &
          Mask<CFWL_PartState>{CFWL_PartState::kHovered,
                               CFWL_PartState::kSelected})) {
       m_pTextOut->SetTextColor(0xFF888888);
     }
-    if (pParams.m_iPart == CFWL_ThemePart::Part::kCaption)
+    if (pParams.GetPart() == CFWL_ThemePart::Part::kCaption)
       m_pTextOut->SetTextColor(ArgbEncode(0xff, 0, 153, 255));
 
     CFGAS_GEGraphics* pGraphics = pParams.GetGraphics();