Bug 920377 part.15 Get rid of nsGestureNotifyEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 27 Sep 2013 15:20:57 +0900
changeset 162774 bbdaf3ec9aae2796d5b555bbf9d48b623cb306ce
parent 162773 46cb542ac785b1777452baaaa771f1a08b8642e8
child 162775 f8b7e4858ddd28643b69da9bcdbae429f6363f2d
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs920377
milestone27.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 920377 part.15 Get rid of nsGestureNotifyEvent r=roc
content/events/src/nsEventStateManager.cpp
content/events/src/nsEventStateManager.h
widget/EventForwards.h
widget/TouchEvents.h
widget/qt/nsWindow.cpp
widget/windows/nsWinGesture.cpp
widget/windows/nsWinGesture.h
widget/windows/nsWindow.cpp
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -2804,17 +2804,17 @@ nsEventStateManager::DoScrollText(nsIScr
   NS_ASSERTION(aEvent->overflowDeltaY == 0 ||
     (aEvent->overflowDeltaY > 0) == (aEvent->deltaY > 0),
     "The sign of overflowDeltaY is different from the scroll direction");
 
   WheelPrefs::GetInstance()->CancelApplyingUserPrefsFromOverflowDelta(aEvent);
 }
 
 void
-nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent,
+nsEventStateManager::DecideGestureEvent(WidgetGestureNotifyEvent* aEvent,
                                         nsIFrame* targetFrame)
 {
 
   NS_ASSERTION(aEvent->message == NS_GESTURENOTIFY_EVENT_START,
                "DecideGestureEvent called with a non-gesture event");
 
   /* Check the ancestor tree to decide if any frame is willing* to receive
    * a MozPixelScroll event. If that's the case, the current touch gesture
@@ -2823,38 +2823,39 @@ nsEventStateManager::DecideGestureEvent(
    *
    * *willing: determine if it makes sense to pan the element using scroll events:
    *  - For web content: if there are any visible scrollbars on the touch point
    *  - For XUL: if it's an scrollable element that can currently scroll in some
     *    direction.
    *
    * Note: we'll have to one-off various cases to ensure a good usable behavior
    */
-  nsGestureNotifyEvent::ePanDirection panDirection = nsGestureNotifyEvent::ePanNone;
+  WidgetGestureNotifyEvent::ePanDirection panDirection =
+    WidgetGestureNotifyEvent::ePanNone;
   bool displayPanFeedback = false;
   for (nsIFrame* current = targetFrame; current;
        current = nsLayoutUtils::GetCrossDocParentFrame(current)) {
 
     nsIAtom* currentFrameType = current->GetType();
 
     // Scrollbars should always be draggable
     if (currentFrameType == nsGkAtoms::scrollbarFrame) {
-      panDirection = nsGestureNotifyEvent::ePanNone;
+      panDirection = WidgetGestureNotifyEvent::ePanNone;
       break;
     }
 
 #ifdef MOZ_XUL
     // Special check for trees
     nsTreeBodyFrame* treeFrame = do_QueryFrame(current);
     if (treeFrame) {
       if (treeFrame->GetHorizontalOverflow()) {
-        panDirection = nsGestureNotifyEvent::ePanHorizontal;
+        panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
       }
       if (treeFrame->GetVerticalOverflow()) {
-        panDirection = nsGestureNotifyEvent::ePanVertical;
+        panDirection = WidgetGestureNotifyEvent::ePanVertical;
       }
       break;
     }
 #endif
 
     nsIScrollableFrame* scrollableFrame = do_QueryFrame(current);
     if (scrollableFrame) {
       if (current->IsFrameOfType(nsIFrame::eXULBox)) {
@@ -2868,36 +2869,36 @@ nsEventStateManager::DecideGestureEvent(
           // and we don't want that
           canScrollHorizontally = false;
           displayPanFeedback = false;
         }
 
         // Vertical panning has priority over horizontal panning, so
         // when vertical movement is possible we can just finish the loop.
         if (scrollRange.height > 0) {
-          panDirection = nsGestureNotifyEvent::ePanVertical;
+          panDirection = WidgetGestureNotifyEvent::ePanVertical;
           break;
         }
 
         if (canScrollHorizontally) {
-          panDirection = nsGestureNotifyEvent::ePanHorizontal;
+          panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
           displayPanFeedback = false;
         }
       } else { //Not a XUL box
         uint32_t scrollbarVisibility = scrollableFrame->GetScrollbarVisibility();
 
         //Check if we have visible scrollbars
         if (scrollbarVisibility & nsIScrollableFrame::VERTICAL) {
-          panDirection = nsGestureNotifyEvent::ePanVertical;
+          panDirection = WidgetGestureNotifyEvent::ePanVertical;
           displayPanFeedback = true;
           break;
         }
 
         if (scrollbarVisibility & nsIScrollableFrame::HORIZONTAL) {
-          panDirection = nsGestureNotifyEvent::ePanHorizontal;
+          panDirection = WidgetGestureNotifyEvent::ePanHorizontal;
           displayPanFeedback = true;
         }
       }
     } //scrollableFrame
   } //ancestor chain
 
   aEvent->displayPanFeedback = displayPanFeedback;
   aEvent->panDirection = panDirection;
@@ -3217,17 +3218,18 @@ nsEventStateManager::PostHandleEvent(nsP
       }
       *aStatus = nsEventStatus_eConsumeNoDefault;
     }
     break;
 
   case NS_GESTURENOTIFY_EVENT_START:
     {
       if (nsEventStatus_eConsumeNoDefault != *aStatus)
-        DecideGestureEvent(static_cast<nsGestureNotifyEvent*>(aEvent), mCurrentTarget);
+        DecideGestureEvent(static_cast<WidgetGestureNotifyEvent*>(aEvent),
+                           mCurrentTarget);
     }
     break;
 
   case NS_DRAGDROP_ENTER:
   case NS_DRAGDROP_OVER:
     {
       NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "Expected a drag event");
 
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -650,17 +650,18 @@ protected:
   /*
    * When a touch gesture is about to start, this function determines what
    * kind of gesture interaction we will want to use, based on what is
    * underneath the initial touch point.
    * Currently it decides between panning (finger scrolling) or dragging
    * the target element, as well as the orientation to trigger panning and
    * display visual boundary feedback. The decision is stored back in aEvent.
    */
