Bug 1436508 part 12. Remove nsIDOMKeyEvent. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 09 Feb 2018 11:17:10 -0500
changeset 403184 f91374248200
parent 403183 5ae4bf25badf
child 403185 2fcaebaeee9f
push id33416
push userarchaeopteryx@coole-files.de
push date2018-02-09 22:32 +0000
treeherdermozilla-central@c2cddb0cbb20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1436508
milestone60.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 1436508 part 12. Remove nsIDOMKeyEvent. r=masayuki MozReview-Commit-ID: 8giqG5iHiIf
dom/base/TextInputProcessor.cpp
dom/base/TextInputProcessor.h
dom/base/nsContentUtils.h
dom/events/EventStateManager.cpp
dom/events/JSEventHandler.h
dom/events/KeyboardEvent.cpp
dom/events/KeyboardEvent.h
dom/html/ImageDocument.cpp
dom/interfaces/base/nsITextInputProcessor.idl
dom/interfaces/events/moz.build
dom/interfaces/events/nsIDOMKeyEvent.idl
dom/smil/nsSMILTimeValueSpec.cpp
dom/xbl/nsXBLPrototypeHandler.cpp
editor/libeditor/EditorEventListener.h
editor/libeditor/HTMLEditor.cpp
editor/libeditor/TextEditor.cpp
layout/printing/nsPrintPreviewListener.cpp
toolkit/components/resistfingerprinting/KeyCodeConsensus_En_US.h
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/dom/base/TextInputProcessor.cpp
+++ b/dom/base/TextInputProcessor.cpp
@@ -6,16 +6,17 @@
 
 #include "gfxPrefs.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/TextEventDispatcher.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TextInputProcessor.h"
 #include "mozilla/widget/IMEData.h"
+#include "mozilla/dom/KeyboardEvent.h"
 #include "nsContentUtils.h"
 #include "nsIDocShell.h"
 #include "nsIWidget.h"
 #include "nsPIDOMWindow.h"
 #include "nsPresContext.h"
 
 using namespace mozilla::widget;
 
