# Global Metrics

path: .metrics.nexits.sum
old: 4.0
new: 6.0
path: .metrics.nexits.average
old: 0.14814814814814814
new: 0.42857142857142855
path: .metrics.cyclomatic.average
old: 1.6071428571428572
new: 1.0
path: .metrics.cyclomatic.sum
old: 45.0
new: 19.0
path: .metrics.halstead.n2
old: 87.0
new: 80.0
path: .metrics.halstead.volume
old: 5885.814444564307
new: 3697.6228028604014
path: .metrics.halstead.estimated_program_length
old: 682.7475168105077
new: 580.8128976169506
path: .metrics.halstead.time
old: 16172.834964853266
new: 5962.416769612397
path: .metrics.halstead.difficulty
old: 49.45977011494253
new: 29.025
path: .metrics.halstead.effort
old: 291111.0293673588
new: 107323.50185302316
path: .metrics.halstead.vocabulary
old: 113.0
new: 98.0
path: .metrics.halstead.bugs
old: 1.464146449114617
new: 0.7527925315642322
path: .metrics.halstead.purity_ratio
old: 0.7911326961883056
new: 1.0390212837512534
path: .metrics.halstead.length
old: 863.0
new: 559.0
path: .metrics.halstead.N2
old: 331.0
new: 258.0
path: .metrics.halstead.level
old: 0.020218452242621428
new: 0.034453057708871665
path: .metrics.halstead.N1
old: 532.0
new: 301.0
path: .metrics.halstead.n1
old: 26.0
new: 18.0
path: .metrics.mi.mi_visual_studio
old: 15.550670607303411
new: 22.55577877760479
path: .metrics.mi.mi_original
old: 26.591646738488834
new: 38.57038170970419
path: .metrics.mi.mi_sei
old: -20.67918699742981
new: 13.53747418498634
path: .metrics.nargs.average
old: 1.2222222222222223
new: 1.2142857142857142
path: .metrics.nargs.sum
old: 33.0
new: 17.0
path: .metrics.cognitive.sum
old: 15.0
new: 0.0
path: .metrics.cognitive.average
old: 0.5555555555555556
new: 0.0
path: .metrics.nom.functions
old: 27.0
new: 14.0
path: .metrics.nom.total
old: 27.0
new: 14.0
path: .metrics.loc.cloc
old: 6.0
new: 38.0
path: .metrics.loc.sloc
old: 242.0
new: 194.0
path: .metrics.loc.ploc
old: 197.0
new: 125.0
path: .metrics.loc.blank
old: 39.0
new: 31.0
path: .metrics.loc.lloc
old: 116.0
new: 34.0

# Spaces Data

## Minimal test - lines (16, 192)

path: .spaces[0].metrics.cyclomatic.sum
old: 3.0
new: 18.0
path: .spaces[0].metrics.cyclomatic.average
old: 3.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 14.0
path: .spaces[0].metrics.nom.total
old: 1.0
new: 14.0
path: .spaces[0].metrics.halstead.n1
old: 12.0
new: 18.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 76.2388309575275
new: 542.2200518131526
path: .spaces[0].metrics.halstead.n2
old: 10.0
new: 75.0
path: .spaces[0].metrics.halstead.effort
old: 1605.395382709427
new: 109352.52183369247
path: .spaces[0].metrics.halstead.N1
old: 25.0
new: 301.0
path: .spaces[0].metrics.halstead.level
old: 0.1111111111111111
new: 0.033068783068783074
path: .spaces[0].metrics.halstead.volume
old: 178.37726474549189
new: 3616.154822542741
path: .spaces[0].metrics.halstead.time
old: 89.18863237274594
new: 6075.140101871804
path: .spaces[0].metrics.halstead.length
old: 40.0
new: 553.0
path: .spaces[0].metrics.halstead.bugs
old: 0.04570181188069797
new: 0.7622509025405069
path: .spaces[0].metrics.halstead.difficulty
old: 9.0
new: 30.24
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.9059707739381877
new: 0.9805064228085942
path: .spaces[0].metrics.halstead.N2
old: 15.0
new: 252.0
path: .spaces[0].metrics.halstead.vocabulary
old: 22.0
new: 93.0
path: .spaces[0].metrics.loc.ploc
old: 9.0
new: 117.0
path: .spaces[0].metrics.loc.sloc
old: 9.0
new: 177.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 32.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 28.0
path: .spaces[0].metrics.loc.lloc
old: 5.0
new: 34.0
path: .spaces[0].metrics.nargs.average
old: 0.0
new: 1.2142857142857142
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 17.0
path: .spaces[0].metrics.cognitive.average
old: 3.0
new: 0.0
path: .spaces[0].metrics.cognitive.sum
old: 3.0
new: 0.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 63.01677066164621
new: 23.626846983725315
path: .spaces[0].metrics.mi.mi_sei
old: 80.06751770633458
new: 15.02438411417149
path: .spaces[0].metrics.mi.mi_original
old: 107.75867783141504
new: 40.40190834217029
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 0.42857142857142855
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 6.0

