Ensure CFWL_Widget::m_pTextOut is initialized.

The previous CL illustrated paths that could not be hit. Instead,
initialize on demand which seems closer to what we imagine the
original author's intent might be.

Change-Id: I78bd01e838b8ca13fc076879841e8406edad14a1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/64671
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index a6f074f..3436389 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -38,9 +38,7 @@
 }
 
 void CFWL_CheckBoxTP::DrawText(const CFWL_ThemeText& pParams) {
-  if (!m_pTextOut)
-    return;
-
+  EnsureTTOInitialized();
   m_pTextOut->SetTextColor(pParams.m_dwStates & CFWL_PartState_Disabled
                                ? FWLTHEME_CAPACITY_TextDisColor
                                : FWLTHEME_CAPACITY_TextColor);
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index 7e9a728..47ba930 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -84,9 +84,7 @@
 }
 
 void CFWL_MonthCalendarTP::DrawText(const CFWL_ThemeText& pParams) {
-  if (!m_pTextOut)
-    return;
-
+  EnsureTTOInitialized();
   if ((pParams.m_iPart == CFWL_Part::DatesIn) &&
       !(pParams.m_dwStates & FWL_ITEMSTATE_MCD_Flag) &&
       (pParams.m_dwStates &
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 76c1290..27caf99 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -37,9 +37,7 @@
 void CFWL_WidgetTP::DrawBackground(const CFWL_ThemeBackground& pParams) {}
 
 void CFWL_WidgetTP::DrawText(const CFWL_ThemeText& pParams) {
-  if (!m_pTextOut)
-    InitTTO();
-
+  EnsureTTOInitialized();
   int32_t iLen = pParams.m_wsText.GetLength();
   if (iLen <= 0)
     return;
@@ -83,8 +81,7 @@
   m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
 }
 
-
-void CFWL_WidgetTP::InitTTO() {
+void CFWL_WidgetTP::EnsureTTOInitialized() {
   if (m_pTextOut)
     return;
 
@@ -95,10 +92,6 @@
   m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
 }
 
-void CFWL_WidgetTP::FinalizeTTO() {
-  m_pTextOut.reset();
-}
-
 void CFWL_WidgetTP::DrawBorder(CXFA_Graphics* pGraphics,
                                const CFX_RectF& rect,
                                const CFX_Matrix& matrix) {
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index fc5096d..c4fa61a 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -42,8 +42,7 @@
   CFWL_WidgetTP();
 
   void InitializeArrowColorData();
-  void InitTTO();
-  void FinalizeTTO();
+  void EnsureTTOInitialized();
 
   void DrawBorder(CXFA_Graphics* pGraphics,
                   const CFX_RectF& rect,