# Global Metrics

path: .metrics.cognitive.sum
old: 0.0
new: 69.0
path: .metrics.cognitive.average
old: 0.0
new: 0.71875
path: .metrics.halstead.difficulty
old: 3.2142857142857144
new: 128.02025316455695
path: .metrics.halstead.volume
old: 64.5293250129808
new: 74245.61289005078
path: .metrics.halstead.N2
old: 9.0
new: 3612.0
path: .metrics.halstead.N1
old: 9.0
new: 4898.0
path: .metrics.halstead.estimated_program_length
old: 31.26112492884004
new: 3541.7609308280767
path: .metrics.halstead.time
old: 11.523093752318
new: 528052.3421412217
path: .metrics.halstead.vocabulary
old: 12.0
new: 423.0
path: .metrics.halstead.level
old: 0.3111111111111111
new: 0.007811264040499922
path: .metrics.halstead.n2
old: 7.0
new: 395.0
path: .metrics.halstead.length
old: 18.0
new: 8510.0
path: .metrics.halstead.n1
old: 5.0
new: 28.0
path: .metrics.halstead.bugs
old: 0.011679918496434008
new: 14.957019648757525
path: .metrics.halstead.effort
old: 207.41568754172405
new: 9504942.158541992
path: .metrics.halstead.purity_ratio
old: 1.7367291627133357
new: 0.41618812348156015
path: .metrics.nexits.average
old: 0.0
new: 0.6770833333333334
path: .metrics.nexits.sum
old: 0.0
new: 65.0
path: .metrics.mi.mi_sei
old: 100.89476145830815
new: -168.38089014722118
path: .metrics.mi.mi_visual_studio
old: 55.221791883963334
new: 0.0
path: .metrics.mi.mi_original
old: 94.4292641215773
new: -99.13942774978048
path: .metrics.loc.lloc
old: 0.0
new: 391.0
path: .metrics.loc.cloc
old: 10.0
new: 19.0
path: .metrics.loc.sloc
old: 28.0
new: 1455.0
path: .metrics.loc.blank
old: 5.0
new: 171.0
path: .metrics.loc.ploc
old: 13.0
new: 1265.0
path: .metrics.cyclomatic.average
old: 1.0
new: 2.4578313253012047
path: .metrics.cyclomatic.sum
old: 4.0
new: 408.0
path: .metrics.nargs.average
old: 0.0
new: 2.5
path: .metrics.nargs.sum
old: 0.0
new: 240.0
path: .metrics.nom.functions
old: 1.0
new: 96.0
path: .metrics.nom.total
old: 1.0
new: 96.0

# Spaces Data

## Minimal test - lines (23, 1453)

path: .spaces[0].metrics.cyclomatic.sum
old: 3.0
new: 407.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.466666666666667
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 65.0
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 0.6770833333333334
path: .spaces[0].metrics.nargs.average
old: 0.0
new: 2.5
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 240.0
path: .spaces[0].metrics.halstead.bugs
old: 0.009388882548620756
new: 15.20413070096297
path: .spaces[0].metrics.halstead.difficulty
old: 3.0
new: 132.17322834645668
path: .spaces[0].metrics.halstead.level
old: 0.3333333333333333
new: 0.007565828666746099
path: .spaces[0].metrics.halstead.time
old: 8.304820237218406
new: 541192.498837877
path: .spaces[0].metrics.halstead.vocabulary
old: 10.0
new: 409.0
path: .spaces[0].metrics.halstead.N1
old: 9.0
new: 4898.0
path: .spaces[0].metrics.halstead.N2
old: 6.0
new: 3597.0
path: .spaces[0].metrics.halstead.volume
old: 49.82892142331043
new: 73702.25499484016
path: .spaces[0].metrics.halstead.effort
old: 149.4867642699313
new: 9741464.979081783
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.5479520632582413
new: 0.4003726328725802
path: .spaces[0].metrics.halstead.length
old: 15.0
new: 8495.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 23.21928094887362
new: 3401.1655162525685
path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 28.0
path: .spaces[0].metrics.halstead.n2
old: 5.0
new: 381.0
path: .spaces[0].metrics.loc.cloc
old: 3.0
new: 12.0
path: .spaces[0].metrics.loc.blank
old: 3.0
new: 170.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 391.0
path: .spaces[0].metrics.loc.ploc
old: 8.0
new: 1249.0
path: .spaces[0].metrics.loc.sloc
old: 14.0
new: 1431.0
path: .spaces[0].metrics.nom.total
old: 1.0
new: 96.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 96.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 0.71875
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 69.0
path: .spaces[0].metrics.mi.mi_sei
old: 112.16999464369854
new: -169.4429788117932
path: .spaces[0].metrics.mi.mi_visual_studio
old: 62.70910778490485
new: 0.0
path: .spaces[0].metrics.mi.mi_original
old: 107.2325743121873
new: -98.60178733701667