### Code

    namespace mozilla {

    /******************************************************************************
     * mozilla::WidgetGestureNotifyEvent
     *
     * This event is the first event generated when the user touches
     * the screen with a finger, and it's meant to decide what kind
     * of action we'll use for that touch interaction.
     *
     * The event is dispatched to the layout and based on what is underneath
     * the initial contact point it's then decided if we should pan
     * (finger scrolling) or drag the target element.
     ******************************************************************************/

    class WidgetGestureNotifyEvent : public WidgetGUIEvent {
     public:
      virtual WidgetGestureNotifyEvent* AsGestureNotifyEvent() override {
        return this;
      }

      WidgetGestureNotifyEvent(bool aIsTrusted, EventMessage aMessage,
                               nsIWidget* aWidget)
          : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eGestureNotifyEventClass),
            mPanDirection(ePanNone),
            mDisplayPanFeedback(false) {}

      virtual WidgetEvent* Duplicate() const override {
        // XXX Looks like this event is handled only in PostHandleEvent() of
        //     EventStateManager.  Therefore, it might be possible to handle this
        //     in PreHandleEvent() and not to dispatch as a DOM event into the DOM
        //     tree like ContentQueryEvent.  Then, this event doesn't need to
        //     support Duplicate().
        MOZ_ASSERT(mClass == eGestureNotifyEventClass,
                   "Duplicate() must be overridden by sub class");
        // Not copying widget, it is a weak reference.
        WidgetGestureNotifyEvent* result =
            new WidgetGestureNotifyEvent(false, mMessage, nullptr);
        result->AssignGestureNotifyEventData(*this, true);
        result->mFlags = mFlags;
        return result;
      }

      typedef int8_t PanDirectionType;
      enum PanDirection : PanDirectionType {
        ePanNone,
        ePanVertical,
        ePanHorizontal,
        ePanBoth
      };

      PanDirection mPanDirection;
      bool mDisplayPanFeedback;

      void AssignGestureNotifyEventData(const WidgetGestureNotifyEvent& aEvent,
                                        bool aCopyTargets) {
        AssignGUIEventData(aEvent, aCopyTargets);

        mPanDirection = aEvent.mPanDirection;
        mDisplayPanFeedback = aEvent.mDisplayPanFeedback;
      }
    };

    /******************************************************************************
     * mozilla::WidgetSimpleGestureEvent
     ******************************************************************************/

    class WidgetSimpleGestureEvent : public WidgetMouseEventBase {
     public:
      virtual WidgetSimpleGestureEvent* AsSimpleGestureEvent() override {
        return this;
      }

      WidgetSimpleGestureEvent(bool aIsTrusted, EventMessage aMessage,
                               nsIWidget* aWidget)
          : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget,
                                 eSimpleGestureEventClass),
            mAllowedDirections(0),
            mDirection(0),
            mClickCount(0),
            mDelta(0.0) {}

      WidgetSimpleGestureEvent(const WidgetSimpleGestureEvent& aOther)
          : WidgetMouseEventBase(aOther.IsTrusted(), aOther.mMessage,
                                 aOther.mWidget, eSimpleGestureEventClass),
            mAllowedDirections(aOther.mAllowedDirections),
            mDirection(aOther.mDirection),
            mClickCount(0),
            mDelta(aOther.mDelta) {}

      virtual WidgetEvent* Duplicate() const override {
        MOZ_ASSERT(mClass == eSimpleGestureEventClass,
                   "Duplicate() must be overridden by sub class");
        // Not copying widget, it is a weak reference.
        WidgetSimpleGestureEvent* result =
            new WidgetSimpleGestureEvent(false, mMessage, nullptr);
        result->AssignSimpleGestureEventData(*this, true);
        result->mFlags = mFlags;
        return result;
      }

      // See SimpleGestureEvent.webidl for values
      uint32_t mAllowedDirections;
      // See SimpleGestureEvent.webidl for values
      uint32_t mDirection;
      // The number of taps for tap events
      uint32_t mClickCount;
      // Delta for magnify and rotate events
      double mDelta;

      // XXX Not tested by test_assign_event_data.html
      void AssignSimpleGestureEventData(const WidgetSimpleGestureEvent& aEvent,
                                        bool aCopyTargets) {
        AssignMouseEventBaseData(aEvent, aCopyTargets);

        // mAllowedDirections isn't copied
        mDirection = aEvent.mDirection;
        mDelta = aEvent.mDelta;
        mClickCount = aEvent.mClickCount;
      }
    };

    /******************************************************************************
     * mozilla::WidgetTouchEvent
     ******************************************************************************/

    class WidgetTouchEvent : public WidgetInputEvent {
     public:
      typedef nsTArray> TouchArray;
      typedef AutoTArray, 10> AutoTouchArray;
      typedef AutoTouchArray::base_type TouchArrayBase;

      virtual WidgetTouchEvent* AsTouchEvent() override { return this; }

      MOZ_COUNTED_DEFAULT_CTOR(WidgetTouchEvent)

      WidgetTouchEvent(const WidgetTouchEvent& aOther)
          : WidgetInputEvent(aOther.IsTrusted(), aOther.mMessage, aOther.mWidget,
                             eTouchEventClass) {
        MOZ_COUNT_CTOR(WidgetTouchEvent);
        mModifiers = aOther.mModifiers;
        mTime = aOther.mTime;
        mTimeStamp = aOther.mTimeStamp;
        mTouches.AppendElements(aOther.mTouches);
        mFlags.mCancelable = mMessage != eTouchCancel;
        mFlags.mHandledByAPZ = aOther.mFlags.mHandledByAPZ;
      }

      WidgetTouchEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
          : WidgetInputEvent(aIsTrusted, aMessage, aWidget, eTouchEventClass) {
        MOZ_COUNT_CTOR(WidgetTouchEvent);
        mFlags.mCancelable = mMessage != eTouchCancel;
      }

      MOZ_COUNTED_DTOR_OVERRIDE(WidgetTouchEvent)

      virtual WidgetEvent* Duplicate() const override {
        MOZ_ASSERT(mClass == eTouchEventClass,
                   "Duplicate() must be overridden by sub class");
        // Not copying widget, it is a weak reference.
        WidgetTouchEvent* result = new WidgetTouchEvent(false, mMessage, nullptr);
        result->AssignTouchEventData(*this, true);
        result->mFlags = mFlags;
        return result;
      }

      TouchArray mTouches;

      void AssignTouchEventData(const WidgetTouchEvent& aEvent, bool aCopyTargets) {
        AssignInputEventData(aEvent, aCopyTargets);

        // Assign*EventData() assume that they're called only new instance.
        MOZ_ASSERT(mTouches.IsEmpty());
        mTouches.AppendElements(aEvent.mTouches);
      }
    };

    }  // namespace mozilla