Bug 1259661 part.1 Rename WidgetMouseEvent::reasonType to WidgetMouseEvent::Reason r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 12 May 2016 11:17:46 +0900
changeset 297100 76a7cdabdd506567e043db46163829786fd08732
parent 297099 52abfa1b62290859f78670b3fa33eaadfbfdd694
child 297101 80e5afeea2ce8b4c81d8099fac88f93b77836235
push id30251
push usercbook@mozilla.com
push dateThu, 12 May 2016 09:54:48 +0000
treeherdermozilla-central@c3f5e6079284 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1259661
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1259661 part.1 Rename WidgetMouseEvent::reasonType to WidgetMouseEvent::Reason r=smaug MozReview-Commit-ID: 3bx2Z32rwb1
widget/MouseEvents.h
widget/nsGUIEventIPC.h
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -176,17 +176,18 @@ public:
 
 class WidgetMouseEvent : public WidgetMouseEventBase, public WidgetPointerHelper
 {
 private:
   friend class mozilla::dom::PBrowserParent;
   friend class mozilla::dom::PBrowserChild;
 
 public:
-  enum reasonType
+  typedef bool ReasonType;
+  enum Reason : ReasonType
   {
     eReal,
     eSynthesized
   };
 
   enum contextType
   {
     eNormal,
@@ -196,42 +197,47 @@ public:
   enum exitType
   {
     eChild,
     eTopLevel
   };
 
 protected:
   WidgetMouseEvent()
-    : acceptActivation(false)
+    : reason(eReal)
+    , acceptActivation(false)
     , ignoreRootScrollFrame(false)
     , clickCount(0)
   {
   }
 
   WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
-                   EventClassID aEventClassID, reasonType aReason)
+                   EventClassID aEventClassID, Reason aReason)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
+    , reason(aReason)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
-    , reason(aReason)
     , context(eNormal)
     , exit(eChild)
     , clickCount(0)
   {
   }
 
 public:
   virtual WidgetMouseEvent* AsMouseEvent() override { return this; }
 
   WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
-                   reasonType aReason, contextType aContext = eNormal) :
-    WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass),
-    acceptActivation(false), ignoreRootScrollFrame(false),
-    reason(aReason), context(aContext), exit(eChild), clickCount(0)
+                   Reason aReason, contextType aContext = eNormal)
+    : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass)
+    , reason(aReason)
+    , acceptActivation(false)
+    , ignoreRootScrollFrame(false)
+    , context(aContext)
+    , exit(eChild)
+    , clickCount(0)
   {
     if (aMessage == eContextMenu) {
       button = (context == eNormal) ? eRightButton : eLeftButton;
     }
   }
 
 #ifdef DEBUG
   virtual ~WidgetMouseEvent()
@@ -250,23 +256,24 @@ public:
     // Not copying widget, it is a weak reference.
     WidgetMouseEvent* result =
       new WidgetMouseEvent(false, mMessage, nullptr, reason, context);
     result->AssignMouseEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
+  Reason reason;
+
   // Special return code for MOUSE_ACTIVATE to signal.
   // If the target accepts activation (1), or denies it (0).
   bool acceptActivation;
   // Whether the event should ignore scroll frame bounds during dispatch.
   bool ignoreRootScrollFrame;
 
-  reasonType reason : 4;
   contextType context : 4;
   exitType exit;
 
   /// The number of mouse clicks.
   uint32_t clickCount;
 
   void AssignMouseEventData(const WidgetMouseEvent& aEvent, bool aCopyTargets)
   {
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -226,35 +226,35 @@ template<>
 struct ParamTraits<mozilla::WidgetMouseEvent>
 {
   typedef mozilla::WidgetMouseEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
     WriteParam(aMsg, aParam.ignoreRootScrollFrame);
-    WriteParam(aMsg, (uint8_t) aParam.reason);
+    WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.reason));
     WriteParam(aMsg, (uint8_t) aParam.context);
     WriteParam(aMsg, (uint8_t) aParam.exit);
     WriteParam(aMsg, aParam.clickCount);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     bool rv;
-    uint8_t reason = 0, context = 0, exit = 0;
+    paramType::ReasonType reason = 0;
+    uint8_t context = 0, exit = 0;
     rv = ReadParam(aMsg, aIter,
                    static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
          ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) &&
          ReadParam(aMsg, aIter, &reason) &&
          ReadParam(aMsg, aIter, &context) &&
          ReadParam(aMsg, aIter, &exit) &&
          ReadParam(aMsg, aIter, &aResult->clickCount);
-    aResult->reason =
-      static_cast<mozilla::WidgetMouseEvent::reasonType>(reason);
+    aResult->reason = static_cast<paramType::Reason>(reason);
     aResult->context =
       static_cast<mozilla::WidgetMouseEvent::contextType>(context);
     aResult->exit = static_cast<mozilla::WidgetMouseEvent::exitType>(exit);
     return rv;
   }
 };