Convert OnChar() arguments back to uint32_t

The CL at https://pdfium-review.googlesource.com/c/pdfium/+/83870
was a bit over-zealous in the conversion of the OnChar() methods to
VKEYCODE. Although we frequently pass VKEYCODES to these methods,
and compare against VKEYCODES inside these methods, the arguments
are actually character codes, not key codes. The cross-type
usages happen to work because we selectively use the only the
values where they are equivalent.

Update the test to make the differences in calling clearer.

We'll need a subsequent CL to split CFWL_MessageKey into, say,
CFWL_MessageChar to get complete type correctness, but just
cast for now.

Change-Id: I5ada6ea2abe124116e3eaa13460cf05e2eb055d8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83910
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 369f6ce..1299c49 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -239,7 +239,7 @@
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
-                                           FWL_VKEYCODE nChar,
+                                           uint32_t nChar,
                                            uint32_t nFlags) {
   return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags);
 }
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index 6c96cc6..f43a2b9 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -98,7 +98,7 @@
                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                          uint32_t nFlags,
                          const CFX_PointF& point);
-  bool Annot_OnChar(CPDFSDK_Annot* pAnnot, FWL_VKEYCODE nChar, uint32_t nFlags);
+  bool Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
   bool Annot_OnKeyDown(CPDFSDK_PageView* pPageView,
                        CPDFSDK_Annot* pAnnot,
                        FWL_VKEYCODE nKeyCode,
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index f904cda..5ade8d9 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -169,7 +169,7 @@
 }
 
 bool CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
-                                    FWL_VKEYCODE nChar,
+                                    uint32_t nChar,
                                     uint32_t nFlags) {
   return false;
 }
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h
index 8e10a5a..f5b632a 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -91,9 +91,7 @@
                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
-  bool OnChar(CPDFSDK_Annot* pAnnot,
-              FWL_VKEYCODE nChar,
-              uint32_t nFlags) override;
+  bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
   bool OnKeyDown(CPDFSDK_Annot* pAnnot,
                  FWL_VKEYCODE nKeyCode,
                  int nFlag) override;
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index fbf0020..a2648da 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -466,7 +466,7 @@
   return false;
 }
 
