Use enum FWL_KEYCODE and XFA_FWL_KEYCODE in place of int.

We have these explicit enums but currently pass arguments around as
ints. Stop short of updating the public APIs to use these types,
even though FWL_KEYCODE is defined in a public header.

Change-Id: I0e86a4c0492a1658615d2ed812e6353e44256bd6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83870
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 757aed3..369f6ce 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -239,14 +239,14 @@
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
-                                           uint32_t nChar,
+                                           FWL_VKEYCODE nChar,
                                            uint32_t nFlags) {
   return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_PageView* pPageView,
                                               CPDFSDK_Annot* pAnnot,
-                                              int nKeyCode,
+                                              FWL_VKEYCODE nKeyCode,
                                               int nFlag) {
   if (!pAnnot) {
     // If pressed key is not tab then no action is needed.
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index a7f8b97..6c96cc6 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -12,6 +12,7 @@
 #include "core/fpdfdoc/cpdf_annot.h"
 #include "core/fxcrt/fx_coordinates.h"
 #include "fpdfsdk/cpdfsdk_annot.h"
+#include "public/fpdf_fwlevent.h"
 
 class CFX_Matrix;
 class CFX_RenderDevice;
@@ -97,10 +98,10 @@
                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                          uint32_t nFlags,
                          const CFX_PointF& point);
-  bool Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
+  bool Annot_OnChar(CPDFSDK_Annot* pAnnot, FWL_VKEYCODE nChar, uint32_t nFlags);
   bool Annot_OnKeyDown(CPDFSDK_PageView* pPageView,
                        CPDFSDK_Annot* pAnnot,
-                       int nKeyCode,
+                       FWL_VKEYCODE nKeyCode,
                        int nFlag);
   bool Annot_OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag);
   bool Annot_OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag);
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index d0be736..f904cda 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -169,13 +169,13 @@
 }
 
 bool CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
-                                    uint32_t nChar,
+                                    FWL_VKEYCODE nChar,
                                     uint32_t nFlags) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
-                                       int nKeyCode,
+                                       FWL_VKEYCODE nKeyCode,
                                        int nFlag) {
   DCHECK(pAnnot);
 
@@ -200,7 +200,7 @@
 }
 
 bool CPDFSDK_BAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
-                                     int nKeyCode,
+                                     FWL_VKEYCODE nKeyCode,
                                      int nFlag) {
   return false;
 }
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h
index 6ce20b1..8e10a5a 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -91,9 +91,15 @@
                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
-  bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
-  bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
-  bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
+  bool OnChar(CPDFSDK_Annot* pAnnot,
+              FWL_VKEYCODE nChar,
+              uint32_t nFlags) override;
+  bool OnKeyDown(CPDFSDK_Annot* pAnnot,
+                 FWL_VKEYCODE nKeyCode,
+                 int nFlag) override;
+  bool OnKeyUp(CPDFSDK_Annot* pAnnot,
+               FWL_VKEYCODE nKeyCode,
+               int nFlag) override;
   bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
   bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
   bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 83993c7..fbf0020 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -466,7 +466,7 @@
   return false;
 }
 
-bool CPDFSDK_PageView::OnChar(int nChar, uint32_t nFlag) {
+bool CPDFSDK_PageView::OnChar(FWL_VKEYCODE nChar, uint32_t nFlag) {
   if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
     CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
         m_pFormFillEnv->GetAnnotHandlerMgr();
@@ -476,14 +476,14 @@
   return false;
 }
 
-bool CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) {
+bool CPDFSDK_PageView::OnKeyDown(FWL_VKEYCODE nKeyCode, int nFlag) {
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
   return pAnnotHandlerMgr->Annot_OnKeyDown(this, GetFocusAnnot(), nKeyCode,
                                            nFlag);
 }
 
-bool CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) {
+bool CPDFSDK_PageView::OnKeyUp(FWL_VKEYCODE nKeyCode, int nFlag) {
   return false;
 }
 
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index 4502c5a..fa31e14 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -72,9 +72,9 @@
   bool OnLButtonDblClk(uint32_t nFlag, const CFX_PointF& point);
   bool OnRButtonDown(uint32_t nFlag, const CFX_PointF& point);
   bool OnRButtonUp(uint32_t nFlag, const CFX_PointF& point);
-  bool OnChar(int nChar, uint32_t nFlag);
-  bool OnKeyDown(int nKeyCode, int nFlag);
-  bool OnKeyUp(int nKeyCode, int nFlag);
+  bool OnChar(FWL_VKEYCODE nChar, uint32_t nFlag);
+  bool OnKeyDown(FWL_VKEYCODE nKeyCode, int nFlag);
+  bool OnKeyUp(FWL_VKEYCODE nKeyCode, int nFlag);
   bool OnMouseMove(int nFlag, const CFX_PointF& point);
   bool OnMouseWheel(int nFlag,
                     const CFX_PointF& point,
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 8f4a7f0..5c486b9 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -180,21 +180,21 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot,
-                                   uint32_t nChar,
+                                   FWL_VKEYCODE nChar,
                                    uint32_t nFlags) {
   return !pAnnot->IsSignatureWidget() &&
          m_pInteractiveFormFiller->OnChar(pAnnot, nChar, nFlags);
 }
 
 bool CPDFSDK_WidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
-                                      int nKeyCode,
+                                      FWL_VKEYCODE nKeyCode,
                                       int nFlag) {
   return !pAnnot->IsSignatureWidget() &&
          m_pInteractiveFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag);
 }
 
 bool CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
