Bug 282097 - Part 1: Add mNativeKeyEvent to nsKeyEvent. r=masayuki
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 09 Jul 2013 22:42:59 -0500
changeset 150437 96749d7745711cedbe23dfae6f2670db9afa1256
parent 150436 d19b8311599b9599fc61e8f8c0646d11bc461fc0
child 150438 431ec2a50165482afe1cfc605ddf53844e62b4b7
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs282097
milestone25.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 282097 - Part 1: Add mNativeKeyEvent to nsKeyEvent. r=masayuki
widget/nsGUIEvent.h
widget/nsGUIEventIPC.h
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -1071,33 +1071,36 @@ public:
   nsKeyEvent()
   {
   }
 
   nsKeyEvent(bool isTrusted, uint32_t msg, nsIWidget *w)
     : nsInputEvent(isTrusted, msg, w, NS_KEY_EVENT),
       keyCode(0), charCode(0),
       location(nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD), isChar(0),
-      mKeyNameIndex(mozilla::widget::KEY_NAME_INDEX_Unidentified)
+      mKeyNameIndex(mozilla::widget::KEY_NAME_INDEX_Unidentified),
+      mNativeKeyEvent(nullptr)
   {
   }
 
   /// see NS_VK codes
   uint32_t        keyCode;   
   /// OS translated Unicode char
   uint32_t        charCode;
   // One of nsIDOMKeyEvent::DOM_KEY_LOCATION_*
   uint32_t        location;
   // OS translated Unicode chars which are used for accesskey and accelkey
   // handling. The handlers will try from first character to last character.
   nsTArray<nsAlternativeCharCode> alternativeCharCodes;
   // indicates whether the event signifies a printable character
   bool            isChar;
   // DOM KeyboardEvent.key
   mozilla::widget::KeyNameIndex mKeyNameIndex;
+  // OS-specific native event can optionally be preserved
+  void*           mNativeKeyEvent;
 
   void GetDOMKeyName(nsAString& aKeyName)
   {
     GetDOMKeyName(mKeyNameIndex, aKeyName);
   }
 
   static void GetDOMKeyName(mozilla::widget::KeyNameIndex aKeyNameIndex,
                             nsAString& aKeyName)
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -253,16 +253,18 @@ struct ParamTraits<nsKeyEvent>
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<nsInputEvent>(aParam));
     WriteParam(aMsg, static_cast<uint32_t>(aParam.mKeyNameIndex));
     WriteParam(aMsg, aParam.keyCode);
     WriteParam(aMsg, aParam.charCode);
     WriteParam(aMsg, aParam.isChar);
     WriteParam(aMsg, aParam.location);
+    // An OS-specific native event might be attached in |mNativeKeyEvent|,  but
+    // that cannot be copied across process boundaries.
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     uint32_t keyNameIndex = 0;
     if (ReadParam(aMsg, aIter, static_cast<nsInputEvent*>(aResult)) &&
         ReadParam(aMsg, aIter, &keyNameIndex) &&
         ReadParam(aMsg, aIter, &aResult->keyCode) &&