### Code

    namespace IPC {

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializer<
              mozilla::EventMessage, mozilla::EventMessage(0),
              mozilla::EventMessage::eEventMessage_MaxValue> {};

    template <>
    struct ParamTraits {
      typedef mozilla::BaseEventFlags paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        aMsg->WriteBytes(&aParam, sizeof(aParam));
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return aMsg->ReadBytesInto(aIter, aResult, sizeof(*aResult));
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        // Mark the event as posted to another process.
        const_cast(aParam).MarkAsPostedToRemoteProcess();

        WriteParam(aMsg, static_cast(aParam.mClass));
        WriteParam(aMsg, aParam.mMessage);
        WriteParam(aMsg, aParam.mRefPoint);
        WriteParam(aMsg, aParam.mFocusSequenceNumber);
        WriteParam(aMsg, aParam.mTime);
        WriteParam(aMsg, aParam.mTimeStamp);
        WriteParam(aMsg, aParam.mFlags);
        WriteParam(aMsg, aParam.mLayersId);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        mozilla::EventClassIDType eventClassID = 0;
        bool ret = ReadParam(aMsg, aIter, &eventClassID) &&
                   ReadParam(aMsg, aIter, &aResult->mMessage) &&
                   ReadParam(aMsg, aIter, &aResult->mRefPoint) &&
                   ReadParam(aMsg, aIter, &aResult->mFocusSequenceNumber) &&
                   ReadParam(aMsg, aIter, &aResult->mTime) &&
                   ReadParam(aMsg, aIter, &aResult->mTimeStamp) &&
                   ReadParam(aMsg, aIter, &aResult->mFlags) &&
                   ReadParam(aMsg, aIter, &aResult->mLayersId);
        aResult->mClass = static_cast(eventClassID);
        if (ret) {
          // Reset cross process dispatching state here because the event has not
          // been dispatched to different process from current process.
          aResult->ResetCrossProcessDispatchingState();
          // Mark the event comes from another process.
          aResult->MarkAsComingFromAnotherProcess();
        }
        return ret;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::NativeEventData paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mBuffer);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mBuffer);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetGUIEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mPluginEvent);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter,
                         static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mPluginEvent);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetInputEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mModifiers);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter,
                         static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mModifiers);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetMouseEventBase paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mButton);
        WriteParam(aMsg, aParam.mButtons);
        WriteParam(aMsg, aParam.mPressure);
        WriteParam(aMsg, aParam.mInputSource);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter,
                         static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mButton) &&
               ReadParam(aMsg, aIter, &aResult->mButtons) &&
               ReadParam(aMsg, aIter, &aResult->mPressure) &&
               ReadParam(aMsg, aIter, &aResult->mInputSource);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetWheelEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mDeltaX);
        WriteParam(aMsg, aParam.mDeltaY);
        WriteParam(aMsg, aParam.mDeltaZ);
        WriteParam(aMsg, aParam.mDeltaMode);
        WriteParam(aMsg, aParam.mCustomizedByUserPrefs);
        WriteParam(aMsg, aParam.mMayHaveMomentum);
        WriteParam(aMsg, aParam.mIsMomentum);
        WriteParam(aMsg, aParam.mIsNoLineOrPageDelta);
        WriteParam(aMsg, aParam.mLineOrPageDeltaX);
        WriteParam(aMsg, aParam.mLineOrPageDeltaY);
        WriteParam(aMsg, static_cast(aParam.mScrollType));
        WriteParam(aMsg, aParam.mOverflowDeltaX);
        WriteParam(aMsg, aParam.mOverflowDeltaY);
        WriteParam(aMsg, aParam.mViewPortIsOverscrolled);
        WriteParam(aMsg, aParam.mCanTriggerSwipe);
        WriteParam(aMsg, aParam.mAllowToOverrideSystemScrollSpeed);
        WriteParam(aMsg, aParam.mDeltaValuesHorizontalizedForDefaultHandler);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        uint8_t scrollType = 0;
        bool rv =
            ReadParam(aMsg, aIter,
                      static_cast(aResult)) &&
            ReadParam(aMsg, aIter, &aResult->mDeltaX) &&
            ReadParam(aMsg, aIter, &aResult->mDeltaY) &&
            ReadParam(aMsg, aIter, &aResult->mDeltaZ) &&
            ReadParam(aMsg, aIter, &aResult->mDeltaMode) &&
            ReadParam(aMsg, aIter, &aResult->mCustomizedByUserPrefs) &&
            ReadParam(aMsg, aIter, &aResult->mMayHaveMomentum) &&
            ReadParam(aMsg, aIter, &aResult->mIsMomentum) &&
            ReadParam(aMsg, aIter, &aResult->mIsNoLineOrPageDelta) &&
            ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
            ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
            ReadParam(aMsg, aIter, &scrollType) &&
            ReadParam(aMsg, aIter, &aResult->mOverflowDeltaX) &&
            ReadParam(aMsg, aIter, &aResult->mOverflowDeltaY) &&
            ReadParam(aMsg, aIter, &aResult->mViewPortIsOverscrolled) &&
            ReadParam(aMsg, aIter, &aResult->mCanTriggerSwipe) &&
            ReadParam(aMsg, aIter, &aResult->mAllowToOverrideSystemScrollSpeed) &&
            ReadParam(aMsg, aIter,
                      &aResult->mDeltaValuesHorizontalizedForDefaultHandler);
        aResult->mScrollType =
            static_cast(scrollType);
        return rv;
      }
    };

    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);
        WriteParam(aMsg, aParam.twist);
        WriteParam(aMsg, aParam.tangentialPressure);
        // We don't serialize convertToPointer since it's 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) &&
             ReadParam(aMsg, aIter, &aResult->twist) &&
             ReadParam(aMsg, aIter, &aResult->tangentialPressure);
        return rv;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetMouseEvent paramType;

      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, aParam.mExitFrom.isSome());
        if (aParam.mExitFrom.isSome()) {
          WriteParam(
              aMsg, static_cast(aParam.mExitFrom.value()));
        }
        WriteParam(aMsg, aParam.mClickCount);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        bool rv;
        paramType::ReasonType reason = 0;
        paramType::ContextMenuTriggerType contextMenuTrigger = 0;
        bool hasExitFrom = false;
        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);
        aResult->mReason = static_cast(reason);
        aResult->mContextMenuTrigger =
            static_cast(contextMenuTrigger);
        rv = rv && ReadParam(aMsg, aIter, &hasExitFrom);
        if (hasExitFrom) {
          paramType::ExitFromType exitFrom = 0;
          rv = rv && ReadParam(aMsg, aIter, &exitFrom);
          aResult->mExitFrom = Some(static_cast(exitFrom));
        }
        rv = rv && ReadParam(aMsg, aIter, &aResult->mClickCount);
        return rv;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetDragEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mUserCancelled);
        WriteParam(aMsg, aParam.mDefaultPreventedOnContent);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        bool rv = ReadParam(aMsg, aIter,
                            static_cast(aResult)) &&
                  ReadParam(aMsg, aIter, &aResult->mUserCancelled) &&
                  ReadParam(aMsg, aIter, &aResult->mDefaultPreventedOnContent);
        return rv;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetPointerEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mWidth);
        WriteParam(aMsg, aParam.mHeight);
        WriteParam(aMsg, aParam.mIsPrimary);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        bool rv = ReadParam(aMsg, aIter,
                            static_cast(aResult)) &&
                  ReadParam(aMsg, aIter, &aResult->mWidth) &&
                  ReadParam(aMsg, aIter, &aResult->mHeight) &&
                  ReadParam(aMsg, aIter, &aResult->mIsPrimary);
        return rv;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetTouchEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        // Sigh, Touch bites us again!  We want to be able to do
        //   WriteParam(aMsg, aParam.mTouches);
        const paramType::TouchArray& touches = aParam.mTouches;
        WriteParam(aMsg, touches.Length());
        for (uint32_t i = 0; i < touches.Length(); ++i) {
          mozilla::dom::Touch* touch = touches[i];
          WriteParam(aMsg, touch->mIdentifier);
          WriteParam(aMsg, touch->mRefPoint);
          WriteParam(aMsg, touch->mRadius);
          WriteParam(aMsg, touch->mRotationAngle);
          WriteParam(aMsg, touch->mForce);
        }
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        paramType::TouchArray::size_type numTouches;
        if (!ReadParam(aMsg, aIter,
                       static_cast(aResult)) ||
            !ReadParam(aMsg, aIter, &numTouches)) {
          return false;
        }
        for (uint32_t i = 0; i < numTouches; ++i) {
          int32_t identifier;
          mozilla::LayoutDeviceIntPoint refPoint;
          mozilla::LayoutDeviceIntPoint radius;
          float rotationAngle;
          float force;
          if (!ReadParam(aMsg, aIter, &identifier) ||
              !ReadParam(aMsg, aIter, &refPoint) ||
              !ReadParam(aMsg, aIter, &radius) ||
              !ReadParam(aMsg, aIter, &rotationAngle) ||
              !ReadParam(aMsg, aIter, &force)) {
            return false;
          }
          aResult->mTouches.AppendElement(new mozilla::dom::Touch(
              identifier, refPoint, radius, rotationAngle, force));
        }
        return true;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::AlternativeCharCode paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mUnshiftedCharCode);
        WriteParam(aMsg, aParam.mShiftedCharCode);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mUnshiftedCharCode) &&
               ReadParam(aMsg, aIter, &aResult->mShiftedCharCode);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::ShortcutKeyCandidate paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mCharCode);
        WriteParam(aMsg, aParam.mIgnoreShift);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mCharCode) &&
               ReadParam(aMsg, aIter, &aResult->mIgnoreShift);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetKeyboardEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg,
                   static_cast(aParam.mKeyNameIndex));
        WriteParam(aMsg,
                   static_cast(aParam.mCodeNameIndex));
        WriteParam(aMsg, aParam.mKeyValue);
        WriteParam(aMsg, aParam.mCodeValue);
        WriteParam(aMsg, aParam.mKeyCode);
        WriteParam(aMsg, aParam.mCharCode);
        WriteParam(aMsg, aParam.mPseudoCharCode);
        WriteParam(aMsg, aParam.mAlternativeCharCodes);
        WriteParam(aMsg, aParam.mIsRepeat);
        WriteParam(aMsg, aParam.mLocation);
        WriteParam(aMsg, aParam.mUniqueId);
        WriteParam(aMsg, aParam.mIsSynthesizedByTIP);
        WriteParam(aMsg, aParam.mMaybeSkippableInRemoteProcess);

        // An OS-specific native event might be attached in |mNativeKeyEvent|,  but
        // that cannot be copied across process boundaries.

        WriteParam(aMsg, aParam.mEditCommandsForSingleLineEditor);
        WriteParam(aMsg, aParam.mEditCommandsForMultiLineEditor);
        WriteParam(aMsg, aParam.mEditCommandsForRichTextEditor);
        WriteParam(aMsg, aParam.mEditCommandsForSingleLineEditorInitialized);
        WriteParam(aMsg, aParam.mEditCommandsForMultiLineEditorInitialized);
        WriteParam(aMsg, aParam.mEditCommandsForRichTextEditorInitialized);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        mozilla::KeyNameIndexType keyNameIndex = 0;
        mozilla::CodeNameIndexType codeNameIndex = 0;
        if (ReadParam(aMsg, aIter,
                      static_cast(aResult)) &&
            ReadParam(aMsg, aIter, &keyNameIndex) &&
            ReadParam(aMsg, aIter, &codeNameIndex) &&
            ReadParam(aMsg, aIter, &aResult->mKeyValue) &&
            ReadParam(aMsg, aIter, &aResult->mCodeValue) &&
            ReadParam(aMsg, aIter, &aResult->mKeyCode) &&
            ReadParam(aMsg, aIter, &aResult->mCharCode) &&
            ReadParam(aMsg, aIter, &aResult->mPseudoCharCode) &&
            ReadParam(aMsg, aIter, &aResult->mAlternativeCharCodes) &&
            ReadParam(aMsg, aIter, &aResult->mIsRepeat) &&
            ReadParam(aMsg, aIter, &aResult->mLocation) &&
            ReadParam(aMsg, aIter, &aResult->mUniqueId) &&
            ReadParam(aMsg, aIter, &aResult->mIsSynthesizedByTIP) &&
            ReadParam(aMsg, aIter, &aResult->mMaybeSkippableInRemoteProcess) &&
            ReadParam(aMsg, aIter, &aResult->mEditCommandsForSingleLineEditor) &&
            ReadParam(aMsg, aIter, &aResult->mEditCommandsForMultiLineEditor) &&
            ReadParam(aMsg, aIter, &aResult->mEditCommandsForRichTextEditor) &&
            ReadParam(aMsg, aIter,
                      &aResult->mEditCommandsForSingleLineEditorInitialized) &&
            ReadParam(aMsg, aIter,
                      &aResult->mEditCommandsForMultiLineEditorInitialized) &&
            ReadParam(aMsg, aIter,
                      &aResult->mEditCommandsForRichTextEditorInitialized)) {
          aResult->mKeyNameIndex = static_cast(keyNameIndex);
          aResult->mCodeNameIndex =
              static_cast(codeNameIndex);
          aResult->mNativeKeyEvent = nullptr;
          return true;
        }
        return false;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::TextRangeStyle paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mDefinedStyles);
        WriteParam(aMsg, static_cast(
                             aParam.mLineStyle));
        WriteParam(aMsg, aParam.mIsBoldLine);
        WriteParam(aMsg, aParam.mForegroundColor);
        WriteParam(aMsg, aParam.mBackgroundColor);
        WriteParam(aMsg, aParam.mUnderlineColor);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        mozilla::TextRangeStyle::LineStyleType lineStyle;
        if (!ReadParam(aMsg, aIter, &aResult->mDefinedStyles) ||
            !ReadParam(aMsg, aIter, &lineStyle) ||
            !ReadParam(aMsg, aIter, &aResult->mIsBoldLine) ||
            !ReadParam(aMsg, aIter, &aResult->mForegroundColor) ||
            !ReadParam(aMsg, aIter, &aResult->mBackgroundColor) ||
            !ReadParam(aMsg, aIter, &aResult->mUnderlineColor)) {
          return false;
        }
        aResult->mLineStyle = mozilla::TextRangeStyle::ToLineStyle(lineStyle);
        return true;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::TextRange paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mStartOffset);
        WriteParam(aMsg, aParam.mEndOffset);
        WriteParam(aMsg, mozilla::ToRawTextRangeType(aParam.mRangeType));
        WriteParam(aMsg, aParam.mRangeStyle);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        mozilla::RawTextRangeType rawTextRangeType;
        if (ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
            ReadParam(aMsg, aIter, &aResult->mEndOffset) &&
            ReadParam(aMsg, aIter, &rawTextRangeType) &&
            ReadParam(aMsg, aIter, &aResult->mRangeStyle)) {
          aResult->mRangeType = mozilla::ToTextRangeType(rawTextRangeType);
          return true;
        }
        return false;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::TextRangeArray paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.Length());
        for (uint32_t index = 0; index < aParam.Length(); index++) {
          WriteParam(aMsg, aParam[index]);
        }
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        paramType::size_type length;
        if (!ReadParam(aMsg, aIter, &length)) {
          return false;
        }
        for (uint32_t index = 0; index < length; index++) {
          mozilla::TextRange textRange;
          if (!ReadParam(aMsg, aIter, &textRange)) {
            aResult->Clear();
            return false;
          }
          aResult->AppendElement(textRange);
        }
        return true;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetCompositionEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mData);
        WriteParam(aMsg, aParam.mNativeIMEContext);
        bool hasRanges = !!aParam.mRanges;
        WriteParam(aMsg, hasRanges);
        if (hasRanges) {
          WriteParam(aMsg, *aParam.mRanges.get());
        }
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        bool hasRanges;
        if (!ReadParam(aMsg, aIter,
                       static_cast(aResult)) ||
            !ReadParam(aMsg, aIter, &aResult->mData) ||
            !ReadParam(aMsg, aIter, &aResult->mNativeIMEContext) ||
            !ReadParam(aMsg, aIter, &hasRanges)) {
          return false;
        }

        if (!hasRanges) {
          aResult->mRanges = nullptr;
        } else {
          aResult->mRanges = new mozilla::TextRangeArray();
          if (!ReadParam(aMsg, aIter, aResult->mRanges.get())) {
            return false;
          }
        }
        return true;
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::FontRange paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mStartOffset);
        WriteParam(aMsg, aParam.mFontName);
        WriteParam(aMsg, aParam.mFontSize);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
               ReadParam(aMsg, aIter, &aResult->mFontName) &&
               ReadParam(aMsg, aIter, &aResult->mFontSize);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WidgetSelectionEvent paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mOffset);
        WriteParam(aMsg, aParam.mLength);
        WriteParam(aMsg, aParam.mReversed);
        WriteParam(aMsg, aParam.mExpandToClusterBoundary);
        WriteParam(aMsg, aParam.mSucceeded);
        WriteParam(aMsg, aParam.mUseNativeLineBreak);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter,
                         static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mOffset) &&
               ReadParam(aMsg, aIter, &aResult->mLength) &&
               ReadParam(aMsg, aIter, &aResult->mReversed) &&
               ReadParam(aMsg, aIter, &aResult->mExpandToClusterBoundary) &&
               ReadParam(aMsg, aIter, &aResult->mSucceeded) &&
               ReadParam(aMsg, aIter, &aResult->mUseNativeLineBreak);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMENotificationRequests paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mWantUpdates);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mWantUpdates);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::NativeIMEContext paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mRawNativeIMEContext);
        WriteParam(aMsg, aParam.mOriginProcessID);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mRawNativeIMEContext) &&
               ReadParam(aMsg, aIter, &aResult->mOriginProcessID);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMENotification::Point paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mX);
        WriteParam(aMsg, aParam.mY);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mX) &&
               ReadParam(aMsg, aIter, &aResult->mY);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMENotification::Rect paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mX);
        WriteParam(aMsg, aParam.mY);
        WriteParam(aMsg, aParam.mWidth);
        WriteParam(aMsg, aParam.mHeight);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mX) &&
               ReadParam(aMsg, aIter, &aResult->mY) &&
               ReadParam(aMsg, aIter, &aResult->mWidth) &&
               ReadParam(aMsg, aIter, &aResult->mHeight);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMENotification::SelectionChangeDataBase paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        MOZ_RELEASE_ASSERT(aParam.mString);
        WriteParam(aMsg, aParam.mOffset);
        WriteParam(aMsg, *aParam.mString);
        WriteParam(aMsg, aParam.mWritingMode);
        WriteParam(aMsg, aParam.mReversed);
        WriteParam(aMsg, aParam.mCausedByComposition);
        WriteParam(aMsg, aParam.mCausedBySelectionEvent);
        WriteParam(aMsg, aParam.mOccurredDuringComposition);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        aResult->mString = new nsString();
        return ReadParam(aMsg, aIter, &aResult->mOffset) &&
               ReadParam(aMsg, aIter, aResult->mString) &&
               ReadParam(aMsg, aIter, &aResult->mWritingMode) &&
               ReadParam(aMsg, aIter, &aResult->mReversed) &&
               ReadParam(aMsg, aIter, &aResult->mCausedByComposition) &&
               ReadParam(aMsg, aIter, &aResult->mCausedBySelectionEvent) &&
               ReadParam(aMsg, aIter, &aResult->mOccurredDuringComposition);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMENotification::TextChangeDataBase paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mStartOffset);
        WriteParam(aMsg, aParam.mRemovedEndOffset);
        WriteParam(aMsg, aParam.mAddedEndOffset);
        WriteParam(aMsg, aParam.mCausedOnlyByComposition);
        WriteParam(aMsg, aParam.mIncludingChangesDuringComposition);
        WriteParam(aMsg, aParam.mIncludingChangesWithoutComposition);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
               ReadParam(aMsg, aIter, &aResult->mRemovedEndOffset) &&
               ReadParam(aMsg, aIter, &aResult->mAddedEndOffset) &&
               ReadParam(aMsg, aIter, &aResult->mCausedOnlyByComposition) &&
               ReadParam(aMsg, aIter,
                         &aResult->mIncludingChangesDuringComposition) &&
               ReadParam(aMsg, aIter,
                         &aResult->mIncludingChangesWithoutComposition);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMENotification::MouseButtonEventData paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mEventMessage);
        WriteParam(aMsg, aParam.mOffset);
        WriteParam(aMsg, aParam.mCursorPos);
        WriteParam(aMsg, aParam.mCharRect);
        WriteParam(aMsg, aParam.mButton);
        WriteParam(aMsg, aParam.mButtons);
        WriteParam(aMsg, aParam.mModifiers);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mEventMessage) &&
               ReadParam(aMsg, aIter, &aResult->mOffset) &&
               ReadParam(aMsg, aIter, &aResult->mCursorPos) &&
               ReadParam(aMsg, aIter, &aResult->mCharRect) &&
               ReadParam(aMsg, aIter, &aResult->mButton) &&
               ReadParam(aMsg, aIter, &aResult->mButtons) &&
               ReadParam(aMsg, aIter, &aResult->mModifiers);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMENotification paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg,
                   static_cast(aParam.mMessage));
        switch (aParam.mMessage) {
          case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE:
            WriteParam(aMsg, aParam.mSelectionChangeData);
            return;
          case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE:
            WriteParam(aMsg, aParam.mTextChangeData);
            return;
          case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
            WriteParam(aMsg, aParam.mMouseButtonEventData);
            return;
          default:
            return;
        }
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        mozilla::widget::IMEMessageType IMEMessage = 0;
        if (!ReadParam(aMsg, aIter, &IMEMessage)) {
          return false;
        }
        aResult->mMessage = static_cast(IMEMessage);
        switch (aResult->mMessage) {
          case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE:
            return ReadParam(aMsg, aIter, &aResult->mSelectionChangeData);
          case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE:
            return ReadParam(aMsg, aIter, &aResult->mTextChangeData);
          case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
            return ReadParam(aMsg, aIter, &aResult->mMouseButtonEventData);
          default:
            return true;
        }
      }
    };

    template <>
    struct ParamTraits
        : ContiguousEnumSerializer {};

    template <>
    struct ParamTraits
        : ContiguousEnumSerializerInclusive<
              mozilla::widget::IMEState::Open,
              mozilla::widget::IMEState::Open::OPEN_STATE_NOT_SUPPORTED,
              mozilla::widget::IMEState::Open::CLOSED> {};

    template <>
    struct ParamTraits {
      typedef mozilla::widget::IMEState paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mEnabled);
        WriteParam(aMsg, aParam.mOpen);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mEnabled) &&
               ReadParam(aMsg, aIter, &aResult->mOpen);
      }
    };

    template <>
    struct ParamTraits
        : ContiguousEnumSerializerInclusive<
              mozilla::widget::InputContext::Origin,
              mozilla::widget::InputContext::Origin::ORIGIN_MAIN,
              mozilla::widget::InputContext::Origin::ORIGIN_CONTENT> {};

    template <>
    struct ParamTraits {
      typedef mozilla::widget::InputContext paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mIMEState);
        WriteParam(aMsg, aParam.mHTMLInputType);
        WriteParam(aMsg, aParam.mHTMLInputInputmode);
        WriteParam(aMsg, aParam.mActionHint);
        WriteParam(aMsg, aParam.mAutocapitalize);
        WriteParam(aMsg, aParam.mOrigin);
        WriteParam(aMsg, aParam.mMayBeIMEUnaware);
        WriteParam(aMsg, aParam.mHasHandledUserInput);
        WriteParam(aMsg, aParam.mInPrivateBrowsing);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mIMEState) &&
               ReadParam(aMsg, aIter, &aResult->mHTMLInputType) &&
               ReadParam(aMsg, aIter, &aResult->mHTMLInputInputmode) &&
               ReadParam(aMsg, aIter, &aResult->mActionHint) &&
               ReadParam(aMsg, aIter, &aResult->mAutocapitalize) &&
               ReadParam(aMsg, aIter, &aResult->mOrigin) &&
               ReadParam(aMsg, aIter, &aResult->mMayBeIMEUnaware) &&
               ReadParam(aMsg, aIter, &aResult->mHasHandledUserInput) &&
               ReadParam(aMsg, aIter, &aResult->mInPrivateBrowsing);
      }
    };

    template <>
    struct ParamTraits
        : ContiguousEnumSerializerInclusive<
              mozilla::widget::InputContextAction::Cause,
              mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN,
              mozilla::widget::InputContextAction::Cause::
                  CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT> {};

    template <>
    struct ParamTraits
        : ContiguousEnumSerializerInclusive<
              mozilla::widget::InputContextAction::FocusChange,
              mozilla::widget::InputContextAction::FocusChange::FOCUS_NOT_CHANGED,
              mozilla::widget::InputContextAction::FocusChange::WIDGET_CREATED> {};

    template <>
    struct ParamTraits {
      typedef mozilla::widget::InputContextAction paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mCause);
        WriteParam(aMsg, aParam.mFocusChange);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mCause) &&
               ReadParam(aMsg, aIter, &aResult->mFocusChange);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::WritingMode paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mWritingMode.bits);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mWritingMode.bits);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::ContentCache::Selection paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mAnchor);
        WriteParam(aMsg, aParam.mFocus);
        WriteParam(aMsg, aParam.mWritingMode);
        WriteParam(aMsg, aParam.mAnchorCharRects[0]);
        WriteParam(aMsg, aParam.mAnchorCharRects[1]);
        WriteParam(aMsg, aParam.mFocusCharRects[0]);
        WriteParam(aMsg, aParam.mFocusCharRects[1]);
        WriteParam(aMsg, aParam.mRect);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mAnchor) &&
               ReadParam(aMsg, aIter, &aResult->mFocus) &&
               ReadParam(aMsg, aIter, &aResult->mWritingMode) &&
               ReadParam(aMsg, aIter, &aResult->mAnchorCharRects[0]) &&
               ReadParam(aMsg, aIter, &aResult->mAnchorCharRects[1]) &&
               ReadParam(aMsg, aIter, &aResult->mFocusCharRects[0]) &&
               ReadParam(aMsg, aIter, &aResult->mFocusCharRects[1]) &&
               ReadParam(aMsg, aIter, &aResult->mRect);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::ContentCache::Caret paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mOffset);
        WriteParam(aMsg, aParam.mRect);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mOffset) &&
               ReadParam(aMsg, aIter, &aResult->mRect);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::ContentCache::TextRectArray paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mStart);
        WriteParam(aMsg, aParam.mRects);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mStart) &&
               ReadParam(aMsg, aIter, &aResult->mRects);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::ContentCache paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mCompositionStart);
        WriteParam(aMsg, aParam.mText);
        WriteParam(aMsg, aParam.mSelection);
        WriteParam(aMsg, aParam.mFirstCharRect);
        WriteParam(aMsg, aParam.mCaret);
        WriteParam(aMsg, aParam.mTextRectArray);
        WriteParam(aMsg, aParam.mLastCommitStringTextRectArray);
        WriteParam(aMsg, aParam.mEditorRect);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mCompositionStart) &&
               ReadParam(aMsg, aIter, &aResult->mText) &&
               ReadParam(aMsg, aIter, &aResult->mSelection) &&
               ReadParam(aMsg, aIter, &aResult->mFirstCharRect) &&
               ReadParam(aMsg, aIter, &aResult->mCaret) &&
               ReadParam(aMsg, aIter, &aResult->mTextRectArray) &&
               ReadParam(aMsg, aIter, &aResult->mLastCommitStringTextRectArray) &&
               ReadParam(aMsg, aIter, &aResult->mEditorRect);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::widget::CandidateWindowPosition paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mPoint);
        WriteParam(aMsg, aParam.mRect);
        WriteParam(aMsg, aParam.mExcludeRect);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mPoint) &&
               ReadParam(aMsg, aIter, &aResult->mRect) &&
               ReadParam(aMsg, aIter, &aResult->mExcludeRect);
      }
    };

    // InputData.h

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::InputType, mozilla::InputType::MULTITOUCH_INPUT,
              mozilla::kHighestInputType> {};

    template <>
    struct ParamTraits {
      typedef mozilla::InputData paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mInputType);
        WriteParam(aMsg, aParam.mTime);
        WriteParam(aMsg, aParam.mTimeStamp);
        WriteParam(aMsg, aParam.modifiers);
        WriteParam(aMsg, aParam.mFocusSequenceNumber);
        WriteParam(aMsg, aParam.mLayersId);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, &aResult->mInputType) &&
               ReadParam(aMsg, aIter, &aResult->mTime) &&
               ReadParam(aMsg, aIter, &aResult->mTimeStamp) &&
               ReadParam(aMsg, aIter, &aResult->modifiers) &&
               ReadParam(aMsg, aIter, &aResult->mFocusSequenceNumber) &&
               ReadParam(aMsg, aIter, &aResult->mLayersId);
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::SingleTouchData::HistoricalTouchData paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mTimeStamp);
        WriteParam(aMsg, aParam.mScreenPoint);
        WriteParam(aMsg, aParam.mLocalScreenPoint);
        WriteParam(aMsg, aParam.mRadius);
        WriteParam(aMsg, aParam.mRotationAngle);
        WriteParam(aMsg, aParam.mForce);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return (ReadParam(aMsg, aIter, &aResult->mTimeStamp) &&
                ReadParam(aMsg, aIter, &aResult->mScreenPoint) &&
                ReadParam(aMsg, aIter, &aResult->mLocalScreenPoint) &&
                ReadParam(aMsg, aIter, &aResult->mRadius) &&
                ReadParam(aMsg, aIter, &aResult->mRotationAngle) &&
                ReadParam(aMsg, aIter, &aResult->mForce));
      }
    };

    template <>
    struct ParamTraits {
      typedef mozilla::SingleTouchData paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, aParam.mHistoricalData);
        WriteParam(aMsg, aParam.mIdentifier);
        WriteParam(aMsg, aParam.mScreenPoint);
        WriteParam(aMsg, aParam.mLocalScreenPoint);
        WriteParam(aMsg, aParam.mRadius);
        WriteParam(aMsg, aParam.mRotationAngle);
        WriteParam(aMsg, aParam.mForce);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return (ReadParam(aMsg, aIter, &aResult->mHistoricalData) &&
                ReadParam(aMsg, aIter, &aResult->mIdentifier) &&
                ReadParam(aMsg, aIter, &aResult->mScreenPoint) &&
                ReadParam(aMsg, aIter, &aResult->mLocalScreenPoint) &&
                ReadParam(aMsg, aIter, &aResult->mRadius) &&
                ReadParam(aMsg, aIter, &aResult->mRotationAngle) &&
                ReadParam(aMsg, aIter, &aResult->mForce));
      }
    };

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::MultiTouchInput::MultiTouchType,
              mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START,
              mozilla::MultiTouchInput::sHighestMultiTouchType> {};

    template <>
    struct ParamTraits {
      typedef mozilla::MultiTouchInput paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mType);
        WriteParam(aMsg, aParam.mTouches);
        WriteParam(aMsg, aParam.mHandledByAPZ);
        WriteParam(aMsg, aParam.mScreenOffset);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mType) &&
               ReadParam(aMsg, aIter, &aResult->mTouches) &&
               ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
               ReadParam(aMsg, aIter, &aResult->mScreenOffset);
      }
    };

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::MouseInput::MouseType,
              mozilla::MouseInput::MouseType::MOUSE_NONE,
              mozilla::MouseInput::sHighestMouseType> {};

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::MouseInput::ButtonType,
              mozilla::MouseInput::ButtonType::PRIMARY_BUTTON,
              mozilla::MouseInput::sHighestButtonType> {};

    template <>
    struct ParamTraits {
      typedef mozilla::MouseInput paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mButtonType);
        WriteParam(aMsg, aParam.mType);
        WriteParam(aMsg, aParam.mInputSource);
        WriteParam(aMsg, aParam.mButtons);
        WriteParam(aMsg, aParam.mOrigin);
        WriteParam(aMsg, aParam.mLocalOrigin);
        WriteParam(aMsg, aParam.mHandledByAPZ);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mButtonType) &&
               ReadParam(aMsg, aIter, &aResult->mType) &&
               ReadParam(aMsg, aIter, &aResult->mInputSource) &&
               ReadParam(aMsg, aIter, &aResult->mButtons) &&
               ReadParam(aMsg, aIter, &aResult->mOrigin) &&
               ReadParam(aMsg, aIter, &aResult->mLocalOrigin) &&
               ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
      }
    };

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::PanGestureInput::PanGestureType,
              mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART,
              mozilla::PanGestureInput::sHighestPanGestureType> {};

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::PanGestureInput::PanDeltaType,
              mozilla::PanGestureInput::PanDeltaType::PANDELTA_PAGE,
              mozilla::PanGestureInput::sHighestPanDeltaType> {};

    template <>
    struct ParamTraits
        : BitfieldHelper {
      typedef mozilla::PanGestureInput paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mType);
        WriteParam(aMsg, aParam.mPanStartPoint);
        WriteParam(aMsg, aParam.mPanDisplacement);
        WriteParam(aMsg, aParam.mLocalPanStartPoint);
        WriteParam(aMsg, aParam.mLocalPanDisplacement);
        WriteParam(aMsg, aParam.mLineOrPageDeltaX);
        WriteParam(aMsg, aParam.mLineOrPageDeltaY);
        WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
        WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
        WriteParam(aMsg, aParam.mDeltaType);
        WriteParam(aMsg, aParam.mHandledByAPZ);
        WriteParam(aMsg, aParam.mFollowedByMomentum);
        WriteParam(
            aMsg,
            aParam
                .mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
        WriteParam(aMsg, aParam.mOverscrollBehaviorAllowsSwipe);
        WriteParam(aMsg, aParam.mSimulateMomentum);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mType) &&
               ReadParam(aMsg, aIter, &aResult->mPanStartPoint) &&
               ReadParam(aMsg, aIter, &aResult->mPanDisplacement) &&
               ReadParam(aMsg, aIter, &aResult->mLocalPanStartPoint) &&
               ReadParam(aMsg, aIter, &aResult->mLocalPanDisplacement) &&
               ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
               ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
               ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
               ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
               ReadParam(aMsg, aIter, &aResult->mDeltaType) &&
               ReadBoolForBitfield(aMsg, aIter, aResult,
                                   ¶mType::SetHandledByAPZ) &&
               ReadBoolForBitfield(aMsg, aIter, aResult,
                                   ¶mType::SetFollowedByMomentum) &&
               ReadBoolForBitfield(
                   aMsg, aIter, aResult,
                   ¶mType::
                       SetRequiresContentResponseIfCannotScrollHorizontallyInStartDirection) &&
               ReadBoolForBitfield(aMsg, aIter, aResult,
                                   ¶mType::SetOverscrollBehaviorAllowsSwipe) &&
               ReadBoolForBitfield(aMsg, aIter, aResult,
                                   ¶mType::SetSimulateMomentum);
      }
    };

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::PinchGestureInput::PinchGestureType,
              mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START,
              mozilla::PinchGestureInput::sHighestPinchGestureType> {};

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::PinchGestureInput::PinchGestureSource,
              // Set the min to TOUCH, to ensure UNKNOWN is never sent over IPC
              mozilla::PinchGestureInput::PinchGestureSource::TOUCH,
              mozilla::PinchGestureInput::sHighestPinchGestureSource> {};

    template <>
    struct ParamTraits {
      typedef mozilla::PinchGestureInput paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mType);
        WriteParam(aMsg, aParam.mSource);
        WriteParam(aMsg, aParam.mScreenOffset);
        WriteParam(aMsg, aParam.mFocusPoint);
        WriteParam(aMsg, aParam.mLocalFocusPoint);
        WriteParam(aMsg, aParam.mCurrentSpan);
        WriteParam(aMsg, aParam.mPreviousSpan);
        WriteParam(aMsg, aParam.mLineOrPageDeltaY);
        WriteParam(aMsg, aParam.mHandledByAPZ);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mType) &&
               ReadParam(aMsg, aIter, &aResult->mSource) &&
               ReadParam(aMsg, aIter, &aResult->mScreenOffset) &&
               ReadParam(aMsg, aIter, &aResult->mFocusPoint) &&
               ReadParam(aMsg, aIter, &aResult->mLocalFocusPoint) &&
               ReadParam(aMsg, aIter, &aResult->mCurrentSpan) &&
               ReadParam(aMsg, aIter, &aResult->mPreviousSpan) &&
               ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
               ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
      }
    };

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::TapGestureInput::TapGestureType,
              mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG,
              mozilla::TapGestureInput::sHighestTapGestureType> {};

    template <>
    struct ParamTraits {
      typedef mozilla::TapGestureInput paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mType);
        WriteParam(aMsg, aParam.mPoint);
        WriteParam(aMsg, aParam.mLocalPoint);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mType) &&
               ReadParam(aMsg, aIter, &aResult->mPoint) &&
               ReadParam(aMsg, aIter, &aResult->mLocalPoint);
      }
    };

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::ScrollWheelInput::ScrollDeltaType,
              mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE,
              mozilla::ScrollWheelInput::sHighestScrollDeltaType> {};

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::ScrollWheelInput::ScrollMode,
              mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT,
              mozilla::ScrollWheelInput::sHighestScrollMode> {};

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializer<
              mozilla::WheelDeltaAdjustmentStrategy,
              mozilla::WheelDeltaAdjustmentStrategy(0),
              mozilla::WheelDeltaAdjustmentStrategy::eSentinel> {};

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializerInclusive<
              mozilla::layers::APZWheelAction,
              mozilla::layers::APZWheelAction::Scroll,
              mozilla::layers::kHighestAPZWheelAction> {};

    template <>
    struct ParamTraits {
      typedef mozilla::ScrollWheelInput paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mDeltaType);
        WriteParam(aMsg, aParam.mScrollMode);
        WriteParam(aMsg, aParam.mOrigin);
        WriteParam(aMsg, aParam.mHandledByAPZ);
        WriteParam(aMsg, aParam.mDeltaX);
        WriteParam(aMsg, aParam.mDeltaY);
        WriteParam(aMsg, aParam.mLocalOrigin);
        WriteParam(aMsg, aParam.mLineOrPageDeltaX);
        WriteParam(aMsg, aParam.mLineOrPageDeltaY);
        WriteParam(aMsg, aParam.mScrollSeriesNumber);
        WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
        WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
        WriteParam(aMsg, aParam.mMayHaveMomentum);
        WriteParam(aMsg, aParam.mIsMomentum);
        WriteParam(aMsg, aParam.mAllowToOverrideSystemScrollSpeed);
        WriteParam(aMsg, aParam.mWheelDeltaAdjustmentStrategy);
        WriteParam(aMsg, aParam.mAPZAction);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mDeltaType) &&
               ReadParam(aMsg, aIter, &aResult->mScrollMode) &&
               ReadParam(aMsg, aIter, &aResult->mOrigin) &&
               ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
               ReadParam(aMsg, aIter, &aResult->mDeltaX) &&
               ReadParam(aMsg, aIter, &aResult->mDeltaY) &&
               ReadParam(aMsg, aIter, &aResult->mLocalOrigin) &&
               ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
               ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
               ReadParam(aMsg, aIter, &aResult->mScrollSeriesNumber) &&
               ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
               ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
               ReadParam(aMsg, aIter, &aResult->mMayHaveMomentum) &&
               ReadParam(aMsg, aIter, &aResult->mIsMomentum) &&
               ReadParam(aMsg, aIter,
                         &aResult->mAllowToOverrideSystemScrollSpeed) &&
               ReadParam(aMsg, aIter, &aResult->mWheelDeltaAdjustmentStrategy) &&
               ReadParam(aMsg, aIter, &aResult->mAPZAction);
      }
    };

    template <>
    struct ParamTraits
        : public ContiguousEnumSerializer<
              mozilla::KeyboardInput::KeyboardEventType,
              mozilla::KeyboardInput::KeyboardEventType::KEY_DOWN,
              mozilla::KeyboardInput::KeyboardEventType::KEY_SENTINEL> {};

    template <>
    struct ParamTraits {
      typedef mozilla::KeyboardInput paramType;

      static void Write(Message* aMsg, const paramType& aParam) {
        WriteParam(aMsg, static_cast(aParam));
        WriteParam(aMsg, aParam.mType);
        WriteParam(aMsg, aParam.mKeyCode);
        WriteParam(aMsg, aParam.mCharCode);
        WriteParam(aMsg, aParam.mShortcutCandidates);
        WriteParam(aMsg, aParam.mHandledByAPZ);
      }

      static bool Read(const Message* aMsg, PickleIterator* aIter,
                       paramType* aResult) {
        return ReadParam(aMsg, aIter, static_cast(aResult)) &&
               ReadParam(aMsg, aIter, &aResult->mType) &&
               ReadParam(aMsg, aIter, &aResult->mKeyCode) &&
               ReadParam(aMsg, aIter, &aResult->mCharCode) &&
               ReadParam(aMsg, aIter, &aResult->mShortcutCandidates) &&
               ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
      }
    };

    }  // namespace IPC

## Minimal test - lines (26, 29)

path: .spaces[0].spaces[0].metrics.halstead.N2
old: 5.0
new: 7.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 9.0
new: 12.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.008058711007931684
new: 0.01714531255519884
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 19.60964047443681
new: 31.26112492884004
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 7.0
new: 14.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 6.604010419671484
new: 20.49403562912261
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 4.0
new: 5.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 38.039100017307746
new: 75.28421251514428
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 3.125
new: 4.9
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 5.0
new: 7.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 12.0
new: 21.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.6341367062030674
new: 1.4886249966114304
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.32
new: 0.2040816326530612
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 118.87218755408672
new: 368.892641324207
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 70.23126302740533
new: 73.59147660887231
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 97.76391198015656
new: 105.95176765498243
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 120.09545977686312
new: 125.84142500117164
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.0
new: null
path: .spaces[0].spaces[0].metrics.nargs.average
old: 0.0
new: null
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 7.0
new: 4.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 6.0
new: 4.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 1.0
new: 0.0

### Code

    struct ParamTraits
        : public ContiguousEnumSerializer<
              mozilla::EventMessage, mozilla::EventMessage(0),
              mozilla::EventMessage::eEventMessage_MaxValue> {};