Bug 895274 part.11 Rename NS_KEY_DOWN to eKeyDown r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 29 Aug 2015 08:58:27 +0900
changeset 292523 4a2797061277a5a2a3ba878144431a3b2f50392f
parent 292522 83b87aa188ab9c744697b87eb0c47c8a13d5babc
child 292524 d826b30611d8941e7ff487ea8acd51cade119ce9
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs895274
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 895274 part.11 Rename NS_KEY_DOWN to eKeyDown r=smaug
dom/base/TextInputProcessor.cpp
dom/base/nsContentUtils.cpp
dom/events/Event.cpp
dom/events/EventNameList.h
dom/events/EventStateManager.cpp
dom/events/KeyboardEvent.cpp
dom/events/WheelHandlingHelper.cpp
dom/ipc/TabChild.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
editor/libeditor/nsEditorEventListener.cpp
gfx/layers/apz/src/APZCTreeManager.cpp
layout/base/AccessibleCaretEventHub.cpp
layout/base/TouchCaret.cpp
layout/base/nsPresShell.cpp
layout/printing/nsPrintPreviewListener.cpp
layout/xul/nsButtonBoxFrame.cpp
widget/EventMessageList.h
widget/TextEventDispatcher.cpp
widget/TextEventDispatcher.h
widget/WidgetEventImpl.cpp
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.mm
widget/gonk/nsAppShell.cpp
widget/gtk/nsGtkKeyUtils.cpp
widget/gtk/nsWindow.cpp
widget/nsBaseWidget.cpp
widget/qt/nsWindow.cpp
widget/windows/KeyboardLayout.cpp
widget/windows/KeyboardLayout.h
--- a/dom/base/TextInputProcessor.cpp
+++ b/dom/base/TextInputProcessor.cpp
@@ -244,17 +244,17 @@ TextInputProcessor::IsValidStateForCompo
   return NS_OK;
 }
 
 bool
 TextInputProcessor::IsValidEventTypeForComposition(
                       const WidgetKeyboardEvent& aKeyboardEvent) const
 {
   // The key event type of composition methods must be "" or "keydown".
-  if (aKeyboardEvent.mMessage == NS_KEY_DOWN) {
+  if (aKeyboardEvent.mMessage == eKeyDown) {
     return true;
   }
   if (aKeyboardEvent.mMessage == NS_USER_DEFINED_EVENT &&
       aKeyboardEvent.userType &&
       nsDependentAtomString(aKeyboardEvent.userType).EqualsLiteral("on")) {
     return true;
   }
   return false;
@@ -305,19 +305,19 @@ TextInputProcessor::MaybeDispatchKeyupFo
                       uint32_t aKeyFlags)
 {
   EventDispatcherResult result;
 
   if (!aKeyboardEvent) {
     return result;
   }
 
-  // If the mMessage is NS_KEY_DOWN, the caller doesn't want TIP to dispatch
+  // If the mMessage is eKeyDown, the caller doesn't want TIP to dispatch
   // keyup event.
-  if (aKeyboardEvent->mMessage == NS_KEY_DOWN) {
+  if (aKeyboardEvent->mMessage == eKeyDown) {
     return result;
   }
 
   // If the widget has been destroyed, we can do nothing here.
   result.mResult = IsValidStateForComposition();
   if (NS_FAILED(result.mResult)) {
     result.mCanContinue = false;
     return result;
@@ -833,17 +833,17 @@ TextInputProcessor::KeydownInternal(cons
   nsRefPtr<TextEventDispatcher> kungfuDeathGrip(mDispatcher);
   rv = IsValidStateForComposition();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   nsEventStatus status = aConsumedFlags ? nsEventStatus_eConsumeNoDefault :
                                           nsEventStatus_eIgnore;
-  if (!mDispatcher->DispatchKeyboardEvent(NS_KEY_DOWN, keyEvent, status,
+  if (!mDispatcher->DispatchKeyboardEvent(eKeyDown, keyEvent, status,
                                           GetDispatchTo())) {
     // If keydown event isn't dispatched, we don't need to dispatch keypress
     // events.
     return NS_OK;
   }
 
   aConsumedFlags |=
     (status == nsEventStatus_eConsumeNoDefault) ? KEYDOWN_IS_CONSUMED :
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7719,17 +7719,17 @@ nsContentUtils::SendKeyEvent(nsIWidget* 
                              bool* aDefaultActionTaken)
 {
   // get the widget to send the event to
   if (!aWidget)
     return NS_ERROR_FAILURE;
 
   EventMessage msg;
   if (aType.EqualsLiteral("keydown"))
-    msg = NS_KEY_DOWN;
+    msg = eKeyDown;
   else if (aType.EqualsLiteral("keyup"))
     msg = eKeyUp;
   else if (aType.EqualsLiteral("keypress"))
     msg = eKeyPress;
   else
     return NS_ERROR_FAILURE;
 
   WidgetKeyboardEvent event(true, msg, aWidget);
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -781,17 +781,17 @@ Event::GetEventPopupControlState(WidgetE
       case eKeyUp:
         // space key on focused button. see note at NS_MOUSE_CLICK.
         if (key == nsIDOMKeyEvent::DOM_VK_SPACE) {
           abuse = openAllowed;
         } else if (PopupAllowedForEvent("keyup")) {
           abuse = openControlled;
         }
         break;
-      case NS_KEY_DOWN :
+      case eKeyDown:
         if (PopupAllowedForEvent("keydown")) {
           abuse = openControlled;
         }
         break;
       default:
         break;
       }
     }
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -222,17 +222,17 @@ EVENT(input,
       NS_EDITOR_INPUT,
       EventNameType_HTMLXUL,
       eEditorInputEventClass)
 EVENT(invalid,
       NS_FORM_INVALID,
       EventNameType_HTMLXUL,
       eBasicEventClass)
 EVENT(keydown,
-      NS_KEY_DOWN,
+      eKeyDown,
       EventNameType_HTMLXUL,
       eKeyboardEventClass)
 EVENT(keypress,
       eKeyPress,
       EventNameType_HTMLXUL,
       eKeyboardEventClass)
 EVENT(keyup,
       eKeyUp,
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -679,17 +679,17 @@ EventStateManager::PreHandleEvent(nsPres
           (modifierMask == Prefs::ChromeAccessModifierMask() ||
            modifierMask == Prefs::ContentAccessModifierMask())) {
         HandleAccessKey(aPresContext, keyEvent, aStatus, nullptr,
                         eAccessKeyProcessingNormal, modifierMask);
       }
     }
     // then fall through...
   case NS_KEY_BEFORE_DOWN:
-  case NS_KEY_DOWN:
+  case eKeyDown:
   case NS_KEY_AFTER_DOWN:
   case NS_KEY_BEFORE_UP:
   case eKeyUp:
   case NS_KEY_AFTER_UP:
     {
       nsIContent* content = GetFocusedContent();
       if (content)
         mCurrentTargetContent = content;
--- a/dom/events/KeyboardEvent.cpp
+++ b/dom/events/KeyboardEvent.cpp
@@ -149,17 +149,17 @@ KeyboardEvent::CharCode()
 {
   // If this event is initialized with ctor, we shouldn't check event type.
   if (mInitializedByCtor) {
     return mEvent->AsKeyboardEvent()->charCode;
   }
 
   switch (mEvent->mMessage) {
   case NS_KEY_BEFORE_DOWN:
-  case NS_KEY_DOWN:
+  case eKeyDown:
   case NS_KEY_AFTER_DOWN:
   case NS_KEY_BEFORE_UP:
   case eKeyUp:
   case NS_KEY_AFTER_UP:
     return 0;
   case eKeyPress:
     return mEvent->AsKeyboardEvent()->charCode;
   default:
@@ -195,17 +195,17 @@ KeyboardEvent::Which()
 {
   // If this event is initialized with ctor, which can have independent value.
   if (mInitializedByCtor) {
     return mInitializedWhichValue;
   }
 
   switch (mEvent->mMessage) {
     case NS_KEY_BEFORE_DOWN:
-    case NS_KEY_DOWN:
+    case eKeyDown:
     case NS_KEY_AFTER_DOWN:
     case NS_KEY_BEFORE_UP:
     case eKeyUp:
     case NS_KEY_AFTER_UP:
       return KeyCode();
     case eKeyPress:
       //Special case for 4xp bug 62878.  Try to make value of which
       //more closely mirror the values that 4.x gave for RETURN and BACKSPACE
--- a/dom/events/WheelHandlingHelper.cpp
+++ b/dom/events/WheelHandlingHelper.cpp
@@ -204,17 +204,17 @@ WheelTransaction::OnEvent(WidgetEvent* a
         if (!sMouseMoved && OutOfTime(sTime, GetIgnoreMoveDelayTime())) {
           sMouseMoved = PR_IntervalToMilliseconds(PR_IntervalNow());
         }
       }
       return;
     }
     case eKeyPress:
     case eKeyUp:
-    case NS_KEY_DOWN:
+    case eKeyDown:
     case NS_MOUSE_BUTTON_UP:
     case NS_MOUSE_BUTTON_DOWN:
     case NS_MOUSE_DOUBLECLICK:
     case NS_MOUSE_CLICK:
     case NS_CONTEXTMENU:
     case NS_DRAGDROP_DROP:
       EndTransaction();
       return;
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2246,17 +2246,17 @@ TabChild::RecvRealKeyEvent(const WidgetK
       autoCache.CacheNoCommands();
     }
   }
 
   WidgetKeyboardEvent localEvent(event);
   localEvent.widget = mPuppetWidget;
   nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
 
-  if (event.mMessage == NS_KEY_DOWN) {
+  if (event.mMessage == eKeyDown) {
     mIgnoreKeyPressEvent = status == nsEventStatus_eConsumeNoDefault;
   }
 
   if (localEvent.mFlags.mWantReplyFromContentProcess) {
     SendReplyKeyEvent(localEvent);
   }
 
   if (PresShell::BeforeAfterKeyboardEventEnabled()) {
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1822,17 +1822,17 @@ CocoaEventTypeForEvent(const WidgetGUIEv
       }
 
       return NPCocoaEventMouseMoved;
     }
     case NS_MOUSE_BUTTON_DOWN:
       return NPCocoaEventMouseDown;
     case NS_MOUSE_BUTTON_UP:
       return NPCocoaEventMouseUp;
-    case NS_KEY_DOWN:
+    case eKeyDown:
       return NPCocoaEventKeyDown;
     case eKeyUp:
       return NPCocoaEventKeyUp;
     case NS_FOCUS_CONTENT:
     case NS_BLUR_CONTENT:
       return NPCocoaEventFocusChanged;
     case NS_MOUSE_SCROLL:
       return NPCocoaEventScrollWheel;
@@ -1900,24 +1900,24 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* 
       if (wheelEvent) {
         cocoaEvent.data.mouse.deltaX = wheelEvent->lineOrPageDeltaX;
         cocoaEvent.data.mouse.deltaY = wheelEvent->lineOrPageDeltaY;
       } else {
         NS_WARNING("NS_MOUSE_SCROLL is not a WidgetWheelEvent? (could be, haven't checked)");
       }
       break;
     }
-    case NS_KEY_DOWN:
+    case eKeyDown:
     case eKeyUp:
     {
       WidgetKeyboardEvent* keyEvent = anEvent->AsKeyboardEvent();
 
       // That keyEvent->mPluginTextEventString is non-empty is a signal that we should
       // create a text event for the plugin, instead of a key event.
-      if (anEvent->mMessage == NS_KEY_DOWN &&
+      if (anEvent->mMessage == eKeyDown &&
           !keyEvent->mPluginTextEventString.IsEmpty()) {
         cocoaEvent.type = NPCocoaEventTextInput;
         const char16_t* pluginTextEventString = keyEvent->mPluginTextEventString.get();
         cocoaEvent.data.text.text = (NPNSString*)
           ::CFStringCreateWithCharacters(NULL,
                                          reinterpret_cast<const UniChar*>(pluginTextEventString),
                                          keyEvent->mPluginTextEventString.Length());
       } else {
@@ -2283,18 +2283,18 @@ nsEventStatus nsPluginInstanceOwner::Pro
           event.root = GDK_ROOT_WINDOW();
           event.time = anEvent.time;
           const GdkEventKey* gdkEvent =
             static_cast<const GdkEventKey*>(anEvent.mPluginEvent);
           event.keycode = gdkEvent->hardware_keycode;
           event.state = gdkEvent->state;
           switch (anEvent.mMessage)
             {
-            case NS_KEY_DOWN:
-              // Handle NS_KEY_DOWN for modifier key presses
+            case eKeyDown:
+              // Handle eKeyDown for modifier key presses
               // For non-modifiers we get eKeyPress
               if (gdkEvent->is_modifier)
                 event.type = XKeyPress;
               break;
             case eKeyPress:
               event.type = XKeyPress;
               break;
             case eKeyUp:
--- a/editor/libeditor/nsEditorEventListener.cpp
+++ b/editor/libeditor/nsEditorEventListener.cpp
@@ -387,17 +387,17 @@ nsEditorEventListener::HandleEvent(nsIDO
     }
     // drop
     case NS_DRAGDROP_DROP: {
       nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent);
       return Drop(dragEvent);
     }
 #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
     // keydown
-    case NS_KEY_DOWN: {
+    case eKeyDown: {
       nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
       return KeyDown(keyEvent);
     }
     // keyup
     case eKeyUp: {
       nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
       return KeyUp(keyEvent);
     }
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -883,17 +883,17 @@ APZCTreeManager::UpdateWheelTransaction(
 
      ScreenIntPoint point =
        ViewAs<ScreenPixel>(aEvent.refPoint, PixelCastJustification::LayoutDeviceToScreenForUntransformedEvent);
      txn->OnMouseMove(point);
      return;
    }
    case eKeyPress:
    case eKeyUp:
-   case NS_KEY_DOWN:
+   case eKeyDown:
    case NS_MOUSE_BUTTON_UP:
    case NS_MOUSE_BUTTON_DOWN:
    case NS_MOUSE_DOUBLECLICK:
    case NS_MOUSE_CLICK:
    case NS_CONTEXTMENU:
    case NS_DRAGDROP_DROP:
      txn->EndTransaction();
      return;
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -606,17 +606,17 @@ AccessibleCaretEventHub::HandleTouchEven
   return rv;
 }
 
 nsEventStatus
 AccessibleCaretEventHub::HandleKeyboardEvent(WidgetKeyboardEvent* aEvent)
 {
   switch (aEvent->mMessage) {
   case eKeyUp:
-  case NS_KEY_DOWN:
+  case eKeyDown:
   case eKeyPress:
     mManager->OnKeyboardEvent();
     break;
 
   default:
     break;
   }
 
--- a/layout/base/TouchCaret.cpp
+++ b/layout/base/TouchCaret.cpp
@@ -779,17 +779,17 @@ TouchCaret::HandleEvent(WidgetEvent* aEv
       status = HandleMouseMoveEvent(aEvent->AsMouseEvent());
       break;
     case NS_TOUCH_CANCEL:
       mTouchesId.Clear();
       SetState(TOUCHCARET_NONE);
       LaunchExpirationTimer();
       break;
     case eKeyUp:
-    case NS_KEY_DOWN:
+    case eKeyDown:
     case eKeyPress:
     case NS_WHEEL_WHEEL:
     case NS_WHEEL_START:
     case NS_WHEEL_STOP:
       // Disable touch caret while key/wheel event is received.
       TOUCHCARET_LOG("Receive key/wheel event %d", aEvent->mMessage);
       SetVisibility(false);
       break;
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6842,17 +6842,17 @@ PresShell::DispatchBeforeKeyboardEventIn
                                                bool& aDefaultPrevented)
 {
   size_t length = aChain.Length();
   if (!CanDispatchEvent(&aEvent) || !length) {
     return;
   }
 
   EventMessage message =
-    (aEvent.mMessage == NS_KEY_DOWN) ? NS_KEY_BEFORE_DOWN : NS_KEY_BEFORE_UP;
+    (aEvent.mMessage == eKeyDown) ? NS_KEY_BEFORE_DOWN : NS_KEY_BEFORE_UP;
   nsCOMPtr<EventTarget> eventTarget;
   // Dispatch before events from the outermost element.
   for (int32_t i = length - 1; i >= 0; i--) {
     eventTarget = do_QueryInterface(aChain[i]->OwnerDoc()->GetWindow());
     if (!eventTarget || !CanDispatchEvent(&aEvent)) {
       return;
     }
 
@@ -6876,17 +6876,17 @@ PresShell::DispatchAfterKeyboardEventInt
                                               size_t aStartOffset)
 {
   size_t length = aChain.Length();
   if (!CanDispatchEvent(&aEvent) || !length) {
     return;
   }
 
   EventMessage message =
-    (aEvent.mMessage == NS_KEY_DOWN) ? NS_KEY_AFTER_DOWN : NS_KEY_AFTER_UP;
+    (aEvent.mMessage == eKeyDown) ? NS_KEY_AFTER_DOWN : NS_KEY_AFTER_UP;
   bool embeddedCancelled = aEmbeddedCancelled;
   nsCOMPtr<EventTarget> eventTarget;
   // Dispatch after events from the innermost element.
   for (uint32_t i = aStartOffset; i < length; i++) {
     eventTarget = do_QueryInterface(aChain[i]->OwnerDoc()->GetWindow());
     if (!eventTarget || !CanDispatchEvent(&aEvent)) {
       return;
     }
@@ -6903,18 +6903,17 @@ PresShell::DispatchAfterKeyboardEventInt
 void
 PresShell::DispatchAfterKeyboardEvent(nsINode* aTarget,
                                       const WidgetKeyboardEvent& aEvent,
                                       bool aEmbeddedCancelled)
 {
   MOZ_ASSERT(aTarget);
   MOZ_ASSERT(BeforeAfterKeyboardEventEnabled());
 
-  if (NS_WARN_IF(aEvent.mMessage != NS_KEY_DOWN &&
-                 aEvent.mMessage != eKeyUp)) {
+  if (NS_WARN_IF(aEvent.mMessage != eKeyDown && aEvent.mMessage != eKeyUp)) {
     return;
   }
 
   // Build up a target chain. Each item in the chain will receive an after event.
   nsAutoTArray<nsCOMPtr<Element>, 5> chain;
   bool targetIsIframe = false;
   BuildTargetChainForBeforeAfterKeyboardEvent(aTarget, chain, targetIsIframe);
   DispatchAfterKeyboardEventInternal(chain, aEvent, aEmbeddedCancelled);
@@ -6941,17 +6940,17 @@ PresShell::HandleKeyboardEvent(nsINode* 
   if (aEvent.mMessage == eKeyPress ||
       !BeforeAfterKeyboardEventEnabled()) {
     EventDispatcher::Dispatch(aTarget, mPresContext,
                               &aEvent, nullptr, aStatus, aEventCB);
     return;
   }
 
   MOZ_ASSERT(aTarget);
-  MOZ_ASSERT(aEvent.mMessage == NS_KEY_DOWN || aEvent.mMessage == eKeyUp);
+  MOZ_ASSERT(aEvent.mMessage == eKeyDown || aEvent.mMessage == eKeyUp);
 
   // Build up a target chain. Each item in the chain will receive a before event.
   nsAutoTArray<nsCOMPtr<Element>, 5> chain;
   bool targetIsIframe = false;
   BuildTargetChainForBeforeAfterKeyboardEvent(aTarget, chain, targetIsIframe);
 
   // Dispatch before events. If each item in the chain consumes the before
   // event and doesn't prevent the default action, we will go further to
@@ -7196,17 +7195,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
         nsCOMPtr<nsIPresShell> shell = frame->PresContext()->GetPresShell();
         return shell->HandleEvent(frame, aEvent, true, aEventStatus);
       }
     }
   }
 
   if (aEvent->mClass == eKeyboardEventClass &&
       mDocument && mDocument->EventHandlingSuppressed()) {
-    if (aEvent->mMessage == NS_KEY_DOWN) {
+    if (aEvent->mMessage == eKeyDown) {
       mNoDelayedKeyEvents = true;
     } else if (!mNoDelayedKeyEvents) {
       DelayedEvent* event = new DelayedKeyEvent(aEvent->AsKeyboardEvent());
       if (!mDelayedEvents.AppendElement(event)) {
         delete event;
       }
     }
     return NS_OK;
@@ -7628,17 +7627,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
           if (!eventTarget) {
             eventTarget = mDocument->GetRootElement();
           }
         } else {
           eventTarget = mDocument->GetRootElement();
         }
       }
 
-      if (aEvent->mMessage == NS_KEY_DOWN) {
+      if (aEvent->mMessage == eKeyDown) {
         NS_IF_RELEASE(gKeyDownTarget);
         NS_IF_ADDREF(gKeyDownTarget = eventTarget);
       }
       else if ((aEvent->mMessage == eKeyPress ||
                 aEvent->mMessage == eKeyUp) &&
                gKeyDownTarget) {
         // If a different element is now focused for the keypress/keyup event
         // than what was focused during the keydown event, check if the new
@@ -7839,17 +7838,17 @@ PresShell::HandleEventInternal(WidgetEve
   if (!NS_EVENT_NEEDS_FRAME(aEvent) || GetCurrentEventFrame() || GetCurrentEventContent()) {
     bool touchIsNew = false;
     bool isHandlingUserInput = false;
 
     // XXX How about IME events and input events for plugins?
     if (aEvent->mFlags.mIsTrusted) {
       switch (aEvent->mMessage) {
       case eKeyPress:
-      case NS_KEY_DOWN:
+      case eKeyDown:
       case eKeyUp: {
         nsIDocument* doc = GetCurrentEventContent() ?
                            mCurrentEventContent->OwnerDoc() : nullptr;
         auto keyCode = aEvent->AsKeyboardEvent()->keyCode;
         if (keyCode == NS_VK_ESCAPE) {
           nsIDocument* root = nsContentUtils::GetRootDocument(doc);
           if (root && root->IsFullScreenDoc()) {
             // Prevent default action on ESC key press when exiting
@@ -7974,17 +7973,17 @@ PresShell::HandleEventInternal(WidgetEve
       if (!mIsDestroying && NS_SUCCEEDED(rv)) {
         rv = manager->PostHandleEvent(mPresContext, aEvent,
                                       GetCurrentEventFrame(), aStatus);
       }
     }
 
     switch (aEvent->mMessage) {
     case eKeyPress:
-    case NS_KEY_DOWN:
+    case eKeyDown:
     case eKeyUp: {
       if (aEvent->AsKeyboardEvent()->keyCode == NS_VK_ESCAPE) {
         if (aEvent->mMessage == eKeyUp) {
           // Reset this flag after key up is handled.
           mIsLastChromeOnlyEscapeKeyConsumed = false;
         } else {
           if (aEvent->mFlags.mOnlyChromeDispatch &&
               aEvent->mFlags.mDefaultPreventedByChrome) {
--- a/layout/printing/nsPrintPreviewListener.cpp
+++ b/layout/printing/nsPrintPreviewListener.cpp
@@ -113,26 +113,26 @@ GetActionForEvent(nsIDOMEvent* aEvent)
 {
   WidgetKeyboardEvent* keyEvent =
     aEvent->GetInternalNSEvent()->AsKeyboardEvent();
   if (!keyEvent) {
     return eEventAction_Suppress;
   }
 
   if (keyEvent->mFlags.mInSystemGroup) {
-    NS_ASSERTION(keyEvent->mMessage == NS_KEY_DOWN,
+    NS_ASSERTION(keyEvent->mMessage == eKeyDown,
       "Assuming we're listening only keydown event in system group");
     return eEventAction_StopPropagation;
   }
 
   if (keyEvent->IsAlt() || keyEvent->IsControl() || keyEvent->IsMeta()) {
     // Don't consume keydown event because following keypress event may be
     // handled as access key or shortcut key.
-    return (keyEvent->mMessage == NS_KEY_DOWN) ? eEventAction_StopPropagation :
-                                                 eEventAction_Suppress;
+    return (keyEvent->mMessage == eKeyDown) ? eEventAction_StopPropagation :
+                                              eEventAction_Suppress;
   }
 
   static const uint32_t kOKKeyCodes[] = {
     nsIDOMKeyEvent::DOM_VK_PAGE_UP, nsIDOMKeyEvent::DOM_VK_PAGE_DOWN,
     nsIDOMKeyEvent::DOM_VK_UP,      nsIDOMKeyEvent::DOM_VK_DOWN, 
     nsIDOMKeyEvent::DOM_VK_HOME,    nsIDOMKeyEvent::DOM_VK_END 
   };
 
--- a/layout/xul/nsButtonBoxFrame.cpp
+++ b/layout/xul/nsButtonBoxFrame.cpp
@@ -106,17 +106,17 @@ nsButtonBoxFrame::HandleEvent(nsPresCont
                               nsEventStatus* aEventStatus)
 {
   NS_ENSURE_ARG_POINTER(aEventStatus);
   if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
     return NS_OK;
   }
 
   switch (aEvent->mMessage) {
-    case NS_KEY_DOWN: {
+    case eKeyDown: {
       WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
       if (!keyEvent) {
         break;
       }
       if (NS_VK_SPACE == keyEvent->keyCode) {
         EventStateManager* esm = aPresContext->EventStateManager();
         // :hover:active state
         esm->SetContentState(mContent, NS_EVENT_STATE_HOVER);
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -16,17 +16,17 @@ NS_EVENT_MESSAGE(eVoidEvent,            
 NS_EVENT_MESSAGE(eAllEvents,            1)
 
 NS_EVENT_MESSAGE(eWindowEventFirst,     100)
 // Widget may be destroyed
 NS_EVENT_MESSAGE(eWindowClose,          eWindowEventFirst + 1)
 
 NS_EVENT_MESSAGE(eKeyPress,             eWindowEventFirst + 31)
 NS_EVENT_MESSAGE(eKeyUp,                eWindowEventFirst + 32)
-NS_EVENT_MESSAGE(NS_KEY_DOWN,           eWindowEventFirst + 33)
+NS_EVENT_MESSAGE(eKeyDown,              eWindowEventFirst + 33)
 
 NS_EVENT_MESSAGE(NS_KEY_BEFORE_DOWN,    eWindowEventFirst + 34)
 NS_EVENT_MESSAGE(NS_KEY_AFTER_DOWN,     eWindowEventFirst + 35)
 NS_EVENT_MESSAGE(NS_KEY_BEFORE_UP,      eWindowEventFirst + 36)
 NS_EVENT_MESSAGE(NS_KEY_AFTER_UP,       eWindowEventFirst + 37)
 
 NS_EVENT_MESSAGE(NS_RESIZE_EVENT,       eWindowEventFirst + 60)
 NS_EVENT_MESSAGE(NS_SCROLL_EVENT,       eWindowEventFirst + 61)
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -314,17 +314,17 @@ TextEventDispatcher::DispatchKeyboardEve
 bool
 TextEventDispatcher::DispatchKeyboardEventInternal(
                        EventMessage aMessage,
                        const WidgetKeyboardEvent& aKeyboardEvent,
                        nsEventStatus& aStatus,
                        DispatchTo aDispatchTo,
                        uint32_t aIndexOfKeypress)
 {
-  MOZ_ASSERT(aMessage == NS_KEY_DOWN || aMessage == eKeyUp ||
+  MOZ_ASSERT(aMessage == eKeyDown || aMessage == eKeyUp ||
              aMessage == eKeyPress, "Invalid aMessage value");
   nsresult rv = GetState();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   // If the key shouldn't cause keypress events, don't this patch them.
   if (aMessage == eKeyPress && !aKeyboardEvent.ShouldCauseKeypressEvents()) {
@@ -351,19 +351,19 @@ TextEventDispatcher::DispatchKeyboardEve
   if (aStatus == nsEventStatus_eConsumeNoDefault) {
     // If the key event should be dispatched as consumed event, marking it here.
     // This is useful to prevent double action.  E.g., when the key was already
     // handled by system, our chrome shouldn't handle it.
     keyEvent.mFlags.mDefaultPrevented = true;
   }
 
   // Corrects each member for the specific key event type.
-  if (aMessage == NS_KEY_DOWN || aMessage == eKeyUp) {
+  if (aMessage == eKeyDown || aMessage == eKeyUp) {
     MOZ_ASSERT(!aIndexOfKeypress,
-      "aIndexOfKeypress must be 0 for either NS_KEY_DOWN or eKeyUp");
+      "aIndexOfKeypress must be 0 for either eKeyDown or eKeyUp");
     // charCode of keydown and keyup should be 0.
     keyEvent.charCode = 0;
   } else if (keyEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING) {
     MOZ_ASSERT(!aIndexOfKeypress,
       "aIndexOfKeypress must be 0 for eKeyPress of non-printable key");
     // If keypress event isn't caused by printable key, its charCode should
     // be 0.
     keyEvent.charCode = 0;
--- a/widget/TextEventDispatcher.h
+++ b/widget/TextEventDispatcher.h
@@ -198,17 +198,17 @@ public:
     // the event may be sent to a child process when it has focus.  If there is
     // no child process, the event may be handled synchronously.
     eDispatchToCurrentProcess = 1
   };
 
   /**
    * DispatchKeyboardEvent() maybe dispatches aKeyboardEvent.
    *
-   * @param aMessage        Must be NS_KEY_DOWN or eKeyUp.
+   * @param aMessage        Must be eKeyDown or eKeyUp.
    *                        Use MaybeDispatchKeypressEvents() for dispatching
    *                        eKeyPress.
    * @param aKeyboardEvent  A keyboard event.
    * @param aStatus         If dispatching event should be marked as consumed,
    *                        set nsEventStatus_eConsumeNoDefault.  Otherwise,
    *                        set nsEventStatus_eIgnore.  After dispatching
    *                        a event and it's consumed this returns
    *                        nsEventStatus_eConsumeNoDefault.
@@ -330,17 +330,17 @@ private:
    *                        an error.  Otherwise, returns NS_OK even if aStatus
    *                        is nsEventStatus_eConsumeNoDefault.
    */
   nsresult StartCompositionAutomaticallyIfNecessary(nsEventStatus& aStatus);
 
   /**
    * DispatchKeyboardEventInternal() maybe dispatches aKeyboardEvent.
    *
-   * @param aMessage        Must be NS_KEY_DOWN, eKeyUp or eKeyPress.
+   * @param aMessage        Must be eKeyDown, eKeyUp or eKeyPress.
    * @param aKeyboardEvent  A keyboard event.  If aMessage is eKeyPress and
    *                        the event is for second or later character, its
    *                        mKeyValue should be empty string.
    * @param aStatus         If dispatching event should be marked as consumed,
    *                        set nsEventStatus_eConsumeNoDefault.  Otherwise,
    *                        set nsEventStatus_eIgnore.  After dispatching
    *                        a event and it's consumed this returns
    *                        nsEventStatus_eConsumeNoDefault.
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -114,17 +114,17 @@ WidgetEvent::HasDragEventMessage() const
       return false;
   }
 }
 
 bool
 WidgetEvent::HasKeyEventMessage() const
 {
   switch (mMessage) {
-    case NS_KEY_DOWN:
+    case eKeyDown:
     case eKeyPress:
     case eKeyUp:
     case NS_KEY_BEFORE_DOWN:
     case NS_KEY_BEFORE_UP:
     case NS_KEY_AFTER_DOWN:
     case NS_KEY_AFTER_UP:
       return true;
     default:
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1468,23 +1468,23 @@ nsWindow::InitKeyEvent(WidgetKeyboardEve
             charCode = key.BaseUnicodeChar();
         }
         event.isChar = (charCode >= ' ');
         event.charCode = event.isChar ? charCode : 0;
         event.keyCode = (event.charCode > 0) ? 0 : domKeyCode;
         event.mPluginEvent.Clear();
     } else {
 #ifdef DEBUG
-        if (event.mMessage != NS_KEY_DOWN && event.mMessage != eKeyUp) {
+        if (event.mMessage != eKeyDown && event.mMessage != eKeyUp) {
             ALOG("InitKeyEvent: unexpected event.mMessage %d", event.mMessage);
         }
 #endif // DEBUG
 
         // Flash will want a pluginEvent for keydown and keyup events.
-        ANPKeyActions action = event.mMessage == NS_KEY_DOWN
+        ANPKeyActions action = event.mMessage == eKeyDown
                              ? kDown_ANPKeyAction
                              : kUp_ANPKeyAction;
         InitPluginEvent(pluginEvent, action, key);
 
         event.isChar = false;
         event.charCode = 0;
         event.keyCode = domKeyCode;
         event.mPluginEvent.Copy(*pluginEvent);
@@ -1501,17 +1501,17 @@ nsWindow::InitKeyEvent(WidgetKeyboardEve
     // causes text input even while right Alt key is pressed.  However, this
     // is necessary for Android 2.3 compatibility.
     if (event.mMessage == eKeyPress &&
         key.UnicodeChar() && key.UnicodeChar() != key.BaseUnicodeChar()) {
         event.modifiers &= ~(MODIFIER_ALT | MODIFIER_CONTROL | MODIFIER_META);
     }
 
     event.mIsRepeat =
-        (event.mMessage == NS_KEY_DOWN || event.mMessage == eKeyPress) &&
+        (event.mMessage == eKeyDown || event.mMessage == eKeyPress) &&
         (!!(key.Flags() & AKEY_EVENT_FLAG_LONG_PRESS) || !!key.RepeatCount());
     event.location =
         WidgetKeyboardEvent::ComputeLocationFromCodeValue(event.mCodeNameIndex);
     event.time = key.Time();
 
     if (gMenu)
         gMenuConsumed = true;
 }
@@ -1575,17 +1575,17 @@ nsWindow::HandleSpecialKey(AndroidGeckoE
 void
 nsWindow::OnKeyEvent(AndroidGeckoEvent *ae)
 {
     nsRefPtr<nsWindow> kungFuDeathGrip(this);
     RemoveIMEComposition();
     EventMessage msg;
     switch (ae->Action()) {
     case AKEY_EVENT_ACTION_DOWN:
-        msg = NS_KEY_DOWN;
+        msg = eKeyDown;
         break;
     case AKEY_EVENT_ACTION_UP:
         msg = eKeyUp;
         break;
     case AKEY_EVENT_ACTION_MULTIPLE:
         // Keys with multiple action are handled in Java,
         // and we should never see one here
         MOZ_CRASH("Cannot handle key with multiple action");
@@ -1692,17 +1692,17 @@ nsWindow::RemoveIMEComposition()
 /*
  * Send dummy key events for pages that are unaware of input events,
  * to provide web compatibility for pages that depend on key events.
  * Our dummy key events have 0 as the keycode.
  */
 void
 nsWindow::SendIMEDummyKeyEvents()
 {
-    WidgetKeyboardEvent downEvent(true, NS_KEY_DOWN, this);
+    WidgetKeyboardEvent downEvent(true, eKeyDown, this);
     MOZ_ASSERT(downEvent.keyCode == 0);
     DispatchEvent(&downEvent);
 
     WidgetKeyboardEvent upEvent(true, eKeyUp, this);
     MOZ_ASSERT(upEvent.keyCode == 0);
     DispatchEvent(&upEvent);
 }
 
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -221,17 +221,17 @@ GetNativeKeyEventType(NSEvent* aNativeEv
     default:             return "not key event";
   }
 }
 
 static const char*
 GetGeckoKeyEventType(const WidgetEvent& aEvent)
 {
   switch (aEvent.mMessage) {
-    case NS_KEY_DOWN:    return "NS_KEY_DOWN";
+    case eKeyDown:       return "eKeyDown";
     case eKeyUp:         return "eKeyUp";
     case eKeyPress:      return "eKeyPress";
     default:             return "not key event";
   }
 }
 
 static const char*
 GetRangeTypeName(uint32_t aRangeType)
@@ -1516,28 +1516,28 @@ TextInputHandler::HandleKeyDownEvent(NSE
   KeyEventState* currentKeyEvent = PushKeyEvent(aNativeEvent);
   AutoKeyEventStateCleaner remover(this);
 
   ComplexTextInputPanel* ctiPanel = ComplexTextInputPanel::GetSharedComplexTextInputPanel();
   if (ctiPanel && ctiPanel->IsInComposition()) {
     nsAutoString committed;
     ctiPanel->InterpretKeyEvent(aNativeEvent, committed);
     if (!committed.IsEmpty()) {
-      WidgetKeyboardEvent imeEvent(true, NS_KEY_DOWN, mWidget);
+      WidgetKeyboardEvent imeEvent(true, eKeyDown, mWidget);
       InitKeyEvent(aNativeEvent, imeEvent);
       imeEvent.mPluginTextEventString.Assign(committed);
       DispatchEvent(imeEvent);
     }
     return true;
   }
 
   if (mWidget->IsPluginFocused() || !IsIMEComposing()) {
     NSResponder* firstResponder = [[mView window] firstResponder];
 
-    WidgetKeyboardEvent keydownEvent(true, NS_KEY_DOWN, mWidget);
+    WidgetKeyboardEvent keydownEvent(true, eKeyDown, mWidget);
     InitKeyEvent(aNativeEvent, keydownEvent);
 
     currentKeyEvent->mKeyDownHandled = DispatchEvent(keydownEvent);
     if (Destroyed()) {
       MOZ_LOG(gLog, LogLevel::Info,
         ("%p TextInputHandler::HandleKeyDownEvent, "
          "widget was destroyed by keydown event", this));
       return currentKeyEvent->IsDefaultPrevented();
@@ -2001,17 +2001,17 @@ TextInputHandler::DispatchKeyEventForFla
      this, aNativeEvent, GetNativeKeyEventType(aNativeEvent),
      GetKeyNameForNativeKeyCode([aNativeEvent keyCode]), [aNativeEvent keyCode],
      TrueOrFalse(aDispatchKeyDown), TrueOrFalse(IsIMEComposing())));
 
   if ([aNativeEvent type] != NSFlagsChanged || IsIMEComposing()) {
     return;
   }
 
-  EventMessage message = aDispatchKeyDown ? NS_KEY_DOWN : eKeyUp;
+  EventMessage message = aDispatchKeyDown ? eKeyDown : eKeyUp;
 
   // Fire a key event.
   WidgetKeyboardEvent keyEvent(true, message, mWidget);
   InitKeyEvent(aNativeEvent, keyEvent);
 
   // Attach a plugin event, in case keyEvent gets dispatched to a plugin.  Only
   // one field is needed -- the type.  The other fields can be constructed as
   // the need arises.  But Gecko doesn't have anything equivalent to the
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -336,17 +336,17 @@ KeyEventDispatcher::Dispatch()
     } else {
         DispatchKeyUpEvent();
     }
 }
 
 void
 KeyEventDispatcher::DispatchKeyDownEvent()
 {
-    nsEventStatus status = DispatchKeyEventInternal(NS_KEY_DOWN);
+    nsEventStatus status = DispatchKeyEventInternal(eKeyDown);
     if (status != nsEventStatus_eConsumeNoDefault) {
         DispatchKeyEventInternal(eKeyPress);
     }
 }
 
 void
 KeyEventDispatcher::DispatchKeyUpEvent()
 {
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -978,19 +978,18 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboa
          "isAlt=%s, isMeta=%s }",
          keymapWrapper, modifierState,
          ((aGdkKeyEvent->type == GDK_KEY_PRESS) ?
                "GDK_KEY_PRESS" : "GDK_KEY_RELEASE"),
          gdk_keyval_name(aGdkKeyEvent->keyval),
          aGdkKeyEvent->keyval, aGdkKeyEvent->state,
          aGdkKeyEvent->hardware_keycode,
          GetBoolName(aGdkKeyEvent->is_modifier),
-         ((aKeyEvent.mMessage == NS_KEY_DOWN) ? "NS_KEY_DOWN" :
-               (aKeyEvent.mMessage == eKeyPress) ? "eKeyPress" :
-                                                   "eKeyUp"),
+         ((aKeyEvent.mMessage == eKeyDown) ? "eKeyDown" :
+              (aKeyEvent.mMessage == eKeyPress) ? "eKeyPress" : "eKeyUp"),
          GetBoolName(aKeyEvent.IsShift()), GetBoolName(aKeyEvent.IsControl()),
          GetBoolName(aKeyEvent.IsAlt()), GetBoolName(aKeyEvent.IsMeta())));
 
     if (aKeyEvent.mMessage == eKeyPress) {
         keymapWrapper->InitKeypressEvent(aKeyEvent, aGdkKeyEvent);
     }
 
     // The transformations above and in gdk for the keyval are not invertible
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2920,17 +2920,17 @@ nsWindow::DispatchKeyDownEvent(GdkEventK
 
     *aCancelled = false;
 
     if (IsCtrlAltTab(aEvent)) {
         return false;
     }
 
     // send the key down event
-    WidgetKeyboardEvent downEvent(true, NS_KEY_DOWN, this);
+    WidgetKeyboardEvent downEvent(true, eKeyDown, this);
     KeymapWrapper::InitKeyEvent(downEvent, aEvent);
     nsEventStatus status = DispatchInputEvent(&downEvent);
     *aCancelled = (status == nsEventStatus_eConsumeNoDefault);
     return true;
 }
 
 TimeStamp
 nsWindow::GetEventTimeStamp(guint32 aEventTime)
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -2639,17 +2639,17 @@ case _value: eventName.AssignLiteral(_na
     _ASSIGN_eventName(NS_EDITOR_INPUT,"NS_EDITOR_INPUT");
     _ASSIGN_eventName(NS_FOCUS_CONTENT,"NS_FOCUS_CONTENT");
     _ASSIGN_eventName(NS_FORM_SELECTED,"NS_FORM_SELECTED");
     _ASSIGN_eventName(NS_FORM_CHANGE,"NS_FORM_CHANGE");
     _ASSIGN_eventName(NS_FORM_RESET,"NS_FORM_RESET");
     _ASSIGN_eventName(NS_FORM_SUBMIT,"NS_FORM_SUBMIT");
     _ASSIGN_eventName(NS_IMAGE_ABORT,"NS_IMAGE_ABORT");
     _ASSIGN_eventName(NS_LOAD_ERROR,"NS_LOAD_ERROR");
-    _ASSIGN_eventName(NS_KEY_DOWN,"NS_KEY_DOWN");
+    _ASSIGN_eventName(eKeyDown,"eKeyDown");
     _ASSIGN_eventName(eKeyPress,"eKeyPress");
     _ASSIGN_eventName(eKeyUp,"eKeyUp");
     _ASSIGN_eventName(NS_MOUSE_ENTER_WIDGET,"NS_MOUSE_ENTER_WIDGET");
     _ASSIGN_eventName(NS_MOUSE_EXIT_WIDGET,"NS_MOUSE_EXIT_WIDGET");
     _ASSIGN_eventName(NS_MOUSE_BUTTON_DOWN,"NS_MOUSE_BUTTON_DOWN");
     _ASSIGN_eventName(NS_MOUSE_BUTTON_UP,"NS_MOUSE_BUTTON_UP");
     _ASSIGN_eventName(NS_MOUSE_CLICK,"NS_MOUSE_CLICK");
     _ASSIGN_eventName(NS_MOUSE_DOUBLECLICK,"NS_MOUSE_DBLCLICK");
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1095,17 +1095,17 @@ static void
 InitKeyEvent(WidgetKeyboardEvent& aEvent, QKeyEvent* aQEvent)
 {
     aEvent.InitBasicModifiers(aQEvent->modifiers() & Qt::ControlModifier,
                               aQEvent->modifiers() & Qt::AltModifier,
                               aQEvent->modifiers() & Qt::ShiftModifier,
                               aQEvent->modifiers() & Qt::MetaModifier);
 
     aEvent.mIsRepeat =
-        (aEvent.mMessage == NS_KEY_DOWN || aEvent.mMessage == eKeyPress) &&
+        (aEvent.mMessage == eKeyDown || aEvent.mMessage == eKeyPress) &&
         aQEvent->isAutoRepeat();
     aEvent.time = 0;
 
     if (sAltGrModifier) {
         aEvent.modifiers |= (MODIFIER_CONTROL | MODIFIER_ALT);
     }
 
     if (aQEvent->text().length() && aQEvent->text()[0].isPrint()) {
@@ -1151,17 +1151,17 @@ nsWindow::keyPressEvent(QKeyEvent* aEven
     //:TODO: fix shortcuts hebrew for non X11,
     //see Bug 562195##51
 
     uint32_t domKeyCode = QtKeyCodeToDOMKeyCode(aEvent->key());
 
     if (!aEvent->isAutoRepeat() && !IsKeyDown(domKeyCode)) {
         SetKeyDownFlag(domKeyCode);
 
-        WidgetKeyboardEvent downEvent(true, NS_KEY_DOWN, this);
+        WidgetKeyboardEvent downEvent(true, eKeyDown, this);
         InitKeyEvent(downEvent, aEvent);
 
         nsEventStatus status = DispatchEvent(&downEvent);
 
         // DispatchEvent can Destroy us (bug 378273)
         if (MOZ_UNLIKELY(mIsDestroyed)) {
             qWarning() << "Returning[" << __LINE__ << "]: " << "Window destroyed";
             return status;
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1139,17 +1139,17 @@ NativeKey::InitKeyEvent(WidgetKeyboardEv
 void
 NativeKey::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
                         const ModifierKeyState& aModKeyState) const
 {
   nsIntPoint point(0, 0);
   mWidget->InitEvent(aKeyEvent, &point);
 
   switch (aKeyEvent.mMessage) {
-    case NS_KEY_DOWN:
+    case eKeyDown:
       aKeyEvent.keyCode = mDOMKeyCode;
       // Unique id for this keydown event and its associated keypress.
       sUniqueKeyEventId++;
       aKeyEvent.mUniqueId = sUniqueKeyEventId;
       break;
     case eKeyUp:
       aKeyEvent.keyCode = mDOMKeyCode;
       // Set defaultPrevented of the key event if the VK_MENU is not a system
@@ -1303,17 +1303,17 @@ NativeKey::HandleAppCommandMessage() con
     // plug-in process synchronously.
     dispatchKeyEvent =
       WinUtils::IsOurProcessWindow(reinterpret_cast<HWND>(mMsg.wParam));
   }
 
   bool consumed = false;
 
   if (dispatchKeyEvent) {
-    WidgetKeyboardEvent keydownEvent(true, NS_KEY_DOWN, mWidget);
+    WidgetKeyboardEvent keydownEvent(true, eKeyDown, mWidget);
     InitKeyEvent(keydownEvent, mModKeyState);
     // NOTE: If the keydown event is consumed by web contents, we shouldn't
     //       continue to handle the command.
     consumed = DispatchKeyEvent(keydownEvent, &mMsg);
     sDispatchedKeyOfAppCommand = mVirtualKeyCode;
     if (mWidget->Destroyed()) {
       return true;
     }
@@ -1420,17 +1420,17 @@ NativeKey::HandleKeyDownMessage(bool* aE
       !RedirectedKeyDownMessageManager::IsRedirectedMessage(mMsg)) {
     // Ignore [shift+]alt+space so the OS can handle it.
     if (mModKeyState.IsAlt() && !mModKeyState.IsControl() &&
         mVirtualKeyCode == VK_SPACE) {
       return false;
     }
 
     bool isIMEEnabled = WinUtils::IsIMEEnabled(mWidget->GetInputContext());
-    WidgetKeyboardEvent keydownEvent(true, NS_KEY_DOWN, mWidget);
+    WidgetKeyboardEvent keydownEvent(true, eKeyDown, mWidget);
     InitKeyEvent(keydownEvent, mModKeyState);
     if (aEventDispatched) {
       *aEventDispatched = true;
     }
     defaultPrevented = DispatchKeyEvent(keydownEvent, &mMsg);
 
     if (mWidget->Destroyed()) {
       return true;
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -638,17 +638,17 @@ public:
 };
 
 class RedirectedKeyDownMessageManager
 {
 public:
   /*
    * If a window receives WM_KEYDOWN message or WM_SYSKEYDOWM message which is
    * a redirected message, NativeKey::DispatchKeyDownAndKeyPressEvent()
-   * prevents to dispatch NS_KEY_DOWN event because it has been dispatched
+   * prevents to dispatch eKeyDown event because it has been dispatched
    * before the message was redirected.  However, in some cases, WM_*KEYDOWN
    * message handler may not handle actually.  Then, the message handler needs
    * to forget the redirected message and remove WM_CHAR message or WM_SYSCHAR
    * message for the redirected keydown message.  AutoFlusher class is a helper
    * class for doing it.  This must be created in the stack.
    */
   class MOZ_STACK_CLASS AutoFlusher final
   {