# Global Metrics

path: .metrics.cognitive.average
old: 2.0
new: 0.0
path: .metrics.cognitive.sum
old: 2.0
new: 0.0
path: .metrics.nexits.average
old: 1.0
new: 0.6666666666666666
path: .metrics.nexits.sum
old: 1.0
new: 2.0
path: .metrics.nom.total
old: 1.0
new: 3.0
path: .metrics.nom.functions
old: 1.0
new: 3.0
path: .metrics.loc.blank
old: 19.0
new: 25.0
path: .metrics.loc.lloc
old: 5.0
new: 2.0
path: .metrics.loc.cloc
old: 126.0
new: 56.0
path: .metrics.loc.ploc
old: 34.0
new: 65.0
path: .metrics.loc.sloc
old: 179.0
new: 146.0
path: .metrics.nargs.average
old: 0.0
new: 1.0
path: .metrics.nargs.sum
old: 0.0
new: 3.0
path: .metrics.cyclomatic.average
old: 1.6666666666666667
new: 1.0
path: .metrics.cyclomatic.sum
old: 5.0
new: 6.0
path: .metrics.mi.mi_original
old: 47.37798529294133
new: 49.548696493140355
path: .metrics.mi.mi_sei
old: 41.33497812666594
new: 37.337580777811624
path: .metrics.mi.mi_visual_studio
old: 27.706424147918906
new: 28.97584590242126
path: .metrics.halstead.length
old: 286.0
new: 295.0
path: .metrics.halstead.difficulty
old: 20.416666666666668
new: 10.48125
path: .metrics.halstead.purity_ratio
old: 0.8556666398113671
new: 1.8774914031417735
path: .metrics.halstead.vocabulary
old: 51.0
new: 93.0
path: .metrics.halstead.estimated_program_length
old: 244.720658986051
new: 553.8599639268232
path: .metrics.halstead.effort
old: 33122.23697599522
new: 20218.874695233186
path: .metrics.halstead.n1
old: 15.0
new: 13.0
path: .metrics.halstead.N2
old: 98.0
new: 129.0
path: .metrics.halstead.N1
old: 188.0
new: 166.0
path: .metrics.halstead.time
old: 1840.1242764441788
new: 1123.2708164018436
path: .metrics.halstead.volume
old: 1622.3136478038475
new: 1929.0518492768692
path: .metrics.halstead.bugs
old: 0.34378890124681183
new: 0.24739071690666117
path: .metrics.halstead.n2
old: 36.0
new: 80.0
path: .metrics.halstead.level
old: 0.04897959183673469
new: 0.09540846750149076

# Spaces Data

## Minimal test - lines (20, 144)

path: .spaces[0].metrics.loc.ploc
old: 5.0
new: 57.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 2.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 21.0
path: .spaces[0].metrics.loc.sloc
old: 5.0
new: 125.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 47.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 71.47748507010611
new: 30.69187605099093
path: .spaces[0].metrics.mi.mi_original
old: 122.22649946988145
new: 52.48310804719449
path: .spaces[0].metrics.mi.mi_sei
old: 100.73653251780718
new: 41.19461141089475
path: .spaces[0].metrics.nom.total
old: 0.0
new: 3.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 3.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[0].metrics.nargs.average
old: null
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 5.0
path: .spaces[0].metrics.halstead.effort
old: 188.2105312878607
new: 19830.971823745993
path: .spaces[0].metrics.halstead.difficulty
old: 2.5
new: 10.66
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.4886249966114304
new: 1.7891219379271712
path: .spaces[0].metrics.halstead.estimated_program_length
old: 31.26112492884004
new: 515.2671181230253
path: .spaces[0].metrics.halstead.vocabulary
old: 12.0
new: 88.0
path: .spaces[0].metrics.halstead.bugs
old: 0.010947325359591292
new: 0.24421635422260027
path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 13.0
path: .spaces[0].metrics.halstead.volume
old: 75.28421251514428
new: 1860.3163061675416
path: .spaces[0].metrics.halstead.N1
old: 14.0
new: 165.0
path: .spaces[0].metrics.halstead.level
old: 0.4
new: 0.09380863039399624
path: .spaces[0].metrics.halstead.n2
old: 7.0
new: 75.0
path: .spaces[0].metrics.halstead.time
old: 10.456140627103371
new: 1101.7206568747774
path: .spaces[0].metrics.halstead.N2
old: 7.0
new: 123.0
path: .spaces[0].metrics.halstead.length
old: 21.0
new: 288.0
path: .spaces[0].metrics.nexits.average
old: null
new: 0.6666666666666666
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 2.0

