Bug 1259661 part.5 Rename WidgetMouseEvent::context to WidgetMouseEvent::mContextMenuTrigger r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 12 May 2016 11:39:05 +0900
changeset 297105 6cea19d36ac6fe24b0875b1728db12c8039d9283
parent 297104 80d48f73aa2e825d7a48a23b8dfcf0fc7afdf585
child 297106 458adc3eac60184d6283df861c705ece908a85b6
push id19195
push usercbook@mozilla.com
push dateThu, 12 May 2016 09:58:44 +0000
treeherderfx-team@6e3f70253ead [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1259661
milestone49.0a1
Bug 1259661 part.5 Rename WidgetMouseEvent::context to WidgetMouseEvent::mContextMenuTrigger r=smaug MozReview-Commit-ID: GDAAHiyRrhY
layout/base/nsPresShell.cpp
widget/MouseEvents.h
widget/nsGUIEventIPC.h
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -8351,17 +8351,17 @@ PresShell::HandleEventInternal(WidgetEve
                                         touchIsNew, isHandlingUserInput,
                                         mCurrentEventContent)) {
         return NS_OK;
       }
     }
 
     if (aEvent->mMessage == eContextMenu) {
       WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
-      if (mouseEvent->context == WidgetMouseEvent::eContextMenuKey &&
+      if (mouseEvent->IsContextMenuKeyEvent() &&
           !AdjustContextMenuKeyEvent(mouseEvent)) {
         return NS_OK;
       }
       if (mouseEvent->IsShift()) {
         aEvent->mFlags.mOnlyChromeDispatch = true;
         aEvent->mFlags.mRetargetToNonNativeAnonymous = true;
       }
     }
@@ -10023,17 +10023,17 @@ PresShell::DelayedInputEvent::Dispatch()
 PresShell::DelayedMouseEvent::DelayedMouseEvent(WidgetMouseEvent* aEvent) :
   DelayedInputEvent()
 {
   WidgetMouseEvent* mouseEvent =
     new WidgetMouseEvent(aEvent->IsTrusted(),
                          aEvent->mMessage,
                          aEvent->mWidget,
                          aEvent->mReason,
-                         aEvent->context);
+                         aEvent->mContextMenuTrigger);
   mouseEvent->AssignMouseEventData(*aEvent, false);
   mEvent = mouseEvent;
 }
 
 PresShell::DelayedKeyEvent::DelayedKeyEvent(WidgetKeyboardEvent* aEvent) :
   DelayedInputEvent()
 {
   WidgetKeyboardEvent* keyEvent =
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -200,79 +200,84 @@ public:
   {
     eChild,
     eTopLevel
   };
 
 protected:
   WidgetMouseEvent()
     : mReason(eReal)
-    , context(eNormal)
+    , mContextMenuTrigger(eNormal)
     , exit(eChild)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
     , clickCount(0)
   {
   }
 
   WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
                    EventClassID aEventClassID, Reason aReason)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
     , mReason(aReason)
-    , context(eNormal)
+    , mContextMenuTrigger(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)
+  WidgetMouseEvent(bool aIsTrusted,
+                   EventMessage aMessage,
+                   nsIWidget* aWidget,
+                   Reason aReason,
+                   ContextMenuTrigger aContextMenuTrigger = eNormal)
     : WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass)
     , mReason(aReason)
-    , context(aContext)
+    , mContextMenuTrigger(aContextMenuTrigger)
     , exit(eChild)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
     , clickCount(0)
   {
     if (aMessage == eContextMenu) {
-      button = (context == eNormal) ? eRightButton : eLeftButton;
+      button = (mContextMenuTrigger == eNormal) ? eRightButton : eLeftButton;
     }
   }
 
 #ifdef DEBUG
   virtual ~WidgetMouseEvent()
   {
     NS_WARN_IF_FALSE(mMessage != eContextMenu ||
                      button ==
-                       ((context == eNormal) ? eRightButton : eLeftButton),
+                       ((mContextMenuTrigger == eNormal) ? eRightButton :
+                                                           eLeftButton),
                      "Wrong button set to eContextMenu event?");
   }
 #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, mReason, context);
+      new WidgetMouseEvent(false, mMessage, nullptr,
+                           mReason, mContextMenuTrigger);
     result->AssignMouseEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
   Reason mReason;
 
-  ContextMenuTrigger context;
+  ContextMenuTrigger mContextMenuTrigger;
 
   ExitFrom exit;
 
   // 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;
@@ -290,17 +295,17 @@ public:
     clickCount = aEvent.clickCount;
   }
 
   /**
    * Returns true if the event is a context menu event caused by key.
    */
   bool IsContextMenuKeyEvent() const
   {
-    return mMessage == eContextMenu && context == eContextMenuKey;
+    return mMessage == eContextMenu && mContextMenuTrigger == eContextMenuKey;
   }
 
   /**
    * 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
   {
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -227,18 +227,18 @@ struct ParamTraits<mozilla::WidgetMouseE
 {
   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.mReason));
-    WriteParam(aMsg,
-               static_cast<paramType::ContextMenuTriggerType>(aParam.context));
+    WriteParam(aMsg, static_cast<paramType::ContextMenuTriggerType>(
+                       aParam.mContextMenuTrigger));
     WriteParam(aMsg, static_cast<paramType::ExitFromType>(aParam.exit));
     WriteParam(aMsg, aParam.clickCount);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     bool rv;
     paramType::ReasonType reason = 0;
@@ -247,17 +247,17 @@ struct ParamTraits<mozilla::WidgetMouseE
     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->mReason = static_cast<paramType::Reason>(reason);
-    aResult->context =
+    aResult->mContextMenuTrigger =
       static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
     aResult->exit = static_cast<paramType::ExitFrom>(exitFrom);
     return rv;
   }
 };
 
 
 template<>