From e43cde864f88cf264dae56ee6201a84091fec5b4 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 20 Apr 2018 20:30:07 +0200 Subject: Bug 1299197 Part2: Serialize WidgetPointerHelper in IPC message native in moebius --- widget/nsGUIEventIPC.h | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'widget') diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h index 7a9d870d9a..e06e3784a0 100644 --- a/widget/nsGUIEventIPC.h +++ b/widget/nsGUIEventIPC.h @@ -218,6 +218,30 @@ struct ParamTraits } }; +template<> +struct ParamTraits +{ + 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 { @@ -226,13 +250,13 @@ struct ParamTraits static void Write(Message* aMsg, const paramType& aParam) { WriteParam(aMsg, static_cast(aParam)); + WriteParam(aMsg, static_cast(aParam)); WriteParam(aMsg, aParam.mIgnoreRootScrollFrame); WriteParam(aMsg, static_cast(aParam.mReason)); WriteParam(aMsg, static_cast( aParam.mContextMenuTrigger)); WriteParam(aMsg, static_cast(aParam.mExitFrom)); WriteParam(aMsg, aParam.mClickCount); - WriteParam(aMsg, aParam.pointerId); } static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) @@ -243,12 +267,13 @@ struct ParamTraits paramType::ExitFromType exitFrom = 0; rv = ReadParam(aMsg, aIter, static_cast(aResult)) && + ReadParam(aMsg, aIter, + static_cast(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(reason); aResult->mContextMenuTrigger = static_cast(contextMenuTrigger); @@ -290,8 +315,6 @@ struct ParamTraits WriteParam(aMsg, static_cast(aParam)); WriteParam(aMsg, aParam.mWidth); WriteParam(aMsg, aParam.mHeight); - WriteParam(aMsg, aParam.tiltX); - WriteParam(aMsg, aParam.tiltY); WriteParam(aMsg, aParam.mIsPrimary); } @@ -301,8 +324,6 @@ struct ParamTraits ReadParam(aMsg, aIter, static_cast(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; } -- cgit v1.2.3