Bug 1259664 part.13 Reorder the definition of members of WidgetWheelEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 01 Apr 2016 00:46:18 +0900
changeset 291268 31898058e49e7d7d6e19666e4d24d0759f983fc3
parent 291267 1cbdd0ffeee45dc70d8bbaceedb8947bb54f8006
child 291269 8ce603f20bac14b9bf0a34da4a17c65c83bafb66
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1259664
milestone48.0a1
Bug 1259664 part.13 Reorder the definition of members of WidgetWheelEvent r=smaug MozReview-Commit-ID: 345QqjCPdSA
widget/MouseEvents.h
widget/nsGUIEventIPC.h
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -446,49 +446,49 @@ class WidgetWheelEvent : public WidgetMo
 private:
   friend class mozilla::dom::PBrowserParent;
   friend class mozilla::dom::PBrowserChild;
 
   WidgetWheelEvent()
     : mDeltaX(0.0)
     , mDeltaY(0.0)
     , mDeltaZ(0.0)
+    , mOverflowDeltaX(0.0)
+    , mOverflowDeltaY(0.0)
     , mDeltaMode(nsIDOMWheelEvent::DOM_DELTA_PIXEL)
+    , mLineOrPageDeltaX(0)
+    , mLineOrPageDeltaY(0)
+    , mScrollType(SCROLL_DEFAULT)
     , mCustomizedByUserPrefs(false)
     , mIsMomentum(false)
     , mIsNoLineOrPageDelta(false)
-    , mLineOrPageDeltaX(0)
-    , mLineOrPageDeltaY(0)
-    , mScrollType(SCROLL_DEFAULT)
-    , mOverflowDeltaX(0.0)
-    , mOverflowDeltaY(0.0)
     , mViewPortIsOverscrolled(false)
     , mCanTriggerSwipe(false)
     , mAllowToOverrideSystemScrollSpeed(false)
   {
   }
 
 public:
   virtual WidgetWheelEvent* AsWheelEvent() override { return this; }
 
   WidgetWheelEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eWheelEventClass)
     , mDeltaX(0.0)
     , mDeltaY(0.0)
     , mDeltaZ(0.0)
+    , mOverflowDeltaX(0.0)
+    , mOverflowDeltaY(0.0)
     , mDeltaMode(nsIDOMWheelEvent::DOM_DELTA_PIXEL)
+    , mLineOrPageDeltaX(0)
+    , mLineOrPageDeltaY(0)
+    , mScrollType(SCROLL_DEFAULT)
     , mCustomizedByUserPrefs(false)
     , mMayHaveMomentum(false)
     , mIsMomentum(false)
     , mIsNoLineOrPageDelta(false)
-    , mLineOrPageDeltaX(0)
-    , mLineOrPageDeltaY(0)
-    , mScrollType(SCROLL_DEFAULT)
-    , mOverflowDeltaX(0.0)
-    , mOverflowDeltaY(0.0)
     , mViewPortIsOverscrolled(false)
     , mCanTriggerSwipe(false)
     , mAllowToOverrideSystemScrollSpeed(true)
   {
   }
 
   virtual WidgetEvent* Duplicate() const override
   {
@@ -514,37 +514,31 @@ public:
   // NOTE: mDeltaX, mDeltaY and mDeltaZ may be customized by
   //       mousewheel.*.delta_multiplier_* prefs which are applied by
   //       EventStateManager.  So, after widget dispatches this event,
   //       these delta values may have different values than before.
   double mDeltaX;
   double mDeltaY;
   double mDeltaZ;
 
+  // overflowed delta values for scroll, these values are set by
+  // nsEventStateManger.  If the default action of the wheel event isn't scroll,
+  // these values always zero.  Otherwise, remaning delta values which are
+  // not used by scroll are set.
+  // NOTE: mDeltaX, mDeltaY and mDeltaZ may be modified by EventStateManager.
+  //       However, mOverflowDeltaX and mOverflowDeltaY indicate unused original
+  //       delta values which are not applied the delta_multiplier prefs.
+  //       So, if widget wanted to know the actual direction to be scrolled,
+  //       it would need to check the mDeltaX and mDeltaY.
+  double mOverflowDeltaX;
+  double mOverflowDeltaY;
+
   // Should be one of nsIDOMWheelEvent::DOM_DELTA_*
   uint32_t mDeltaMode;
 
-  // Following members are for internal use only, not for DOM event.
-
-  // If the delta values are computed from prefs, this value is true.
-  // Otherwise, i.e., they are computed from native events, false.
-  bool mCustomizedByUserPrefs;
-
-  // true if the momentum events directly tied to this event may follow it.
-  bool mMayHaveMomentum;
-  // true if the event is caused by momentum.
-  bool mIsMomentum;
-
-  // If device event handlers don't know when they should set mLineOrPageDeltaX
-  // and mLineOrPageDeltaY, this is true.  Otherwise, false.
-  // If mIsNoLineOrPageDelta is true, ESM will generate
-  // eLegacyMouseLineOrPageScroll events when accumulated delta values reach
-  // a line height.
-  bool mIsNoLineOrPageDelta;
-
   // If widget sets mLineOrPageDelta, EventStateManager will dispatch
   // eLegacyMouseLineOrPageScroll event for compatibility.  Note that the delta
   // value means pages if the mDeltaMode is DOM_DELTA_PAGE, otherwise, lines.
   int32_t mLineOrPageDeltaX;
   int32_t mLineOrPageDeltaY;
 
   // When the default action for an wheel event is moving history or zooming,
   // need to chose a delta value for doing it.
@@ -565,36 +559,40 @@ public:
     }
     return (Abs(mLineOrPageDeltaX) > Abs(mLineOrPageDeltaY)) ?
              mLineOrPageDeltaX : mLineOrPageDeltaY;
   }
 
   // Scroll type
   // The default value is SCROLL_DEFAULT, which means EventStateManager will
   // select preferred scroll type automatically.