-bool CPDFSDK_PageView::OnChar(FWL_VKEYCODE nChar, uint32_t nFlag) {
+bool CPDFSDK_PageView::OnChar(uint32_t nChar, uint32_t nFlag) {
   if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
     CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
         m_pFormFillEnv->GetAnnotHandlerMgr();
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index fa31e14..2219779 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -72,7 +72,7 @@
   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(FWL_VKEYCODE nChar, uint32_t nFlag);
+  bool OnChar(uint32_t 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);
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 5c486b9..2de83f0 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -180,7 +180,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot,
-                                   FWL_VKEYCODE nChar,
+                                   uint32_t nChar,
                                    uint32_t nFlags) {
   return !pAnnot->IsSignatureWidget() &&
          m_pInteractiveFormFiller->OnChar(pAnnot, nChar, nFlags);
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index 596df12..366d093 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -91,9 +91,7 @@
                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
-  bool OnChar(CPDFSDK_Annot* pAnnot,
-              FWL_VKEYCODE nChar,
-              uint32_t nFlags) override;
+  bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
   bool OnKeyDown(CPDFSDK_Annot* pAnnot,
                  FWL_VKEYCODE nKeyCode,
                  int nFlag) override;
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 6cf3f90..5871721 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -506,7 +506,7 @@
   CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
   if (!pPageView)
     return false;
-  return pPageView->OnChar(static_cast<FWL_VKEYCODE>(nChar), modifier);
+  return pPageView->OnChar(nChar, modifier);
 }
 
 FPDF_EXPORT unsigned long FPDF_CALLCONV
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index 2414bc8..817602a 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -32,14 +32,6 @@
 
 using FPDFFormFillEmbedderTest = EmbedderTest;
 
-namespace {
-
-int TranslateOnCharToModifierOnChar(int keychar) {
-  return keychar - FWL_VKEY_A + 1;
-}
-
-}  // namespace
-
 // A base class for many related tests that involve clicking and typing into
 // form fields.
 class FPDFFormFillInteractiveEmbedderTest : public FPDFFormFillEmbedderTest {
@@ -94,7 +86,7 @@
 
     // Type text starting with 'A' to as many chars as specified by |num_chars|.
     for (int i = 0; i < num_chars; ++i) {
-      FORM_OnChar(form_handle(), page_, FWL_VKEY_A + i, 0);
+      FORM_OnChar(form_handle(), page_, 'A' + i, 0);
     }
   }
 
@@ -1045,10 +1037,10 @@
     // The read-only checkbox is initially in checked state.
     EXPECT_TRUE(FPDFAnnot_IsChecked(form_handle(), annot));
 
-    EXPECT_TRUE(FORM_OnChar(form_handle(), page, FWL_VKEY_Return, 0));
+    EXPECT_TRUE(FORM_OnChar(form_handle(), page, '\r', 0));
     EXPECT_TRUE(FPDFAnnot_IsChecked(form_handle(), annot));
 
-    EXPECT_TRUE(FORM_OnChar(form_handle(), page, FWL_VKEY_Space, 0));
+    EXPECT_TRUE(FORM_OnChar(form_handle(), page, ' ', 0));
     EXPECT_TRUE(FPDFAnnot_IsChecked(form_handle(), annot));
 
     FPDFPage_CloseAnnot(annot);
@@ -1079,10 +1071,10 @@
     // The read-only radio button is initially in checked state.
     EXPECT_FALSE(FPDFAnnot_IsChecked(form_handle(), annot));
 
-    EXPECT_TRUE(FORM_OnChar(form_handle(), page, FWL_VKEY_Return, 0));
+    EXPECT_TRUE(FORM_OnChar(form_handle(), page, '\r', 0));
     EXPECT_FALSE(FPDFAnnot_IsChecked(form_handle(), annot));
 
-    EXPECT_TRUE(FORM_OnChar(form_handle(), page, FWL_VKEY_Space, 0));
+    EXPECT_TRUE(FORM_OnChar(form_handle(), page, ' ', 0));
     EXPECT_FALSE(FPDFAnnot_IsChecked(form_handle(), annot));
 
     FPDFPage_CloseAnnot(annot);
@@ -1367,9 +1359,9 @@
     FORM_OnLButtonUp(form_handle(), page, 0, 120.0, 120.0);
 
     // Write "ABC"
-    FORM_OnChar(form_handle(), page, FWL_VKEY_A, 0);
-    FORM_OnChar(form_handle(), page, FWL_VKEY_B, 0);
-    FORM_OnChar(form_handle(), page, FWL_VKEY_C, 0);
+    FORM_OnChar(form_handle(), page, 'A', 0);
+    FORM_OnChar(form_handle(), page, 'B', 0);
+    FORM_OnChar(form_handle(), page, 'C', 0);
     ScopedFPDFBitmap bitmap2 = RenderLoadedPage(page);
     CompareBitmap(bitmap2.get(), 300, 300, kFocusedTextFormWithAbcChecksum);
 
@@ -2355,7 +2347,7 @@
   CheckIsIndexSelected(1, true);
 
   // Verify that the Enter key is handled.
-  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Return, 0));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), '\r', 0));
 
   // Change the selection in the combo-box using the arrow down key.
   EXPECT_TRUE(FORM_OnKeyDown(form_handle(), page(), FWL_VKEY_Down, 0));
@@ -2363,24 +2355,23 @@
   CheckIsIndexSelected(2, true);
 
   // Tab to the next control.
-  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Tab, 0));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), '\t', 0));
 
   // Shift-tab to the previous control.
-  EXPECT_TRUE(
-      FORM_OnChar(form_handle(), page(), FWL_VKEY_Tab, FWL_EVENTFLAG_ShiftKey));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), '\t', FWL_EVENTFLAG_ShiftKey));
 
   // Verify that the selection is unchanged.
   CheckIsIndexSelected(2, true);
 
   // Verify that the Space key is handled.
-  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Space, 0));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), ' ', 0));
 
   // Change the selection in the combo-box using the arrow down key.
   EXPECT_TRUE(FORM_OnKeyDown(form_handle(), page(), FWL_VKEY_Down, 0));
   CheckIsIndexSelected(3, true);
 
   // Tab to the next control.
-  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Tab, 0));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), '\t', 0));
 
   // Shift-tab to the previous control.
   EXPECT_TRUE(
@@ -2398,7 +2389,7 @@
   CheckIsIndexSelected(1, false);
 
   // Verify that the Enter key is handled.
-  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Return, 0));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), '\r', 0));
 
   // Change the selection in the combo-box using the arrow down key.
   EXPECT_TRUE(FORM_OnKeyDown(form_handle(), page(), FWL_VKEY_Down, 0));
@@ -2406,17 +2397,16 @@
   CheckIsIndexSelected(1, false);
 
   // Tab to the next control.
-  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Tab, 0));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), '\t', 0));
 
   // Shift-tab to the previous control.