-                                    int nKeyCode,
+                                    FWL_VKEYCODE nKeyCode,
                                     int nFlag) {
   return false;
 }
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index 22b8d07..596df12 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -91,9 +91,15 @@
                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
-  bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
-  bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
-  bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
+  bool OnChar(CPDFSDK_Annot* pAnnot,
+              FWL_VKEYCODE nChar,
+              uint32_t nFlags) override;
+  bool OnKeyDown(CPDFSDK_Annot* pAnnot,
+                 FWL_VKEYCODE nKeyCode,
+                 int nFlag) override;
+  bool OnKeyUp(CPDFSDK_Annot* pAnnot,
+               FWL_VKEYCODE nKeyCode,
+               int nFlag) override;
   bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
   bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
   bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 486eded..6cf3f90 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -486,7 +486,7 @@
   CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
   if (!pPageView)
     return false;
-  return pPageView->OnKeyDown(nKeyCode, modifier);
+  return pPageView->OnKeyDown(static_cast<FWL_VKEYCODE>(nKeyCode), modifier);
 }
 
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,
@@ -496,7 +496,7 @@
   CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
   if (!pPageView)
     return false;
-  return pPageView->OnKeyUp(nKeyCode, modifier);
+  return pPageView->OnKeyUp(static_cast<FWL_VKEYCODE>(nKeyCode), modifier);
 }
 
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle,
@@ -506,7 +506,7 @@
   CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
   if (!pPageView)
     return false;
-  return pPageView->OnChar(nChar, modifier);
+  return pPageView->OnChar(static_cast<FWL_VKEYCODE>(nChar), modifier);
 }
 
 FPDF_EXPORT unsigned long FPDF_CALLCONV
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
index 0fcf7b7..ff907d6 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
@@ -12,7 +12,6 @@
 #include "fpdfsdk/cpdfsdk_pageview.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_widget.h"
-#include "public/fpdf_fwlevent.h"
 #include "third_party/base/check.h"
 #include "xfa/fgas/graphics/cfgas_gegraphics.h"
 #include "xfa/fwl/cfwl_app.h"
@@ -529,38 +528,41 @@
 }
 
 bool CPDFXFA_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot,
-                                   uint32_t nChar,
+                                   FWL_VKEYCODE nChar,
                                    uint32_t nFlags) {
   CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot);
   if (!pXFAWidget)
     return false;
 
   CXFA_FFWidgetHandler* pWidgetHandler = GetXFAFFWidgetHandler(pXFAWidget);
-  return pWidgetHandler->OnChar(pXFAWidget->GetXFAFFWidget(), nChar,
+  return pWidgetHandler->OnChar(pXFAWidget->GetXFAFFWidget(),
+                                static_cast<XFA_FWL_VKEYCODE>(nChar),
                                 GetFWLFlags(nFlags));
 }
 
 bool CPDFXFA_WidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
-                                      int nKeyCode,
+                                      FWL_VKEYCODE nKeyCode,
                                       int nFlag) {
   CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot);
   if (!pXFAWidget)
     return false;
 
   CXFA_FFWidgetHandler* pWidgetHandler = GetXFAFFWidgetHandler(pXFAWidget);