### Code

    class nsWindowBase : public nsBaseWidget {
     public:
      typedef mozilla::WidgetEventTime WidgetEventTime;

      /*
       * Return the HWND or null for this widget.
       */
      HWND GetWindowHandle() {
        return static_cast(GetNativeData(NS_NATIVE_WINDOW));
      }

      /*
       * Return the parent window, if it exists.
       */
      virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) = 0;

      /*
       * Return true if this is a top level widget.
       */
      virtual bool IsTopLevelWidget() = 0;

      /*
       * Init a standard gecko event for this widget.
       * @param aEvent the event to initialize.
       * @param aPoint message position in physical coordinates.
       */
      virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
                             LayoutDeviceIntPoint* aPoint = nullptr) = 0;

      /*
       * Returns WidgetEventTime instance which is initialized with current message
       * time.
       */
      virtual WidgetEventTime CurrentMessageWidgetEventTime() const = 0;

      /*
       * Dispatch a gecko event for this widget.
       * Returns true if it's consumed.  Otherwise, false.
       */
      virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) = 0;

      /*
       * Dispatch a gecko keyboard event for this widget. This
       * is called by KeyboardLayout to dispatch gecko events.
       * Returns true if it's consumed.  Otherwise, false.
       */
      virtual bool DispatchKeyboardEvent(mozilla::WidgetKeyboardEvent* aEvent) = 0;

      /*
       * Dispatch a gecko wheel event for this widget. This
       * is called by ScrollHandler to dispatch gecko events.
       * Returns true if it's consumed.  Otherwise, false.
       */
      virtual bool DispatchWheelEvent(mozilla::WidgetWheelEvent* aEvent) = 0;

      /*
       * Dispatch a gecko content command event for this widget. This
       * is called by ScrollHandler to dispatch gecko events.
       * Returns true if it's consumed.  Otherwise, false.
       */
      virtual bool DispatchContentCommandEvent(
          mozilla::WidgetContentCommandEvent* aEvent) = 0;

      /*
       * Touch input injection apis
       */
      virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
                                                  TouchPointerState aPointerState,
                                                  LayoutDeviceIntPoint aPoint,
                                                  double aPointerPressure,
                                                  uint32_t aPointerOrientation,
                                                  nsIObserver* aObserver) override;
      virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver) override;

      virtual nsresult SynthesizeNativePenInput(
          uint32_t aPointerId, TouchPointerState aPointerState,
          LayoutDeviceIntPoint aPoint, double aPressure, uint32_t aRotation,
          int32_t aTiltX, int32_t aTiltY, nsIObserver* aObserver) override;

      /*
       * WM_APPCOMMAND common handler.
       * Sends events via NativeKey::HandleAppCommandMessage().
       */
      virtual bool HandleAppCommandMsg(const MSG& aAppCommandMsg,
                                       LRESULT* aRetValue);

      const InputContext& InputContextRef() const { return mInputContext; }

     protected:
      virtual int32_t LogToPhys(double aValue) = 0;
      void ChangedDPI();

      static bool InitTouchInjection();
      bool InjectTouchPoint(uint32_t aId, LayoutDeviceIntPoint& aPoint,
                            POINTER_FLAGS aFlags, uint32_t aPressure = 1024,
                            uint32_t aOrientation = 90);

      class PointerInfo {
       public:
        enum class PointerType : uint8_t {
          TOUCH,
          PEN,
        };

        PointerInfo(int32_t aPointerId, LayoutDeviceIntPoint& aPoint,
                    PointerType aType)
            : mPointerId(aPointerId), mPosition(aPoint), mType(aType) {}

        int32_t mPointerId;
        LayoutDeviceIntPoint mPosition;
        PointerType mType;
      };

      nsClassHashtable mActivePointers;
      static bool sTouchInjectInitialized;
      static InjectTouchInputPtr sInjectTouchFuncPtr;

      // This is used by SynthesizeNativeTouchPoint to maintain state between
      // multiple synthesized points, in the case where we can't call InjectTouch
      // directly.
      mozilla::UniquePtr mSynthesizedTouchInput;

     protected:
      InputContext mInputContext;
    };