-  EXPECT_TRUE(
-      FORM_OnChar(form_handle(), page(), FWL_VKEY_Tab, FWL_EVENTFLAG_ShiftKey));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), '\t', FWL_EVENTFLAG_ShiftKey));
 
   // Verify that the selection is unchanged.
   CheckIsIndexSelected(0, true);
 
   // Verify that the Space key is handled.
-  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Space, 0));
+  EXPECT_TRUE(FORM_OnChar(form_handle(), page(), ' ', 0));
 
   CheckFocusedFieldText(L" ");
   CheckIsIndexSelected(0, false);
@@ -3146,8 +3136,7 @@
 #else
   constexpr int kCorrectModifier = FWL_EVENTFLAG_ControlKey;
 #endif
-  FORM_OnChar(form_handle(), page(),
-              TranslateOnCharToModifierOnChar(FWL_VKEY_A), kCorrectModifier);
+  FORM_OnChar(form_handle(), page(), '\x01', kCorrectModifier);  // CTRL-A.
   CheckSelection(L"AB");
 
   // Reset the selection again.
@@ -3160,8 +3149,7 @@
 #else
   constexpr int kWrongModifier = FWL_EVENTFLAG_MetaKey;
 #endif
-  FORM_OnChar(form_handle(), page(),
-              TranslateOnCharToModifierOnChar(FWL_VKEY_A), kWrongModifier);
+  FORM_OnChar(form_handle(), page(), '\x01', kWrongModifier);  // CTRL-A.
   CheckSelection(L"");
 }
 
@@ -3250,7 +3238,7 @@
 
   // TODO(crbug.com/1028991): Following should be changed to ASSERT_TRUE after
   // handling key press implementation on buttons.
-  ASSERT_FALSE(FORM_OnChar(form_handle(), page(), FWL_VKEY_Return, 0));
+  ASSERT_FALSE(FORM_OnChar(form_handle(), page(), '\r', 0));
 }
 
 TEST_F(FPDFFormFillActionUriTest, LinkActionInvokeTest) {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
index ff907d6..b7bfc3d 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
@@ -528,15 +528,14 @@
 }
 
 bool CPDFXFA_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot,
-                                   FWL_VKEYCODE nChar,
+                                   uint32_t nChar,
                                    uint32_t nFlags) {
   CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot);
   if (!pXFAWidget)
     return false;
 
   CXFA_FFWidgetHandler* pWidgetHandler = GetXFAFFWidgetHandler(pXFAWidget);
-  return pWidgetHandler->OnChar(pXFAWidget->GetXFAFFWidget(),
-                                static_cast<XFA_FWL_VKEYCODE>(nChar),
+  return pWidgetHandler->OnChar(pXFAWidget->GetXFAFFWidget(), nChar,
                                 GetFWLFlags(nFlags));
 }
 
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
index 7fbc8c1..cd0ed25 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
@@ -94,9 +94,7 @@
                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
