Fix behavior of Delete key in XFA edit.

Delete had two issues: it acted as a backspace that did not move
the caret; delete was considered a valid char to insert in the
character buffer.

Bug: chromium:820104
Change-Id: I869eedcbf369b9b1df79f16285d991b8e630cd05
Reviewed-on: https://pdfium-review.googlesource.com/31291
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 871aa3c..afa9aac 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -1224,10 +1224,7 @@
         break;
       }
 
-      if (m_CursorPosition > 0) {
-        SetCursorPosition(m_EdtEngine.GetIndexBefore(m_CursorPosition));
-        m_EdtEngine.Delete(m_CursorPosition, 1);
-      }
+      m_EdtEngine.Delete(m_CursorPosition, 1);
       break;
     }
     case FWL_VKEY_Insert:
@@ -1253,20 +1250,21 @@
 
   wchar_t c = static_cast<wchar_t>(pMsg->m_dwKeyCode);
   switch (c) {
-    case FWL_VKEY_Back:
+    case L'\b':
       if (m_CursorPosition > 0) {
         SetCursorPosition(m_EdtEngine.GetIndexBefore(m_CursorPosition));
         m_EdtEngine.Delete(m_CursorPosition, 1);
       }
       break;
-    case FWL_VKEY_NewLine:
-    case FWL_VKEY_Escape:
+    case L'\n':
+    case 27:   // Esc
+    case 127:  // Delete
       break;
-    case FWL_VKEY_Tab:
+    case L'\t':
       m_EdtEngine.Insert(m_CursorPosition, L"\t");
       SetCursorPosition(m_CursorPosition + 1);
       break;
-    case FWL_VKEY_Return:
+    case L'\r':
       if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_WantReturn) {
         m_EdtEngine.Insert(m_CursorPosition, L"\n");
         SetCursorPosition(m_CursorPosition + 1);