Bug 1259661 part.5 Rename WidgetMouseEvent::context to WidgetMouseEvent::mContextMenuTrigger r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 12 May 2016 11:39:05 +0900
changeset 366157 4666eacd16bb69ab50a388d2e70960da5d643e4b
parent 366156 cb14db1412e0910e51c3e7f35ff81ff22cf47a82
child 366158 a190a79bc0100ad9818826a33cfdd6d79cea6736
push id17909
push usermasayuki@d-toybox.com
push dateThu, 12 May 2016 03:02:36 +0000
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
@@ -8185,17 +8185,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;
       }
     }
@@ -9858,17 +9858,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<>