-  bool OnChar(CPDFSDK_Annot* pAnnot,
-              FWL_VKEYCODE nChar,
-              uint32_t nFlags) override;
+  bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
   bool OnKeyDown(CPDFSDK_Annot* pAnnot,
                  FWL_VKEYCODE nKeyCode,
                  int nFlag) override;
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h
index 4a41418..cd0c7c5 100644
--- a/fpdfsdk/ipdfsdk_annothandler.h
+++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -90,7 +90,7 @@
                                uint32_t nFlags,
                                const CFX_PointF& point) = 0;
   virtual bool OnChar(CPDFSDK_Annot* pAnnot,
-                      FWL_VKEYCODE nChar,
+                      uint32_t nChar,
                       uint32_t nFlags) = 0;
   virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot,
                          FWL_VKEYCODE nKeyCode,
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index bcf2478..cd912a9 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -308,10 +308,10 @@
 }
 
 void CFWL_CheckBox::OnKeyDown(CFWL_MessageKey* pMsg) {
-  if (pMsg->m_dwKeyCode == XFA_FWL_VKEY_Tab)
+  if (pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Tab)
     return;
-  if (pMsg->m_dwKeyCode == XFA_FWL_VKEY_Return ||
-      pMsg->m_dwKeyCode == XFA_FWL_VKEY_Space) {
+  if (pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Return ||
+      pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Space) {
     NextStates();
   }
 }
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index d1e3835..c602b17 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -410,10 +410,10 @@
         break;
       if (IsDropListVisible() &&
           pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown) {
-        bool bListKey = pKey->m_dwKeyCode == XFA_FWL_VKEY_Up ||
-                        pKey->m_dwKeyCode == XFA_FWL_VKEY_Down ||
-                        pKey->m_dwKeyCode == XFA_FWL_VKEY_Return ||
-                        pKey->m_dwKeyCode == XFA_FWL_VKEY_Escape;
+        bool bListKey = pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Up ||
+                        pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Down ||
+                        pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Return ||
+                        pKey->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Escape;
         if (bListKey) {
           m_pListBox->GetDelegate()->OnProcessMessage(pMessage);
           break;
@@ -487,7 +487,7 @@
 }
 
 void CFWL_ComboBox::OnKey(CFWL_MessageKey* pMsg) {
-  uint32_t dwKeyCode = pMsg->m_dwKeyCode;
+  uint32_t dwKeyCode = pMsg->m_dwKeyCodeOrChar;
   const bool bUp = dwKeyCode == XFA_FWL_VKEY_Up;
   const bool bDown = dwKeyCode == XFA_FWL_VKEY_Down;
   if (bUp || bDown) {
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 4191646..5825267 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -176,7 +176,7 @@
   CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(GetOuter());
   bool bPropagate = false;
   if (pKey->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown) {
-    uint32_t dwKeyCode = pKey->m_dwKeyCode;
+    uint32_t dwKeyCode = pKey->m_dwKeyCodeOrChar;
     switch (dwKeyCode) {
       case XFA_FWL_VKEY_Return:
       case XFA_FWL_VKEY_Escape: {
@@ -206,7 +206,7 @@
 }
 
 void CFWL_ComboList::OnDropListKeyDown(CFWL_MessageKey* pKey) {
-  uint32_t dwKeyCode = pKey->m_dwKeyCode;
+  uint32_t dwKeyCode = pKey->m_dwKeyCodeOrChar;
   switch (dwKeyCode) {
     case XFA_FWL_VKEY_Up:
     case XFA_FWL_VKEY_Down:
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index ecb84d1..1c3fb9e 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -966,7 +966,7 @@
     sel_start = start_idx;
   }
 
-  switch (pMsg->m_dwKeyCode) {
+  switch (pMsg->m_dwKeyCodeOrChar) {
     case XFA_FWL_VKEY_Left:
       SetCursorPosition(m_pEditEngine->GetIndexLeft(m_CursorPosition));
       break;
@@ -1019,7 +1019,7 @@
     return;
   }
 
-  wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCode);
+  wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCodeOrChar);
   switch (c) {
     case L'\b':
       if (m_CursorPosition > 0) {
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 6308113..1157310 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -720,7 +720,7 @@
 }
 
 void CFWL_ListBox::OnKeyDown(CFWL_MessageKey* pMsg) {
-  uint32_t dwKeyCode = pMsg->m_dwKeyCode;
+  uint32_t dwKeyCode = pMsg->m_dwKeyCodeOrChar;
   switch (dwKeyCode) {
     case XFA_FWL_VKEY_Tab:
     case XFA_FWL_VKEY_Up:
diff --git a/xfa/fwl/cfwl_messagekey.cpp b/xfa/fwl/cfwl_messagekey.cpp
index dd834a2..9d5f053 100644
--- a/xfa/fwl/cfwl_messagekey.cpp
+++ b/xfa/fwl/cfwl_messagekey.cpp
@@ -9,10 +9,10 @@
 CFWL_MessageKey::CFWL_MessageKey(CFWL_Widget* pDstTarget,
                                  KeyCommand cmd,
                                  FWL_KeyFlagMask flags,
-                                 XFA_FWL_VKEYCODE keycode)
+                                 uint32_t dwKeyCodeOrChar)
     : CFWL_Message(CFWL_Message::Type::kKey, nullptr, pDstTarget),
       m_dwCmd(cmd),
       m_dwFlags(flags),
-      m_dwKeyCode(keycode) {}
+      m_dwKeyCodeOrChar(dwKeyCodeOrChar) {}
 
 CFWL_MessageKey::~CFWL_MessageKey() = default;
diff --git a/xfa/fwl/cfwl_messagekey.h b/xfa/fwl/cfwl_messagekey.h
index d469a8c..34dc7d2 100644
--- a/xfa/fwl/cfwl_messagekey.h
+++ b/xfa/fwl/cfwl_messagekey.h
@@ -17,12 +17,12 @@
   CFWL_MessageKey(CFWL_Widget* pDstTarget,
                   KeyCommand subtype,
                   FWL_KeyFlagMask flags,
-                  XFA_FWL_VKEYCODE keycode);
+                  uint32_t dwKeyCodeOrChar);
   ~CFWL_MessageKey() override;
 
   const KeyCommand m_dwCmd;
   const FWL_KeyFlagMask m_dwFlags;
-  const XFA_FWL_VKEYCODE m_dwKeyCode;
+  const uint32_t m_dwKeyCodeOrChar;
 };
 
 #endif  // XFA_FWL_CFWL_MESSAGEKEY_H_
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 3d22c31..d2a2059 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -157,7 +157,7 @@
   CFWL_MessageKey* pMsg = static_cast<CFWL_MessageKey*>(pMessage);
 #if !defined(OS_APPLE)
   if (pMsg->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown &&
-      pMsg->m_dwKeyCode == XFA_FWL_VKEY_Tab) {
+      pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Tab) {
     return true;
   }
 #endif
@@ -168,7 +168,7 @@
   }
 
   if (pMsg->m_dwCmd == CFWL_MessageKey::KeyCommand::kKeyDown &&
-      pMsg->m_dwKeyCode == XFA_FWL_VKEY_Return) {
+      pMsg->m_dwKeyCodeOrChar == XFA_FWL_VKEY_Return) {
     CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetFWLApp()->GetWidgetMgr();
     CFWL_Widget* pDefButton = pWidgetMgr->GetDefaultButton(pMessageForm);
     if (pDefButton) {
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index 67b9cad..cb9b9a3 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -203,7 +203,7 @@
 }
 
 void CFWL_PushButton::OnKeyDown(CFWL_MessageKey* pMsg) {
-  if (pMsg->m_dwKeyCode != XFA_FWL_VKEY_Return)
+  if (pMsg->m_dwKeyCodeOrChar != XFA_FWL_VKEY_Return)
     return;
 
   CFWL_EventMouse wmMouse(this, nullptr,
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 010d05e..0943535 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -545,7 +545,7 @@
   return true;
 }
 
-bool CXFA_FFField::OnChar(XFA_FWL_VKEYCODE dwChar, uint32_t dwFlags) {
+bool CXFA_FFField::OnChar(uint32_t 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 0977a6f..55ce4c6 100644
--- a/xfa/fxfa/cxfa_fffield.h
+++ b/xfa/fxfa/cxfa_fffield.h
@@ -54,7 +54,7 @@
   bool OnKillFocus(CXFA_FFWidget* pNewWidget) override WARN_UNUSED_RESULT;
   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;
+  bool OnChar(uint32_t 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 6b46a4c..3e4930a 100644
--- a/xfa/fxfa/cxfa_ffsignature.cpp
+++ b/xfa/fxfa/cxfa_ffsignature.cpp
@@ -99,7 +99,7 @@
   return false;
 }
 
-bool CXFA_FFSignature::OnChar(XFA_FWL_VKEYCODE dwKeyCode, uint32_t dwFlags) {
+bool CXFA_FFSignature::OnChar(uint32_t nChar, uint32_t dwFlags) {
   return false;
 }
 
diff --git a/xfa/fxfa/cxfa_ffsignature.h b/xfa/fxfa/cxfa_ffsignature.h
index 122e1b3..2fa31fa 100644
--- a/xfa/fxfa/cxfa_ffsignature.h
+++ b/xfa/fxfa/cxfa_ffsignature.h
@@ -37,7 +37,7 @@
   bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) 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;
+  bool OnChar(uint32_t 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 3f14c4c..a202280 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -463,7 +463,7 @@
   return false;
 }
 
-bool CXFA_FFWidget::OnChar(XFA_FWL_VKEYCODE dwChar, uint32_t dwFlags) {
+bool CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) {
   return false;
 }
 
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 75f134e..66b8450 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -137,8 +137,7 @@
                          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 bool OnChar(uint32_t 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 46461d0..4144663 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -136,7 +136,7 @@
 }
 
 bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget,
-                                  XFA_FWL_VKEYCODE dwChar,
+                                  uint32_t dwChar,
                                   uint32_t dwFlags) {
   return hWidget->OnChar(dwChar, dwFlags);
 }
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.h b/xfa/fxfa/cxfa_ffwidgethandler.h
index d66db08..96303a1 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.h
+++ b/xfa/fxfa/cxfa_ffwidgethandler.h
@@ -73,9 +73,7 @@
   bool OnKeyUp(CXFA_FFWidget* hWidget,
                XFA_FWL_VKEYCODE dwKeyCode,
                uint32_t dwFlags);
-  bool OnChar(CXFA_FFWidget* hWidget,
-              XFA_FWL_VKEYCODE dwChar,
-              uint32_t dwFlags);
+  bool OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags);
   FWL_WidgetHit HitTest(CXFA_FFWidget* pWidget, const CFX_PointF& point);
   void RenderWidget(CXFA_FFWidget* hWidget,
                     CFGAS_GEGraphics* pGS,