Bug 1259661 part.3 Rename WidgetMouseEvent::exitType to WidgetMouseEvent::ExitFrom r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 12 May 2016 11:32:53 +0900
changeset 366155 a509a4fe8440b6744de28591ad02a0b2bc8d93ff
parent 366154 cbfe714cba78cbb088ae5295c910efe12eac98f7
child 366156 cb14db1412e0910e51c3e7f35ff81ff22cf47a82
push id17909
push usermasayuki@d-toybox.com
push dateThu, 12 May 2016 03:02:36 +0000
reviewerssmaug
bugs1259661
milestone49.0a1
Bug 1259661 part.3 Rename WidgetMouseEvent::exitType to WidgetMouseEvent::ExitFrom r?smaug MozReview-Commit-ID: 8NdDccCrTS7
widget/MouseEvents.h
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/nsGUIEventIPC.h
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -190,55 +190,57 @@ public:
 
   typedef bool ContextMenuTriggerType;
   enum ContextMenuTrigger : ContextMenuTriggerType
   {
     eNormal,
     eContextMenuKey
   };
 
-  enum exitType
+  typedef bool ExitFromType;
+  enum ExitFrom : ExitFromType
   {
     eChild,
     eTopLevel
   };
 
 protected:
   WidgetMouseEvent()
     : reason(eReal)
     , context(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)
     , reason(aReason)
     , context(eNormal)
+    , exit(eChild)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
-    , exit(eChild)
     , 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)
     , context(aContext)
+    , exit(eChild)
     , acceptActivation(false)
     , ignoreRootScrollFrame(false)
-    , exit(eChild)
     , clickCount(0)
   {
     if (aMessage == eContextMenu) {
       button = (context == eNormal) ? eRightButton : eLeftButton;
     }
   }
 
 #ifdef DEBUG
@@ -262,24 +264,24 @@ public:
     result->mFlags = mFlags;
     return result;
   }
 
   Reason reason;
 
   ContextMenuTrigger context;
 
+  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;
 
-  exitType exit;
-
   /// The number of mouse clicks.
   uint32_t clickCount;
 
   void AssignMouseEventData(const WidgetMouseEvent& aEvent, bool aCopyTargets)
   {
     AssignMouseEventBaseData(aEvent, aCopyTargets);
     AssignPointerHelperData(aEvent);
 
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -266,17 +266,17 @@ typedef NSInteger NSEventGestureAxis;
 - (void)delayedTearDown;
 
 - (void)sendFocusEvent:(mozilla::EventMessage)eventMessage;
 
 - (void)handleMouseMoved:(NSEvent*)aEvent;
 
 - (void)sendMouseEnterOrExitEvent:(NSEvent*)aEvent
                             enter:(BOOL)aEnter
-                             type:(mozilla::WidgetMouseEvent::exitType)aType;
+                         exitFrom:(mozilla::WidgetMouseEvent::ExitFrom)aExitFrom;
 
 - (void)updateGLContext;
 - (void)_surfaceNeedsUpdate:(NSNotification*)notification;
 
 - (void)setGLContext:(NSOpenGLContext *)aGLContext;
 - (bool)preRender:(NSOpenGLContext *)aGLContext;
 - (void)postRender:(NSOpenGLContext *)aGLContext;
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4585,29 +4585,29 @@ NSEvent* gLastDragMouseDownEvent = nil;
     }
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)sendMouseEnterOrExitEvent:(NSEvent*)aEvent
                             enter:(BOOL)aEnter
-                             type:(WidgetMouseEvent::exitType)aType
+                         exitFrom:(WidgetMouseEvent::ExitFrom)aExitFrom
 {
   if (!mGeckoChild)
     return;
 
   NSPoint windowEventLocation = nsCocoaUtils::EventLocationForWindow(aEvent, [self window]);
   NSPoint localEventLocation = [self convertPoint:windowEventLocation fromView:nil];
 
   EventMessage msg = aEnter ? eMouseEnterIntoWidget : eMouseExitFromWidget;
   WidgetMouseEvent event(true, msg, mGeckoChild, WidgetMouseEvent::eReal);
   event.mRefPoint = mGeckoChild->CocoaPointsToDevPixels(localEventLocation);
 
-  event.exit = aType;
+  event.exit = aExitFrom;
 
   nsEventStatus status; // ignored
   mGeckoChild->DispatchEvent(&event, status);
 }
 
 - (void)updateWindowDraggableState
 {
   // Trigger update to the window server.
@@ -6321,25 +6321,29 @@ ChildViewMouseTracker::MouseExitedWindow
 
 void
 ChildViewMouseTracker::ReEvaluateMouseEnterState(NSEvent* aEvent, ChildView* aOldView)
 {
   ChildView* oldView = aOldView ? aOldView : sLastMouseEventView;
   sLastMouseEventView = ViewForEvent(aEvent);
   if (sLastMouseEventView != oldView) {
     // Send enter and / or exit events.
-    WidgetMouseEvent::exitType type =
+    WidgetMouseEvent::ExitFrom exitFrom =
       [sLastMouseEventView window] == [oldView window] ?
         WidgetMouseEvent::eChild : WidgetMouseEvent::eTopLevel;
-    [oldView sendMouseEnterOrExitEvent:aEvent enter:NO type:type];
+    [oldView sendMouseEnterOrExitEvent:aEvent
+                                 enter:NO
+                              exitFrom:exitFrom];
     // After the cursor exits the window set it to a visible regular arrow cursor.
     if (type == WidgetMouseEvent::eTopLevel) {
       [[nsCursorManager sharedInstance] setCursor:eCursor_standard];
     }
-    [sLastMouseEventView sendMouseEnterOrExitEvent:aEvent enter:YES type:type];
+    [sLastMouseEventView sendMouseEnterOrExitEvent:aEvent
+                                             enter:YES
+                                          exitFrom:exitFrom];
   }
 }
 
 void
 ChildViewMouseTracker::ResendLastMouseMoveEvent()
 {
   if (sLastMouseMoveEvent) {
     MouseMoved(sLastMouseMoveEvent);
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -229,37 +229,37 @@ struct ParamTraits<mozilla::WidgetMouseE
 
   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::ContextMenuTriggerType>(aParam.context));
-    WriteParam(aMsg, (uint8_t) aParam.exit);
+    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;
     paramType::ContextMenuTriggerType contextMenuTrigger = 0;
-    uint8_t exit = 0;
+    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, &exit) &&
+         ReadParam(aMsg, aIter, &exitFrom) &&
          ReadParam(aMsg, aIter, &aResult->clickCount);
     aResult->reason = static_cast<paramType::Reason>(reason);
     aResult->context =
       static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
-    aResult->exit = static_cast<mozilla::WidgetMouseEvent::exitType>(exit);
+    aResult->exit = static_cast<paramType::ExitFrom>(exitFrom);
     return rv;
   }
 };
 
 
 template<>
 struct ParamTraits<mozilla::WidgetDragEvent>
 {