-  return pWidgetHandler->OnKeyDown(pXFAWidget->GetXFAFFWidget(), nKeyCode,
+  return pWidgetHandler->OnKeyDown(pXFAWidget->GetXFAFFWidget(),
+                                   static_cast<XFA_FWL_VKEYCODE>(nKeyCode),
                                    GetFWLFlags(nFlag));
 }
 
 bool CPDFXFA_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
-                                    int nKeyCode,
+                                    FWL_VKEYCODE nKeyCode,
                                     int nFlag) {
   CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot);
   if (!pXFAWidget)
     return false;
 
   CXFA_FFWidgetHandler* pWidgetHandler = GetXFAFFWidgetHandler(pXFAWidget);
-  return pWidgetHandler->OnKeyUp(pXFAWidget->GetXFAFFWidget(), nKeyCode,
+  return pWidgetHandler->OnKeyUp(pXFAWidget->GetXFAFFWidget(),
+                                 static_cast<XFA_FWL_VKEYCODE>(nKeyCode),
                                  GetFWLFlags(nFlag));
 }
 
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
index cbe449d..7fbc8c1 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
@@ -12,6 +12,7 @@
 #include "core/fxcrt/fx_coordinates.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "fpdfsdk/ipdfsdk_annothandler.h"
+#include "public/fpdf_fwlevent.h"
 #include "xfa/fwl/cfwl_messagemouse.h"
 
 class CFX_Matrix;
@@ -93,9 +94,15 @@
                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
-  bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
-  bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
-  bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
+  bool OnChar(CPDFSDK_Annot* pAnnot,
+              FWL_VKEYCODE nChar,
+              uint32_t nFlags) override;
+  bool OnKeyDown(CPDFSDK_Annot* pAnnot,
+                 FWL_VKEYCODE nKeyCode,
+                 int nFlag) override;
+  bool OnKeyUp(CPDFSDK_Annot* pAnnot,
+               FWL_VKEYCODE nKeyCode,
+               int nFlag) override;
   bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
   bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
   bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h
index 6150bdc..4a41418 100644
--- a/fpdfsdk/ipdfsdk_annothandler.h
+++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -11,6 +11,7 @@
 
 #include "core/fxcrt/fx_coordinates.h"
 #include "fpdfsdk/cpdfsdk_annot.h"
+#include "public/fpdf_fwlevent.h"
 
 class CFX_Matrix;
 class CFX_RenderDevice;
@@ -89,10 +90,14 @@
                                uint32_t nFlags,
                                const CFX_PointF& point) = 0;
   virtual bool OnChar(CPDFSDK_Annot* pAnnot,
-                      uint32_t nChar,
+                      FWL_VKEYCODE nChar,
                       uint32_t nFlags) = 0;
-  virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
-  virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
+  virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot,
+                         FWL_VKEYCODE nKeyCode,
+                         int nFlag) = 0;
+  virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot,
+                       FWL_VKEYCODE nKeyCode,
+                       int nFlag) = 0;
   virtual bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                           uint32_t nFlag) = 0;
   virtual bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
diff --git a/xfa/fwl/cfwl_messagekey.cpp b/xfa/fwl/cfwl_messagekey.cpp
index b9aaf4a..dd834a2 100644
--- a/xfa/fwl/cfwl_messagekey.cpp
+++ b/xfa/fwl/cfwl_messagekey.cpp
@@ -9,7 +9,7 @@
 CFWL_MessageKey::CFWL_MessageKey(CFWL_Widget* pDstTarget,
                                  KeyCommand cmd,
                                  FWL_KeyFlagMask flags,
-                                 uint32_t keycode)
+                                 XFA_FWL_VKEYCODE keycode)
     : CFWL_Message(CFWL_Message::Type::kKey, nullptr, pDstTarget),
       m_dwCmd(cmd),
       m_dwFlags(flags),
diff --git a/xfa/fwl/cfwl_messagekey.h b/xfa/fwl/cfwl_messagekey.h
index 85ea85d..d469a8c 100644
--- a/xfa/fwl/cfwl_messagekey.h
+++ b/xfa/fwl/cfwl_messagekey.h
@@ -8,6 +8,7 @@
 #define XFA_FWL_CFWL_MESSAGEKEY_H_
 
 #include "xfa/fwl/cfwl_message.h"
