Pass several required fields to CreateParam constructor.

Makes it more obvious when these required fields are being omitted.

Change-Id: I571b037d30426ce9622a6bad906bc9b3b1708c3e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/93550
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp
index 88979e5..b2fa82b 100644
--- a/fpdfsdk/cpdfsdk_appstream.cpp
+++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -692,15 +692,14 @@
   if (rcIcon.IsEmpty() || !pIconStream)
     return ByteString();
 
-  auto pPDFIcon = std::make_unique<CPDF_Icon>(pIconStream);
-
-  CPWL_Wnd::CreateParams cp;
+  CPWL_Wnd::CreateParams cp(nullptr, nullptr, nullptr);
   cp.dwFlags = PWS_VISIBLE;
   auto pWnd = std::make_unique<CPWL_Wnd>(cp, nullptr);
   pWnd->Realize();
   if (!pWnd->Move(rcIcon, false, false))
     return ByteString();
 
+  auto pPDFIcon = std::make_unique<CPDF_Icon>(pIconStream);
   ByteString sAlias = pPDFIcon->GetImageAlias();
   if (sAlias.GetLength() <= 0)
     return ByteString();
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index c8efaf9..aeeec61 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -297,8 +297,10 @@
 }
 
 CPWL_Wnd::CreateParams CFFL_FormField::GetCreateParam() {
-  CPWL_Wnd::CreateParams cp;
-  cp.pProvider.Reset(this);
+  CPWL_Wnd::CreateParams cp(
+      m_pFormFiller->GetCallbackIface()->GetTimerHandler(),
+      m_pFormFiller->GetCallbackIface()->GetSysHandler(), this);
+
   cp.rcRectWnd = GetPDFAnnotRect();
 
   uint32_t dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE;
@@ -339,8 +341,6 @@
     dwCreateFlags |= PWS_AUTOFONTSIZE;
 
   cp.dwFlags = dwCreateFlags;
-  cp.pTimerHandler.Reset(m_pFormFiller->GetCallbackIface()->GetTimerHandler());
-  cp.pSystemHandler = m_pFormFiller->GetCallbackIface()->GetSysHandler();
   return cp;
 }
 
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 88ce67a..ad0d9d2 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -33,8 +33,14 @@
 const CFX_Color CPWL_Wnd::kDefaultWhiteColor =
     CFX_Color(CFX_Color::Type::kGray, 1);
 
-CPWL_Wnd::CreateParams::CreateParams()
-    : fFontSize(kDefaultFontSize), sDash(3, 0, 0) {}
+CPWL_Wnd::CreateParams::CreateParams(CFX_Timer::HandlerIface* timer_handler,
+                                     IPWL_SystemHandler* system_handler,
+                                     ProviderIface* provider)
+    : pTimerHandler(timer_handler),
+      pSystemHandler(system_handler),
+      pProvider(provider),
+      fFontSize(kDefaultFontSize),
+      sDash(3, 0, 0) {}
 
 CPWL_Wnd::CreateParams::CreateParams(const CreateParams& other) = default;
 
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 2be98fc..de9a132 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -97,14 +97,16 @@
   // Caller-provided options for window creation.
   class CreateParams {
    public:
-    CreateParams();
+    CreateParams(CFX_Timer::HandlerIface* timer_handler,
+                 IPWL_SystemHandler* system_handler,
+                 ProviderIface* provider);
     CreateParams(const CreateParams& other);
     ~CreateParams();
 
     // Required:
     CFX_FloatRect rcRectWnd;
-    ObservedPtr<CFX_Timer::HandlerIface> pTimerHandler;
-    UnownedPtr<IPWL_SystemHandler> pSystemHandler;
+    ObservedPtr<CFX_Timer::HandlerIface> const pTimerHandler;
+    UnownedPtr<IPWL_SystemHandler> const pSystemHandler;
     UnownedPtr<IPVT_FontMap> pFontMap;
     ObservedPtr<ProviderIface> pProvider;