@@ -563,56 +564,64 @@ TextInputProcessor::MaybeDispatchKeyupFo
   }
 
   result.mCanContinue = NS_SUCCEEDED(IsValidStateForComposition());
   return result;
 }
 
 nsresult
 TextInputProcessor::PrepareKeyboardEventForComposition(
-                      nsIDOMKeyEvent* aDOMKeyEvent,
+                      KeyboardEvent* aDOMKeyEvent,
                       uint32_t& aKeyFlags,
                       uint8_t aOptionalArgc,
                       WidgetKeyboardEvent*& aKeyboardEvent)
 {
   aKeyboardEvent = nullptr;
 
   aKeyboardEvent =
     aOptionalArgc && aDOMKeyEvent ?
-      aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent() : nullptr;
+      aDOMKeyEvent->WidgetEventPtr()->AsKeyboardEvent() : nullptr;
   if (!aKeyboardEvent || aOptionalArgc < 2) {
     aKeyFlags = 0;
   }
 
   if (!aKeyboardEvent) {
     return NS_OK;
   }
 
   if (NS_WARN_IF(!IsValidEventTypeForComposition(*aKeyboardEvent))) {
     return NS_ERROR_INVALID_ARG;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::StartComposition(nsIDOMKeyEvent* aDOMKeyEvent,
+TextInputProcessor::StartComposition(nsIDOMEvent* aDOMKeyEvent,
                                      uint32_t aKeyFlags,
                                      uint8_t aOptionalArgc,
                                      bool* aSucceeded)
 {
   MOZ_RELEASE_ASSERT(aSucceeded, "aSucceeded must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
   *aSucceeded = false;
 
+  RefPtr<KeyboardEvent> keyEvent;
+  if (aDOMKeyEvent) {
+    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    if (NS_WARN_IF(!keyEvent)) {
+      return NS_ERROR_INVALID_ARG;
+    }
+  }
+
   RefPtr<TextEventDispatcher> kungFuDeathGrip(mDispatcher);
 
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
-    PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
+    PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
                                        keyboardEvent);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   EventDispatcherResult dispatcherResult =
     MaybeDispatchKeydownForComposition(keyboardEvent, aKeyFlags);
   if (NS_WARN_IF(NS_FAILED(dispatcherResult.mResult)) ||
@@ -679,35 +688,43 @@ TextInputProcessor::SetCaretInPendingCom
   nsresult rv = IsValidStateForComposition();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return kungFuDeathGrip->SetCaretInPendingComposition(aOffset, 0);
 }
 
 NS_IMETHODIMP
-TextInputProcessor::FlushPendingComposition(nsIDOMKeyEvent* aDOMKeyEvent,
+TextInputProcessor::FlushPendingComposition(nsIDOMEvent* aDOMKeyEvent,
                                             uint32_t aKeyFlags,
                                             uint8_t aOptionalArgc,
                                             bool* aSucceeded)
 {
   MOZ_RELEASE_ASSERT(aSucceeded, "aSucceeded must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
   // Even if this doesn't flush pending composition actually, we need to reset
   // pending composition for starting next composition with new user input.
   AutoPendingCompositionResetter resetter(this);
 
   *aSucceeded = false;
   RefPtr<TextEventDispatcher> kungFuDeathGrip(mDispatcher);
   bool wasComposing = IsComposing();
 
+  RefPtr<KeyboardEvent> keyEvent;
+  if (aDOMKeyEvent) {
+    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    if (NS_WARN_IF(!keyEvent)) {
+      return NS_ERROR_INVALID_ARG;
+    }
+  }
+
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
-    PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
+    PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
                                        keyboardEvent);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   EventDispatcherResult dispatcherResult =
     MaybeDispatchKeydownForComposition(keyboardEvent, aKeyFlags);
   if (NS_WARN_IF(NS_FAILED(dispatcherResult.mResult)) ||
@@ -731,46 +748,62 @@ TextInputProcessor::FlushPendingComposit
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::CommitComposition(nsIDOMKeyEvent* aDOMKeyEvent,
+TextInputProcessor::CommitComposition(nsIDOMEvent* aDOMKeyEvent,
                                       uint32_t aKeyFlags,
                                       uint8_t aOptionalArgc)
 {
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
+  RefPtr<KeyboardEvent> keyEvent;
+  if (aDOMKeyEvent) {
+    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    if (NS_WARN_IF(!keyEvent)) {
+      return NS_ERROR_INVALID_ARG;
+    }
+  }
+
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
-    PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
+    PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
                                        keyboardEvent);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return CommitCompositionInternal(keyboardEvent, aKeyFlags);
 }
 
 NS_IMETHODIMP
 TextInputProcessor::CommitCompositionWith(const nsAString& aCommitString,
-                                          nsIDOMKeyEvent* aDOMKeyEvent,
+                                          nsIDOMEvent* aDOMKeyEvent,
                                           uint32_t aKeyFlags,
                                           uint8_t aOptionalArgc,
                                           bool* aSucceeded)
 {
   MOZ_RELEASE_ASSERT(aSucceeded, "aSucceeded must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
+  RefPtr<KeyboardEvent> keyEvent;
+  if (aDOMKeyEvent) {
+    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    if (NS_WARN_IF(!keyEvent)) {
+      return NS_ERROR_INVALID_ARG;
+    }
+  }
+
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
-    PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
+    PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
                                        keyboardEvent);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return CommitCompositionInternal(keyboardEvent, aKeyFlags,
                                    &aCommitString, aSucceeded);
 }
@@ -814,25 +847,33 @@ TextInputProcessor::CommitCompositionInt
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::CancelComposition(nsIDOMKeyEvent* aDOMKeyEvent,
+TextInputProcessor::CancelComposition(nsIDOMEvent* aDOMKeyEvent,
                                       uint32_t aKeyFlags,
                                       uint8_t aOptionalArgc)
 {
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
+  RefPtr<KeyboardEvent> keyEvent;
+  if (aDOMKeyEvent) {
+    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    if (NS_WARN_IF(!keyEvent)) {
+      return NS_ERROR_INVALID_ARG;
+    }
+  }
+
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
-    PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
+    PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
                                        keyboardEvent);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return CancelCompositionInternal(keyboardEvent, aKeyFlags);
 }
 
@@ -1022,31 +1063,31 @@ TextInputProcessor::PrepareKeyboardEvent
   }
 
   aKeyboardEvent.mIsSynthesizedByTIP = (mForTests)? false : true;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent,
+TextInputProcessor::Keydown(nsIDOMEvent* aDOMKeyEvent,
                             uint32_t aKeyFlags,
                             uint8_t aOptionalArgc,
                             uint32_t* aConsumedFlags)
 {
   MOZ_RELEASE_ASSERT(aConsumedFlags, "aConsumedFlags must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
   if (!aOptionalArgc) {
     aKeyFlags = 0;
   }
   if (NS_WARN_IF(!aDOMKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   WidgetKeyboardEvent* originalKeyEvent =
-    aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
+    aDOMKeyEvent->InternalDOMEvent()->WidgetEventPtr()->AsKeyboardEvent();
   if (NS_WARN_IF(!originalKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   return KeydownInternal(*originalKeyEvent, aKeyFlags, true, *aConsumedFlags);
 }
 
 nsresult
 TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
@@ -1109,31 +1150,31 @@ TextInputProcessor::KeydownInternal(cons
       (status == nsEventStatus_eConsumeNoDefault) ? KEYPRESS_IS_CONSUMED :
                                                     KEYEVENT_NOT_CONSUMED;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::Keyup(nsIDOMKeyEvent* aDOMKeyEvent,
+TextInputProcessor::Keyup(nsIDOMEvent* aDOMKeyEvent,
                           uint32_t aKeyFlags,
                           uint8_t aOptionalArgc,
                           bool* aDoDefault)
 {
   MOZ_RELEASE_ASSERT(aDoDefault, "aDoDefault must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
   if (!aOptionalArgc) {
     aKeyFlags = 0;
   }
   if (NS_WARN_IF(!aDOMKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   WidgetKeyboardEvent* originalKeyEvent =
-    aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
+    aDOMKeyEvent->InternalDOMEvent()->WidgetEventPtr()->AsKeyboardEvent();
   if (NS_WARN_IF(!originalKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   return KeyupInternal(*originalKeyEvent, aKeyFlags, *aDoDefault);
 }
 
 nsresult
 TextInputProcessor::KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent,
--- a/dom/base/TextInputProcessor.h
+++ b/dom/base/TextInputProcessor.h
@@ -12,16 +12,20 @@
 #include "mozilla/TextEventDispatcher.h"
 #include "mozilla/TextEventDispatcherListener.h"
 #include "nsITextInputProcessor.h"
 #include "nsITextInputProcessorCallback.h"
 #include "nsTArray.h"
 
 namespace mozilla {
 
+namespace dom {
+class KeyboardEvent;
+} // namespace dom
+
 class TextInputProcessor final : public nsITextInputProcessor
                                , public widget::TextEventDispatcherListener
 {
   typedef mozilla::widget::IMENotification IMENotification;
   typedef mozilla::widget::IMENotificationRequests IMENotificationRequests;
   typedef mozilla::widget::TextEventDispatcher TextEventDispatcher;
 
 public:
@@ -72,17 +76,17 @@ private:
                          bool& aDoDefault);
   nsresult IsValidStateForComposition();
   void UnlinkFromTextEventDispatcher();
   nsresult PrepareKeyboardEventToDispatch(WidgetKeyboardEvent& aKeyboardEvent,
                                           uint32_t aKeyFlags);
   bool IsValidEventTypeForComposition(
          const WidgetKeyboardEvent& aKeyboardEvent) const;
   nsresult PrepareKeyboardEventForComposition(
-             nsIDOMKeyEvent* aDOMKeyEvent,
+             dom::KeyboardEvent* aDOMKeyEvent,
              uint32_t& aKeyFlags,
              uint8_t aOptionalArgc,
              WidgetKeyboardEvent*& aKeyboardEvent);
 
   struct EventDispatcherResult
   {
     nsresult mResult;
     bool     mDoDefault;
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -69,17 +69,16 @@ class nsIContent;
 class nsIContentPolicy;
 class nsIContentSecurityPolicy;
 class nsIDocShellTreeItem;
 class nsIDocumentLoaderFactory;
 class nsIDOMDocument;
 class nsIDOMDocumentFragment;
 class nsIDOMEvent;
 class nsIDOMHTMLInputElement;
-class nsIDOMKeyEvent;
 class nsIDOMNode;
 class nsIDragSession;
 class nsIEventTarget;
 class nsIFragmentContentSink;
 class nsIFrame;
 class nsIImageLoadingContent;
 class nsIInterfaceRequestor;
 class nsIIOService;
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -51,17 +51,16 @@
 #include "nsIWebNavigation.h"
 #include "nsIContentViewer.h"
 #include "nsFrameManager.h"
 #include "nsITabChild.h"
 #include "nsPluginFrame.h"
 #include "nsMenuPopupFrame.h"
 
 #include "nsIDOMXULElement.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIObserverService.h"
 #include "nsIDocShell.h"
 #include "nsIDOMWheelEvent.h"
 #include "nsIDOMUIEvent.h"
 #include "nsIMozBrowserFrame.h"
 
 #include "nsSubDocumentFrame.h"
 #include "nsLayoutUtils.h"
--- a/dom/events/JSEventHandler.h
+++ b/dom/events/JSEventHandler.h
@@ -8,17 +8,16 @@
 #define mozilla_JSEventHandler_h_
 
 #include "mozilla/Attributes.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/EventHandlerBinding.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsAtom.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsIScriptContext.h"
 
 namespace mozilla {
 
 class TypedEventHandler
 {
 public:
--- a/dom/events/KeyboardEvent.cpp
+++ b/dom/events/KeyboardEvent.cpp
@@ -30,17 +30,16 @@ KeyboardEvent::KeyboardEvent(EventTarget
     mEvent->AsKeyboardEvent()->mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
   }
 }
 
 NS_IMPL_ADDREF_INHERITED(KeyboardEvent, UIEvent)
 NS_IMPL_RELEASE_INHERITED(KeyboardEvent, UIEvent)
 
 NS_INTERFACE_MAP_BEGIN(KeyboardEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
 NS_INTERFACE_MAP_END_INHERITING(UIEvent)
 
 bool
 KeyboardEvent::AltKey(CallerType aCallerType)
 {
   bool altState = mEvent->AsKeyboardEvent()->IsAlt();
 
   if (!ShouldResistFingerprinting(aCallerType)) {
--- a/dom/events/KeyboardEvent.h
+++ b/dom/events/KeyboardEvent.h
@@ -5,38 +5,30 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_KeyboardEvent_h_
 #define mozilla_dom_KeyboardEvent_h_
 
 #include "mozilla/dom/UIEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include "mozilla/EventForwards.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsRFPService.h"
 
 namespace mozilla {
 namespace dom {
 
-class KeyboardEvent : public UIEvent,
-                      public nsIDOMKeyEvent
+class KeyboardEvent : public UIEvent
 {
 public:
   KeyboardEvent(EventTarget* aOwner,
                 nsPresContext* aPresContext,
                 WidgetKeyboardEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
-  // nsIDOMKeyEvent Interface
-  NS_DECL_NSIDOMKEYEVENT
-
-  // Forward to base class
-  NS_FORWARD_TO_UIEVENT
-
   virtual KeyboardEvent* AsKeyboardEvent() override
   {
     return this;
   }
 
   static already_AddRefed<KeyboardEvent> Constructor(
                                            const GlobalObject& aGlobal,
                                            const nsAString& aType,
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -10,17 +10,16 @@
 #include "mozilla/dom/HTMLImageElement.h"
 #include "nsRect.h"
 #include "nsIImageLoadingContent.h"
 #include "nsGenericHTMLElement.h"
 #include "nsDocShell.h"
 #include "nsIDocumentInlines.h"
 #include "nsDOMTokenList.h"
 #include "nsIDOMEvent.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsIFrame.h"
 #include "nsGkAtoms.h"
 #include "imgIRequest.h"
 #include "imgILoader.h"
 #include "imgIContainer.h"
 #include "imgINotificationObserver.h"
--- a/dom/interfaces/base/nsITextInputProcessor.idl
+++ b/dom/interfaces/base/nsITextInputProcessor.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-interface nsIDOMKeyEvent;
+interface nsIDOMEvent;
 interface mozIDOMWindow;
 interface nsITextInputProcessorCallback;
 
 /**
  * An nsITextInputProcessor instance is associated with a top level widget which
  * handles native IME.  It's associated by calling beginInputTransaction() or
  * beginInputTransactionForTests().  While an instance has composition, nobody
  * can steal the rights to make composition on the top level widget.  In other
@@ -306,17 +306,17 @@ interface nsITextInputProcessor : nsISup
    *                        dispatches only keydown event first.  Otherwise,
    *                        dispatches keydown first and keyup at last.
    * @param aKeyFlags       See KEY_* constants.
    * @return                Returns true if composition starts normally.
    *                        Otherwise, returns false because it might be
    *                        canceled by the web application.
    */
   [optional_argc]
-    boolean startComposition([optional] in nsIDOMKeyEvent aKeyboardEvent,
+    boolean startComposition([optional] in nsIDOMEvent aKeyboardEvent,
                              [optional] in unsigned long aKeyFlags);
 
   /**
    * Set new composition string.  Pending composition will be flushed by
    * a call of flushPendingComposition().  However, if the new composition
    * string isn't empty, you need to call appendClauseToPendingComposition() to
    * fill all characters of aString with one or more clauses before flushing.
    * Note that if you need to commit or cancel composition, use
@@ -397,31 +397,31 @@ interface nsITextInputProcessor : nsISup
    * @return                Returns true if there is a composition already or
    *                        starting composition automatically.
    *                        Otherwise, i.e., if it cannot start composition
    *                        automatically, e.g., canceled by web apps, returns
    *                        false.
    */
   [optional_argc]
     boolean flushPendingComposition(
-      [optional] in nsIDOMKeyEvent aKeyboardEvent,
+      [optional] in nsIDOMEvent aKeyboardEvent,
       [optional] in unsigned long aKeyFlags);
 
   /**
    * commitComposition() will commit composition with the last composition
    * string.  If there is no composition, this will throw an exception.
    *
    * @param aKeyboardEvent  Key event which causes the commit composition.
    *                        If its type value is "keydown", this method
    *                        dispatches only keydown event first.  Otherwise,
    *                        dispatches keydown first and keyup at last.
    * @param aKeyFlags       See KEY_* constants.
    */
   [optional_argc]
-    void commitComposition([optional] in nsIDOMKeyEvent aKeyboardEvent,
+    void commitComposition([optional] in nsIDOMEvent aKeyboardEvent,
                            [optional] in unsigned long aKeyFlags);
 
   /**
    * commitCompositionWith() will commit composition with the specific string.
    * If there is no composition, this will start composition and commit it
    * with the specified string.
    *
    * @param aCommitString   The string to be committed.
@@ -433,17 +433,17 @@ interface nsITextInputProcessor : nsISup
    * @return                Returns true if there is a composition already or
    *                        starting composition automatically.
    *                        Otherwise, i.e., if it cannot start composition
    *                        automatically, e.g., canceled by web apps, returns
    *                        false.
    */
   [optional_argc]
     boolean commitCompositionWith(in DOMString aCommitString,
-                                  [optional] in nsIDOMKeyEvent aKeyboardEvent,
+                                  [optional] in nsIDOMEvent aKeyboardEvent,
                                   [optional] in unsigned long aKeyFlags);
 
   /**
    * cancelComposition() will cancel composition.  This is for now the same as
    * calling commitComposition("").  However, in the future, this might work
    * better.  If your IME needs to cancel composition, use this instead of
    * commitComposition().
    *
@@ -452,17 +452,17 @@ interface nsITextInputProcessor : nsISup
    *
    * @param aKeyboardEvent  Key event which causes the canceling composition.
    *                        If its type value is "keydown", this method
    *                        dispatches only keydown event first.  Otherwise,
    *                        dispatches keydown first and keyup at last.
    * @param aKeyFlags       See KEY_* constants.
    */
   [optional_argc]
-    void cancelComposition([optional] in nsIDOMKeyEvent aKeyboardEvent,
+    void cancelComposition([optional] in nsIDOMEvent aKeyboardEvent,
                            [optional] in unsigned long aKeyFlags);
 
   // Specifying KEY_DEFAULT_PREVENTED can dispatch key events whose
   // defaultPrevented are true.  Note that if this is specified, keypress event
   // won't be fired.
   const unsigned long KEY_DEFAULT_PREVENTED                        = 0x00000001;
   // If KEY_NON_PRINTABLE_KEY is specified and the .key value isn't valid
   // key name, the methods will throws an exception.  In other words, this
@@ -542,24 +542,24 @@ interface nsITextInputProcessor : nsISup
    *                        this case.
    *                        KEYPRESS_IS_CONSUMED, if the keypress event(s) is
    *                        consumed when dispatched.
    *                        Note that keypress event is always consumed by
    *                        native code for the printable keys (indicating the
    *                        default action has been taken).
    */
   [optional_argc]
-    unsigned long keydown(in nsIDOMKeyEvent aKeyboardEvent,
+    unsigned long keydown(in nsIDOMEvent aKeyboardEvent,
                           [optional] in unsigned long aKeyFlags);
 
   /**
    * Similar to keydown(), but this dispatches only a keyup event.
    */
   [optional_argc]
-    boolean keyup(in nsIDOMKeyEvent aKeyboardEvent,
+    boolean keyup(in nsIDOMEvent aKeyboardEvent,
                   [optional] in unsigned long aKeyFlags);
 
   /**
    * getModifierState() returns modifier state managed by this instance.
    *
    * @param aModifier       One of modifier key names.  This doesn't support
    *                        virtual modifiers like "Accel".
    * @return                true if the modifier key is active.  Otherwise,
--- a/dom/interfaces/events/moz.build
+++ b/dom/interfaces/events/moz.build
@@ -11,17 +11,16 @@ XPIDL_SOURCES += [
     'nsIDOMClipboardEvent.idl',
     'nsIDOMCustomEvent.idl',
     'nsIDOMDataTransfer.idl',
     'nsIDOMDragEvent.idl',
     'nsIDOMEvent.idl',
     'nsIDOMEventListener.idl',
     'nsIDOMEventTarget.idl',
     'nsIDOMFocusEvent.idl',
-    'nsIDOMKeyEvent.idl',
     'nsIDOMMouseEvent.idl',
     'nsIDOMMouseScrollEvent.idl',
     'nsIDOMMutationEvent.idl',
     'nsIDOMNotifyPaintEvent.idl',
     'nsIDOMNSEvent.idl',
     'nsIDOMPaintRequest.idl',
     'nsIDOMScrollAreaEvent.idl',
     'nsIDOMSimpleGestureEvent.idl',
deleted file mode 100644
--- a/dom/interfaces/events/nsIDOMKeyEvent.idl
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIDOMUIEvent.idl"
-
-[builtinclass, uuid(2e52eb99-670d-469a-b51f-8efee2dd091d)]
-interface nsIDOMKeyEvent : nsIDOMUIEvent
-{
-};
--- a/dom/smil/nsSMILTimeValueSpec.cpp
+++ b/dom/smil/nsSMILTimeValueSpec.cpp
@@ -9,17 +9,16 @@
 #include "mozilla/dom/TimeEvent.h"
 #include "nsSMILTimeValueSpec.h"
 #include "nsSMILInterval.h"
 #include "nsSMILTimeContainer.h"
 #include "nsSMILTimeValue.h"
 #include "nsSMILTimedElement.h"
 #include "nsSMILInstanceTime.h"
 #include "nsSMILParserUtils.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsString.h"
 #include <limits>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // Nested class: EventListener
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -725,18 +725,17 @@ nsXBLPrototypeHandler::KeyEventMatched(
     }
     else
       code = aKeyEvent->KeyCode();
 
     if (code != uint32_t(mDetail))
       return false;
   }
 
-  return ModifiersMatchMask(static_cast<nsIDOMKeyEvent*>(aKeyEvent),
-                            aIgnoreModifierState);
+  return ModifiersMatchMask(aKeyEvent, aIgnoreModifierState);
 }
 
 bool
 nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
 {
   if (mDetail == -1 && mMisc == 0 && (mKeyMask & cAllModifiers) == 0)
     return true; // No filters set up. It's generic.
 
--- a/editor/libeditor/EditorEventListener.h
+++ b/editor/libeditor/EditorEventListener.h
@@ -13,17 +13,16 @@
 #include "nsIDOMEventListener.h"
 #include "nsISupportsImpl.h"
 #include "nscore.h"
 
 class nsCaret;
 class nsIContent;
 class nsIDOMDragEvent;
 class nsIDOMEvent;
-class nsIDOMKeyEvent;
 class nsIDOMMouseEvent;
 class nsIPresShell;
 class nsPresContext;
 
 // X.h defines KeyPress
 #ifdef KeyPress
 #undef KeyPress
 #endif
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -930,17 +930,17 @@ HTMLEditor::UpdateBaseURL()
     doc->SetBaseURI(doc->GetDocumentURI());
   }
   return NS_OK;
 }
 
 /**
  * This routine is needed to provide a bottleneck for typing for logging
  * purposes.  Can't use HandleKeyPress() (above) for that since it takes
- * a nsIDOMKeyEvent* parameter.  So instead we pass enough info through
+ * a WidgetKeyboardEvent* parameter.  So instead we pass enough info through
  * to TypedText() to determine what action to take, but without passing
  * an event.
  */
 NS_IMETHODIMP
 HTMLEditor::TypedText(const nsAString& aString,
                       ETypingAction aAction)
 {
   MOZ_ASSERT(!aString.IsEmpty() || aAction != eTypedText);
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -384,17 +384,17 @@ TextEditor::HandleKeyPressEvent(WidgetKe
   }
   aKeyboardEvent->PreventDefault();
   nsAutoString str(aKeyboardEvent->mCharCode);
   return TypedText(str, eTypedText);
 }
 
 /* This routine is needed to provide a bottleneck for typing for logging
    purposes.  Can't use HandleKeyPress() (above) for that since it takes
-   a nsIDOMKeyEvent* parameter.  So instead we pass enough info through
+   a WidgetKeyboardEvent* parameter.  So instead we pass enough info through
    to TypedText() to determine what action to take, but without passing
    an event.
    */
 NS_IMETHODIMP
 TextEditor::TypedText(const nsAString& aString, ETypingAction aAction)
 {
   AutoPlaceholderBatch batch(this, nsGkAtoms::TypingTxnName);
 
--- a/layout/printing/nsPrintPreviewListener.cpp
+++ b/layout/printing/nsPrintPreviewListener.cpp
@@ -7,17 +7,16 @@
 #include "nsPrintPreviewListener.h"
 
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIDOMEvent.h"
 #include "nsIDocument.h"
 #include "nsIDocShell.h"
 #include "nsPresContext.h"
 #include "nsFocusManager.h"
 #include "nsLiteralString.h"
 
 using namespace mozilla;
--- a/toolkit/components/resistfingerprinting/KeyCodeConsensus_En_US.h
+++ b/toolkit/components/resistfingerprinting/KeyCodeConsensus_En_US.h
@@ -10,26 +10,26 @@
  *
  * Use CONTROL to define the control key.
  *   CONTROL(keyNameIndex, codeNameIndex, keyCode)
  *   @param keyNameIndex  The keyNameIndex of this control key.
  *                        See KeyNameList.h for details.
  *   @param codeNameIndex The codeNameIndex of this contorl key.
  *                        See PhysicalKeyCodeNameList.h for details.
  *   @param keyCode       The keyCode of this control key.
- *                        See nsIDOMKeyEvent.idl for details.
+ *                        See KeyEvent.webidl for details.
  *
  * Use KEY to define the key with its modifier states. The key will be spoofed
  * with given modifier states.
  *   KEY(keyString, codeNameIndex, keyCode, modifiers)
  *   @param keyString     The key string of this key.
  *   @param codeNameIndex The codeNameIndex of this key.
  *                        See PhysicalKeyCodeNameList.h for details.
  *   @param keyCode       The keyCode of this key.
- *                        See nsIDOMKeyEvent.idl for details.
+ *                        See KeyEvent.webidl for details.
  *   @param modifiers     The spoofing modifier states for this key.
  *                        See BasicEvents.h for details.
  */
 
 /**
  * Spoofed keycodes for English content (US English keyboard layout).
  */
 
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -33,17 +33,16 @@
 #include "nsIDOMFileList.h"
 #include "nsIDOMFocusEvent.h"
 #include "nsIDOMFormData.h"
 #include "nsIDOMGeoPositionError.h"
 #include "nsIDOMHistory.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLMediaElement.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMMouseScrollEvent.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMNotifyPaintEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMOfflineResourceList.h"
@@ -110,17 +109,16 @@
 #include "mozilla/dom/HTMLAnchorElementBinding.h"
 #include "mozilla/dom/HTMLAreaElementBinding.h"
 #include "mozilla/dom/HTMLButtonElementBinding.h"
 #include "mozilla/dom/HTMLFormElementBinding.h"
 #include "mozilla/dom/HTMLFrameSetElementBinding.h"
 #include "mozilla/dom/HTMLHtmlElementBinding.h"
 #include "mozilla/dom/HTMLInputElementBinding.h"
 #include "mozilla/dom/HTMLMediaElementBinding.h"
-#include "mozilla/dom/KeyEventBinding.h"
 #include "mozilla/dom/ListBoxObjectBinding.h"
 #include "mozilla/dom/MediaListBinding.h"
 #include "mozilla/dom/MessageEventBinding.h"
 #include "mozilla/dom/MenuBoxObjectBinding.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/dom/MouseScrollEventBinding.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "mozilla/dom/NodeListBinding.h"
@@ -240,17 +238,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(FocusEvent),
   DEFINE_SHIM(FormData),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIFrameLoader, FrameLoader),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
   DEFINE_SHIM(History),
   DEFINE_SHIM(HTMLFormElement),
   DEFINE_SHIM(HTMLInputElement),
   DEFINE_SHIM(HTMLMediaElement),
-  DEFINE_SHIM(KeyEvent),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIMenuBoxObject, MenuBoxObject),
   DEFINE_SHIM(MouseEvent),
   DEFINE_SHIM(MouseScrollEvent),
   DEFINE_SHIM(MutationEvent),
   DEFINE_SHIM(NodeList),
   DEFINE_SHIM(Node),
   DEFINE_SHIM(NotifyPaintEvent),