+#include "xfa/fwl/fwl_widgetdef.h"
 
 class CFWL_MessageKey final : public CFWL_Message {
  public:
@@ -16,12 +17,12 @@
   CFWL_MessageKey(CFWL_Widget* pDstTarget,
                   KeyCommand subtype,
                   FWL_KeyFlagMask flags,
-                  uint32_t keycode);
+                  XFA_FWL_VKEYCODE keycode);
   ~CFWL_MessageKey() override;
 
   const KeyCommand m_dwCmd;
   const FWL_KeyFlagMask m_dwFlags;
-  const uint32_t m_dwKeyCode;
+  const XFA_FWL_VKEYCODE m_dwKeyCode;
 };
 
 #endif  // XFA_FWL_CFWL_MESSAGEKEY_H_
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index ad96f2e..010d05e 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -525,7 +525,7 @@
   return pNewWidget && CXFA_FFWidget::OnKillFocus(pNewWidget);
 }
 
-bool CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
+bool CXFA_FFField::OnKeyDown(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
   if (!GetNormalWidget() || !GetDoc()->GetXFADoc()->IsInteractive())
     return false;
 
@@ -535,7 +535,7 @@
   return true;
 }
 
-bool CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
+bool CXFA_FFField::OnKeyUp(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
   if (!GetNormalWidget() || !GetDoc()->GetXFADoc()->IsInteractive())
     return false;
 
@@ -545,7 +545,7 @@
   return true;
 }
 
-bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) {
+bool CXFA_FFField::OnChar(XFA_FWL_VKEYCODE dwChar, uint32_t dwFlags) {
   if (!GetDoc()->GetXFADoc()->IsInteractive())
     return false;
   if (dwChar == XFA_FWL_VKEY_Tab)
diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h
index 1ccbaf5..0977a6f 100644
--- a/xfa/fxfa/cxfa_fffield.h
+++ b/xfa/fxfa/cxfa_fffield.h
@@ -52,9 +52,9 @@
   bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
   bool OnSetFocus(CXFA_FFWidget* pOldWidget) override WARN_UNUSED_RESULT;
   bool OnKillFocus(CXFA_FFWidget* pNewWidget) override WARN_UNUSED_RESULT;
-  bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override;
-  bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override;
-  bool OnChar(uint32_t dwChar, uint32_t dwFlags) override;
+  bool OnKeyDown(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) override;
+  bool OnKeyUp(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) override;
+  bool OnChar(XFA_FWL_VKEYCODE dwChar, uint32_t dwFlags) override;
   FWL_WidgetHit HitTest(const CFX_PointF& point) override;
 
   // IFWL_WidgetDelegate:
diff --git a/xfa/fxfa/cxfa_ffsignature.cpp b/xfa/fxfa/cxfa_ffsignature.cpp
index 201911b..6b46a4c 100644
--- a/xfa/fxfa/cxfa_ffsignature.cpp
+++ b/xfa/fxfa/cxfa_ffsignature.cpp
@@ -91,15 +91,15 @@
   return false;
 }
 
-bool CXFA_FFSignature::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
+bool CXFA_FFSignature::OnKeyDown(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
   return false;
 }
 
-bool CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
+bool CXFA_FFSignature::OnKeyUp(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
   return false;
 }
 
-bool CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) {
+bool CXFA_FFSignature::OnChar(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
   return false;
 }
 
diff --git a/xfa/fxfa/cxfa_ffsignature.h b/xfa/fxfa/cxfa_ffsignature.h
index a3ee515..122e1b3 100644
--- a/xfa/fxfa/cxfa_ffsignature.h
+++ b/xfa/fxfa/cxfa_ffsignature.h
@@ -35,9 +35,9 @@
   bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override;
   bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
   bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override;
-  bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override;
-  bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override;
-  bool OnChar(uint32_t dwChar, uint32_t dwFlags) override;
+  bool OnKeyDown(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) override;
+  bool OnKeyUp(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) override;
+  bool OnChar(XFA_FWL_VKEYCODE dwChar, uint32_t dwFlags) override;
   FWL_WidgetHit HitTest(const CFX_PointF& point) override;
   FormFieldType GetFormFieldType() override;
 
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index b93476f..3f14c4c 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -455,15 +455,15 @@
   return true;
 }
 
-bool CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
+bool CXFA_FFWidget::OnKeyDown(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
   return false;
 }
 
-bool CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
+bool CXFA_FFWidget::OnKeyUp(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
   return false;
 }
 
