Bug 1299197 Part2: Serialize WidgetPointerHelper in IPC messag. r=smaug
authorStone Shih <sshih@mozilla.com>
Sun, 20 Nov 2016 09:49:00 +0800
changeset 324784 eece9df96e36917aa96a82d75e85379aac4cb932
parent 324783 fd2c8004db8a4471ff9d5c8c81839f1e6fe9710c
child 324785 84ea3d3b32484f098a868e9dc091e8c457d35615
push id31017
push userkwierso@gmail.com
push dateThu, 01 Dec 2016 00:12:25 +0000
treeherdermozilla-central@27449c736a04 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1299197
milestone53.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 1299197 Part2: Serialize WidgetPointerHelper in IPC messag. r=smaug
widget/nsGUIEventIPC.h
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -214,46 +214,71 @@ struct ParamTraits<mozilla::WidgetWheelE
       ReadParam(aMsg, aIter, &aResult->mAllowToOverrideSystemScrollSpeed);
     aResult->mScrollType =
       static_cast<mozilla::WidgetWheelEvent::ScrollType>(scrollType);
     return rv;
   }
 };
 
 template<>
+struct ParamTraits<mozilla::WidgetPointerHelper>
+{
+  typedef mozilla::WidgetPointerHelper paramType;
+
+  static void Write(Message* aMsg, const paramType& aParam)
+  {
+    WriteParam(aMsg, aParam.pointerId);
+    WriteParam(aMsg, aParam.tiltX);
+    WriteParam(aMsg, aParam.tiltY);
+    // We don't serialize convertToPointer and retargetedByPointerCapture since
+    // they are temporarily variable and should be reset to default.
+  }
+
+  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
+  {
+    bool rv;
+    rv = ReadParam(aMsg, aIter, &aResult->pointerId) &&
+         ReadParam(aMsg, aIter, &aResult->tiltX) &&
+         ReadParam(aMsg, aIter, &aResult->tiltY);
+    return rv;
+  }
+};
+
+template<>
 struct ParamTraits<mozilla::WidgetMouseEvent>
 {
   typedef mozilla::WidgetMouseEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
+    WriteParam(aMsg, static_cast<mozilla::WidgetPointerHelper>(aParam));
     WriteParam(aMsg, aParam.mIgnoreRootScrollFrame);
     WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.mReason));
     WriteParam(aMsg, static_cast<paramType::ContextMenuTriggerType>(
                        aParam.mContextMenuTrigger));
     WriteParam(aMsg, static_cast<paramType::ExitFromType>(aParam.mExitFrom));
     WriteParam(aMsg, aParam.mClickCount);
-    WriteParam(aMsg, aParam.pointerId);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
   {
     bool rv;
     paramType::ReasonType reason = 0;
     paramType::ContextMenuTriggerType contextMenuTrigger = 0;
     paramType::ExitFromType exitFrom = 0;
     rv = ReadParam(aMsg, aIter,
                    static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
+         ReadParam(aMsg, aIter,
+                   static_cast<mozilla::WidgetPointerHelper*>(aResult)) &&
          ReadParam(aMsg, aIter, &aResult->mIgnoreRootScrollFrame) &&
          ReadParam(aMsg, aIter, &reason) &&
          ReadParam(aMsg, aIter, &contextMenuTrigger) &&
          ReadParam(aMsg, aIter, &exitFrom) &&
-         ReadParam(aMsg, aIter, &aResult->mClickCount) &&
-         ReadParam(aMsg, aIter, &aResult->pointerId);
+         ReadParam(aMsg, aIter, &aResult->mClickCount);
     aResult->mReason = static_cast<paramType::Reason>(reason);
     aResult->mContextMenuTrigger =
       static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
     aResult->mExitFrom = static_cast<paramType::ExitFrom>(exitFrom);
     return rv;
   }
 };
 
@@ -285,29 +310,25 @@ struct ParamTraits<mozilla::WidgetPointe
 {
   typedef mozilla::WidgetPointerEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam));
     WriteParam(aMsg, aParam.mWidth);
     WriteParam(aMsg, aParam.mHeight);
-    WriteParam(aMsg, aParam.tiltX);
-    WriteParam(aMsg, aParam.tiltY);
     WriteParam(aMsg, aParam.mIsPrimary);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
   {
     bool rv =
       ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) &&
       ReadParam(aMsg, aIter, &aResult->mWidth) &&
       ReadParam(aMsg, aIter, &aResult->mHeight) &&
-      ReadParam(aMsg, aIter, &aResult->tiltX) &&
-      ReadParam(aMsg, aIter, &aResult->tiltY) &&
       ReadParam(aMsg, aIter, &aResult->mIsPrimary);
     return rv;
   }
 };
 
 template<>
 struct ParamTraits<mozilla::WidgetTouchEvent>
 {