Bug 1259661 part.4 Rename WidgetMouseEvent::reason to WidgetMouseEvent::mReason r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 10 May 2016 20:20:29 +0900
changeset 365624 1ccdefe3407f0a3c5b1f1f2013192de982603793
parent 365623 7d75ac722f28b3967e3de0d239759ba5a871d4e6
child 365625 d35362fd38d9ad9d4fd9f5a5f4f207302c1a57f8
push id17801
push usermasayuki@d-toybox.com
push dateWed, 11 May 2016 05:50:15 +0000
reviewerssmaug
bugs1259661
milestone49.0a1
Bug 1259661 part.4 Rename WidgetMouseEvent::reason to WidgetMouseEvent::mReason r?smaug MozReview-Commit-ID: JaE0S7BIgVF
dom/events/EventStateManager.cpp
dom/events/MouseEvent.cpp
dom/ipc/TabParent.cpp
layout/base/nsPresShell.cpp
view/nsViewManager.cpp
widget/MouseEvents.h
widget/WidgetEventImpl.cpp
widget/nsGUIEventIPC.h
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -667,17 +667,17 @@ EventStateManager::PreHandleEvent(nsPres
     // If the event is not a top-level window exit, then it's not
     // really an exit --- we may have traversed widget boundaries but
     // we're still in our toplevel window.
     if (mouseEvent->exit != WidgetMouseEvent::eTopLevel) {
       // Treat it as a synthetic move so we don't generate spurious
       // "exit" or "move" events.  Any necessary "out" or "over" events
       // will be generated by GenerateMouseEnterExit
       mouseEvent->mMessage = eMouseMove;
-      mouseEvent->reason = WidgetMouseEvent::eSynthesized;
+      mouseEvent->mReason = WidgetMouseEvent::eSynthesized;
       // then fall through...
     } else {
       if (sPointerEventEnabled) {
         // We should synthetize corresponding pointer events
         GeneratePointerEnterExit(ePointerLeave, mouseEvent);
       }
       GenerateMouseEnterExit(mouseEvent);
       //This is a window level mouse exit event and should stop here
--- a/dom/events/MouseEvent.cpp
+++ b/dom/events/MouseEvent.cpp
@@ -32,17 +32,17 @@ MouseEvent::MouseEvent(EventTarget* aOwn
   else {
     mEventIsInternal = true;
     mEvent->mTime = PR_Now();
     mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
     mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
   }
 
   if (mouseEvent) {
-    MOZ_ASSERT(mouseEvent->reason != WidgetMouseEvent::eSynthesized,
+    MOZ_ASSERT(mouseEvent->mReason != WidgetMouseEvent::eSynthesized,
                "Don't dispatch DOM events from synthesized mouse events");
     mDetail = mouseEvent->clickCount;
   }
 }
 
 NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
 NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1186,17 +1186,17 @@ bool TabParent::SendRealMouseEvent(Widge
     }
   }
 
   ScrollableLayerGuid guid;
   uint64_t blockId;
   ApzAwareEventRoutingToChild(&guid, &blockId, nullptr);
 
   if (eMouseMove == event.mMessage) {
-    if (event.reason == WidgetMouseEvent::eSynthesized) {
+    if (event.mReason == WidgetMouseEvent::eSynthesized) {
       return SendSynthMouseMoveEvent(event, guid, blockId);
     } else {
       return SendRealMouseMoveEvent(event, guid, blockId);
     }
   }
 
   return SendRealMouseButtonEvent(event, guid, blockId);
 }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6786,17 +6786,17 @@ PresShell::RecordMouseLocation(WidgetGUI
     PresShell* rootPresShell = GetRootPresShell();
     if (rootPresShell) {
       rootPresShell->RecordMouseLocation(aEvent);
     }
     return;
   }
 
   if ((aEvent->mMessage == eMouseMove &&
-       aEvent->AsMouseEvent()->reason == WidgetMouseEvent::eReal) ||
+       aEvent->AsMouseEvent()->mReason == WidgetMouseEvent::eReal) ||
       aEvent->mMessage == eMouseEnterIntoWidget ||
       aEvent->mMessage == eMouseDown ||
       aEvent->mMessage == eMouseUp) {
     nsIFrame* rootFrame = GetRootFrame();
     if (!rootFrame) {
       nsView* rootView = mViewManager->GetRootView();
       mMouseLocation = nsLayoutUtils::TranslateWidgetToView(mPresContext,
         aEvent->mWidget, aEvent->mRefPoint, rootView);
@@ -9857,17 +9857,17 @@ PresShell::DelayedInputEvent::Dispatch()
 
 PresShell::DelayedMouseEvent::DelayedMouseEvent(WidgetMouseEvent* aEvent) :
   DelayedInputEvent()
 {
   WidgetMouseEvent* mouseEvent =
     new WidgetMouseEvent(aEvent->IsTrusted(),
                          aEvent->mMessage,
                          aEvent->mWidget,
-                         aEvent->reason,
+                         aEvent->mReason,
                          aEvent->context);
   mouseEvent->AssignMouseEventData(*aEvent, false);
   mEvent = mouseEvent;
 }
 
 PresShell::DelayedKeyEvent::DelayedKeyEvent(WidgetKeyboardEvent* aEvent) :
   DelayedInputEvent()
 {
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -762,17 +762,17 @@ nsViewManager::DispatchEvent(WidgetGUIEv
                              nsEventStatus* aStatus)
 {
   PROFILER_LABEL("nsViewManager", "DispatchEvent",
     js::ProfileEntry::Category::EVENTS);
 
   WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
   if ((mouseEvent &&
        // Ignore mouse events that we synthesize.
-       mouseEvent->reason == WidgetMouseEvent::eReal &&
+       mouseEvent->mReason == WidgetMouseEvent::eReal &&
        // Ignore mouse exit and enter (we'll get moves if the user
        // is really moving the mouse) since we get them when we
        // create and destroy widgets.
        mouseEvent->mMessage != eMouseExitFromWidget &&
        mouseEvent->mMessage != eMouseEnterIntoWidget) ||
       aEvent->HasKeyEventMessage() ||
       aEvent->HasIMEEventMessage() ||
       aEvent->mMessage == ePluginInputEvent) {
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -199,42 +199,42 @@ public:
   enum ExitFrom : ExitFromType
   {
     eChild,
     eTopLevel
   };
 
 protected:
   WidgetMouseEvent()
-    : reason(eSynthesized)
+    : mReason(eSynthesized)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
     , clickCount(0)
   {
   }
 
   WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
                    EventClassID aEventClassID, Reason aReason)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
-    , reason(aReason)
+    , mReason(aReason)
     , context(eNormal)
     , exit(eChild)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
     , clickCount(0)
   {
   }
 
 public:
   virtual WidgetMouseEvent* AsMouseEvent() override { return this; }
 
   WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
                    Reason aReason, ContextMenuTrigger aContext = eNormal)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass)
-    , reason(aReason)
+    , mReason(aReason)
     , context(aContext)
     , exit(eChild)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
     , clickCount(0)
   {
     if (aMessage == eContextMenu) {
       button = (context == eNormal) ? eRightButton : eLeftButton;
@@ -252,23 +252,23 @@ public:
 #endif
 
   virtual WidgetEvent* Duplicate() const override
   {
     MOZ_ASSERT(mClass == eMouseEventClass,
                "Duplicate() must be overridden by sub class");
     // Not copying widget, it is a weak reference.
     WidgetMouseEvent* result =
-      new WidgetMouseEvent(false, mMessage, nullptr, reason, context);
+      new WidgetMouseEvent(false, mMessage, nullptr, mReason, context);
     result->AssignMouseEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
-  Reason reason;
+  Reason mReason;
 
   ContextMenuTrigger context;
 
   ExitFrom exit;
 
   // Special return code for MOUSE_ACTIVATE to signal.
   // If the target accepts activation (1), or denies it (0).
   bool acceptActivation;
@@ -297,17 +297,17 @@ public:
   }
 
   /**
    * Returns true if the event is a real mouse event.  Otherwise, i.e., it's
    * a synthesized event by scroll or something, returns false.
    */
   bool IsReal() const
   {
-    return reason == eReal;
+    return mReason == eReal;
   }
 };
 
 /******************************************************************************
  * mozilla::WidgetDragEvent
  ******************************************************************************/
 
 class WidgetDragEvent : public WidgetMouseEvent
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -268,17 +268,17 @@ WidgetEvent::IsAllowedToDispatchDOMEvent
   switch (mClass) {
     case eMouseEventClass:
     case ePointerEventClass:
       // We want synthesized mouse moves to cause mouseover and mouseout
       // DOM events (EventStateManager::PreHandleEvent), but not mousemove
       // DOM events.
       // Synthesized button up events also do not cause DOM events because they
       // do not have a reliable mRefPoint.
-      return AsMouseEvent()->reason == WidgetMouseEvent::eReal;
+      return AsMouseEvent()->mReason == WidgetMouseEvent::eReal;
 
     case eWheelEventClass: {
       // wheel event whose all delta values are zero by user pref applied, it
       // shouldn't cause a DOM event.
       const WidgetWheelEvent* wheelEvent = AsWheelEvent();
       return wheelEvent->mDeltaX != 0.0 || wheelEvent->mDeltaY != 0.0 ||
              wheelEvent->mDeltaZ != 0.0;
     }
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -226,17 +226,17 @@ 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, static_cast<paramType::ReasonType>(aParam.reason));
+    WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.mReason));
     WriteParam(aMsg,
                static_cast<paramType::ContextMenuTriggerType>(aParam.context));
     WriteParam(aMsg, static_cast<paramType::ExitFromType>(aParam.exit));
     WriteParam(aMsg, aParam.clickCount);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
@@ -246,17 +246,17 @@ struct ParamTraits<mozilla::WidgetMouseE
     paramType::ExitFromType exitFrom = 0;
     rv = ReadParam(aMsg, aIter,
                    static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
          ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) &&
          ReadParam(aMsg, aIter, &reason) &&
          ReadParam(aMsg, aIter, &contextMenuTrigger) &&
          ReadParam(aMsg, aIter, &exitFrom) &&
          ReadParam(aMsg, aIter, &aResult->clickCount);
-    aResult->reason = static_cast<paramType::Reason>(reason);
+    aResult->mReason = static_cast<paramType::Reason>(reason);
     aResult->context =
       static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
     aResult->exit = static_cast<paramType::ExitFrom>(exitFrom);
     return rv;
   }
 };