-bool CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) {
+bool CXFA_FFWidget::OnChar(XFA_FWL_VKEYCODE dwChar, uint32_t dwFlags) {
   return false;
 }
 
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index aa5b55e..75f134e 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -20,6 +20,7 @@
 #include "xfa/fwl/cfwl_app.h"
 #include "xfa/fwl/cfwl_messagemouse.h"
 #include "xfa/fwl/cfwl_widget.h"
+#include "xfa/fwl/fwl_widgetdef.h"
 #include "xfa/fxfa/cxfa_eventparam.h"
 #include "xfa/fxfa/cxfa_ffapp.h"
 #include "xfa/fxfa/fxfa.h"
@@ -132,10 +133,12 @@
                                const CFX_PointF& point) WARN_UNUSED_RESULT;
   virtual bool OnSetFocus(CXFA_FFWidget* pOldWidget) WARN_UNUSED_RESULT;
   virtual bool OnKillFocus(CXFA_FFWidget* pNewWidget) WARN_UNUSED_RESULT;
-  virtual bool OnKeyDown(uint32_t dwKeyCode,
+  virtual bool OnKeyDown(XFA_FWL_VKEYCODE dwKeyCode,
                          uint32_t dwFlags) WARN_UNUSED_RESULT;
-  virtual bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) WARN_UNUSED_RESULT;
-  virtual bool OnChar(uint32_t dwChar, uint32_t dwFlags) WARN_UNUSED_RESULT;
+  virtual bool OnKeyUp(XFA_FWL_VKEYCODE dwKeyCode,
+                       uint32_t dwFlags) WARN_UNUSED_RESULT;
+  virtual bool OnChar(XFA_FWL_VKEYCODE dwChar,
+                      uint32_t dwFlags) WARN_UNUSED_RESULT;
 
   virtual FWL_WidgetHit HitTest(const CFX_PointF& point);
   virtual bool CanUndo();
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index c4af7cd..46461d0 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -122,7 +122,7 @@
 }
 
 bool CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget,
-                                     uint32_t dwKeyCode,
+                                     XFA_FWL_VKEYCODE dwKeyCode,
                                      uint32_t dwFlags) {
   bool bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags);
   m_pDocView->UpdateDocView();
@@ -130,13 +130,13 @@
 }
 
 bool CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget,
-                                   uint32_t dwKeyCode,
+                                   XFA_FWL_VKEYCODE dwKeyCode,
                                    uint32_t dwFlags) {
   return hWidget->OnKeyUp(dwKeyCode, dwFlags);
 }
 
 bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget,
-                                  uint32_t dwChar,
+                                  XFA_FWL_VKEYCODE dwChar,
                                   uint32_t dwFlags) {
   return hWidget->OnChar(dwChar, dwFlags);
 }
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.h b/xfa/fxfa/cxfa_ffwidgethandler.h
index 85110b2..d66db08 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.h
+++ b/xfa/fxfa/cxfa_ffwidgethandler.h
@@ -12,6 +12,7 @@
 #include "v8/include/cppgc/garbage-collected.h"
 #include "v8/include/cppgc/member.h"
 #include "v8/include/cppgc/visitor.h"
+#include "xfa/fwl/fwl_widgetdef.h"
 #include "xfa/fxfa/cxfa_eventparam.h"
 #include "xfa/fxfa/parser/cxfa_document.h"
 
@@ -66,9 +67,15 @@
   bool Undo(CXFA_FFWidget* widget);
   bool Redo(CXFA_FFWidget* widget);
 
-  bool OnKeyDown(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
-  bool OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags);
-  bool OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags);
+  bool OnKeyDown(CXFA_FFWidget* hWidget,
+                 XFA_FWL_VKEYCODE dwKeyCode,
+                 uint32_t dwFlags);
+  bool OnKeyUp(CXFA_FFWidget* hWidget,
+               XFA_FWL_VKEYCODE dwKeyCode,
+               uint32_t dwFlags);
+  bool OnChar(CXFA_FFWidget* hWidget,
+              XFA_FWL_VKEYCODE dwChar,
+              uint32_t dwFlags);
   FWL_WidgetHit HitTest(CXFA_FFWidget* pWidget, const CFX_PointF& point);
   void RenderWidget(CXFA_FFWidget* hWidget,
                     CFGAS_GEGraphics* pGS,