-  void DecideGestureEvent(nsGestureNotifyEvent* aEvent, nsIFrame* targetFrame);
+  void DecideGestureEvent(mozilla::WidgetGestureNotifyEvent* aEvent,
+                          nsIFrame* targetFrame);
 
   // routines for the d&d gesture tracking state machine
   void BeginTrackingDragGesture ( nsPresContext* aPresContext, nsMouseEvent* inDownEvent,
                                   nsIFrame* inDownFrame ) ;
   void StopTrackingDragGesture ( ) ;
   void GenerateDragGesture ( nsPresContext* aPresContext, nsMouseEvent *aEvent ) ;
 
   /**
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -120,11 +120,9 @@ typedef mozilla::WidgetMouseEventBase   
 typedef mozilla::WidgetMouseEvent          nsMouseEvent;
 typedef mozilla::WidgetDragEvent           nsDragEvent;
 typedef mozilla::WidgetMouseScrollEvent    nsMouseScrollEvent;
 
 namespace mozilla {
 typedef WidgetWheelEvent                   WheelEvent;
 }
 
-typedef mozilla::WidgetGestureNotifyEvent  nsGestureNotifyEvent;
-
 #endif // mozilla_EventForwards_h__
--- a/widget/TouchEvents.h
+++ b/widget/TouchEvents.h
@@ -146,12 +146,9 @@ public:
     AssignInputEventData(aEvent, aCopyTargets);
 
     // Currently, we don't need to copy touches.
   }
 };
 
 } // namespace mozilla
 
-// TODO: Remove following typedefs
-typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
-
 #endif // mozilla_TouchEvents_h__
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1968,17 +1968,18 @@ nsEventStatus nsWindow::OnTouchEvent(QTo
 {
     handled = false;
     const QList<QTouchEvent::TouchPoint> &touchPoints = event->touchPoints();
 
     if (event->type() == QEvent::TouchBegin) {
         handled = true;
         for (int i = touchPoints.count() -1; i >= 0; i--) {
             QPointF fpos = touchPoints[i].pos();
-            nsGestureNotifyEvent gestureNotifyEvent(true, NS_GESTURENOTIFY_EVENT_START, this);
+            WidgetGestureNotifyEvent gestureNotifyEvent(true,
+                                         NS_GESTURENOTIFY_EVENT_START, this);
             gestureNotifyEvent.refPoint = LayoutDeviceIntPoint(fpos.x(), fpos.y());
             DispatchEvent(&gestureNotifyEvent);
         }
     }
     else if (event->type() == QEvent::TouchEnd) {
         mGesturesCancelled = false;
         mPinchEvent.needDispatch = false;
     }
--- a/widget/windows/nsWinGesture.cpp
+++ b/widget/windows/nsWinGesture.cpp
@@ -114,17 +114,18 @@ bool nsWinGesture::InitLibrary()
   gEnableSingleFingerPanEvents =
     Preferences::GetBool("gestures.enable_single_finger_input", false);
 
   return true;
 }
 
 #define GCOUNT 5
 
-bool nsWinGesture::SetWinGestureSupport(HWND hWnd, nsGestureNotifyEvent::ePanDirection aDirection)
+bool nsWinGesture::SetWinGestureSupport(HWND hWnd,
+                     WidgetGestureNotifyEvent::ePanDirection aDirection)
 {
   if (!getGestureInfo)
     return false;
 
   GESTURECONFIG config[GCOUNT];
 
   memset(&config, 0, sizeof(config));
 
@@ -139,25 +140,25 @@ bool nsWinGesture::SetWinGestureSupport(
   config[2].dwID = GID_PAN;
   config[2].dwWant  = GC_PAN|GC_PAN_WITH_INERTIA|
                       GC_PAN_WITH_GUTTER;
   config[2].dwBlock = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY|
                       GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
 
   if (gEnableSingleFingerPanEvents) {
 
-    if (aDirection == nsGestureNotifyEvent::ePanVertical ||
-        aDirection == nsGestureNotifyEvent::ePanBoth)
+    if (aDirection == WidgetGestureNotifyEvent::ePanVertical ||
+        aDirection == WidgetGestureNotifyEvent::ePanBoth)
     {
       config[2].dwWant  |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
       config[2].dwBlock -= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
     }
 
-    if (aDirection == nsGestureNotifyEvent::ePanHorizontal ||
-        aDirection == nsGestureNotifyEvent::ePanBoth)
+    if (aDirection == WidgetGestureNotifyEvent::ePanHorizontal ||
+        aDirection == WidgetGestureNotifyEvent::ePanBoth)
     {
       config[2].dwWant  |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
       config[2].dwBlock -= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
     }
 
   }
 
   config[3].dwWant = GC_TWOFINGERTAP;
--- a/widget/windows/nsWinGesture.h
+++ b/widget/windows/nsWinGesture.h
@@ -193,17 +193,17 @@ public:
 };
 
 class nsWinGesture
 {
 public:
   nsWinGesture();
 
 public:
-  bool SetWinGestureSupport(HWND hWnd, nsGestureNotifyEvent::ePanDirection aDirection);
+  bool SetWinGestureSupport(HWND hWnd, mozilla::WidgetGestureNotifyEvent::ePanDirection aDirection);
   bool ShutdownWinGestureSupport();
   bool RegisterTouchWindow(HWND hWnd);
   bool UnregisterTouchWindow(HWND hWnd);
   bool GetTouchInputInfo(HTOUCHINPUT hTouchInput, uint32_t cInputs, PTOUCHINPUT pInputs);
   bool CloseTouchInputHandle(HTOUCHINPUT hTouchInput);
   bool IsAvailable();
   
   // Simple gesture process
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5338,17 +5338,18 @@ nsWindow::ProcessMessage(UINT msg, WPARA
           mWindowType != eWindowType_plugin) {
         // A GestureNotify event is dispatched to decide which single-finger panning
         // direction should be active (including none) and if pan feedback should
         // be displayed. Java and plugin windows can make their own calls.
         GESTURENOTIFYSTRUCT * gestureinfo = (GESTURENOTIFYSTRUCT*)lParam;
         nsPointWin touchPoint;
         touchPoint = gestureinfo->ptsLocation;
         touchPoint.ScreenToClient(mWnd);
-        nsGestureNotifyEvent gestureNotifyEvent(true, NS_GESTURENOTIFY_EVENT_START, this);
+        WidgetGestureNotifyEvent gestureNotifyEvent(true,
+                                   NS_GESTURENOTIFY_EVENT_START, this);
         gestureNotifyEvent.refPoint = LayoutDeviceIntPoint::FromUntyped(touchPoint);
         nsEventStatus status;
         DispatchEvent(&gestureNotifyEvent, status);
         mDisplayPanFeedback = gestureNotifyEvent.displayPanFeedback;
         if (!mTouchWindow)
           mGesture.SetWinGestureSupport(mWnd, gestureNotifyEvent.panDirection);
       }
       result = false; //should always bubble to DefWindowProc