-  enum ScrollType
+  enum ScrollType : uint8_t
   {
     SCROLL_DEFAULT,
     SCROLL_SYNCHRONOUSLY,
     SCROLL_ASYNCHRONOUSELY,
     SCROLL_SMOOTHLY
   };
   ScrollType mScrollType;
 
-  // overflowed delta values for scroll, these values are set by
-  // nsEventStateManger.  If the default action of the wheel event isn't scroll,
-  // these values always zero.  Otherwise, remaning delta values which are
-  // not used by scroll are set.
-  // NOTE: mDeltaX, mDeltaY and mDeltaZ may be modified by EventStateManager.
-  //       However, mOverflowDeltaX and mOverflowDeltaY indicate unused original
-  //       delta values which are not applied the delta_multiplier prefs.
-  //       So, if widget wanted to know the actual direction to be scrolled,
-  //       it would need to check the mDeltaX and mDeltaY.
-  double mOverflowDeltaX;
-  double mOverflowDeltaY;
+  // If the delta values are computed from prefs, this value is true.
+  // Otherwise, i.e., they are computed from native events, false.
+  bool mCustomizedByUserPrefs;
+
+  // true if the momentum events directly tied to this event may follow it.
+  bool mMayHaveMomentum;
+  // true if the event is caused by momentum.
+  bool mIsMomentum;
+
+  // If device event handlers don't know when they should set mLineOrPageDeltaX
+  // and mLineOrPageDeltaY, this is true.  Otherwise, false.
+  // If mIsNoLineOrPageDelta is true, ESM will generate
+  // eLegacyMouseLineOrPageScroll events when accumulated delta values reach
+  // a line height.
+  bool mIsNoLineOrPageDelta;
 
   // Whether or not the parent of the currently overscrolled frame is the
   // ViewPort. This is false in situations when an element on the page is being
   // overscrolled (such as a text field), but true when the 'page' is being
   // overscrolled.
   bool mViewPortIsOverscrolled;
 
   // The wheel event can trigger a swipe to start if it's overscrolling the
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -165,27 +165,27 @@ struct ParamTraits<mozilla::WidgetWheelE
     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<int32_t>(aParam.mScrollType));
+    WriteParam(aMsg, static_cast<uint8_t>(aParam.mScrollType));
     WriteParam(aMsg, aParam.mOverflowDeltaX);
     WriteParam(aMsg, aParam.mOverflowDeltaY);
     WriteParam(aMsg, aParam.mViewPortIsOverscrolled);
     WriteParam(aMsg, aParam.mCanTriggerSwipe);
     WriteParam(aMsg, aParam.mAllowToOverrideSystemScrollSpeed);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
-    int32_t scrollType = 0;
+    uint8_t scrollType = 0;
     bool rv =
       ReadParam(aMsg, aIter,
                 static_cast<mozilla::WidgetMouseEventBase*>(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) &&