From 0b36850b73f7480a1f49b5d84698390b67d9555e Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Fri, 27 Sep 2013 15:20:57 +0900 Subject: [PATCH] Bug 920377 part.15 Get rid of nsGestureNotifyEvent r=roc --- content/events/src/nsEventStateManager.cpp | 22 ++++++++++++---------- content/events/src/nsEventStateManager.h | 3 ++- widget/EventForwards.h | 2 -- widget/TouchEvents.h | 3 --- widget/qt/nsWindow.cpp | 3 ++- widget/windows/nsWinGesture.cpp | 11 ++++++----- widget/windows/nsWinGesture.h | 2 +- widget/windows/nsWindow.cpp | 3 ++- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 4bd212606e4b..cef72cafece6 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2809,7 +2809,7 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame, } void -nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent, +nsEventStateManager::DecideGestureEvent(WidgetGestureNotifyEvent* aEvent, nsIFrame* targetFrame) { @@ -2828,7 +2828,8 @@ nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent, * * 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)) { @@ -2837,7 +2838,7 @@ nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent, // Scrollbars should always be draggable if (currentFrameType == nsGkAtoms::scrollbarFrame) { - panDirection = nsGestureNotifyEvent::ePanNone; + panDirection = WidgetGestureNotifyEvent::ePanNone; break; } @@ -2846,10 +2847,10 @@ nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent, 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; } @@ -2873,12 +2874,12 @@ nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent, // 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 @@ -2886,13 +2887,13 @@ nsEventStateManager::DecideGestureEvent(nsGestureNotifyEvent* aEvent, //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; } } @@ -3222,7 +3223,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, case NS_GESTURENOTIFY_EVENT_START: { if (nsEventStatus_eConsumeNoDefault != *aStatus) - DecideGestureEvent(static_cast(aEvent), mCurrentTarget); + DecideGestureEvent(static_cast(aEvent), + mCurrentTarget); } break; diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index 3df86dd7b5da..9c25350325f9 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -655,7 +655,8 @@ protected: * 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, diff --git a/widget/EventForwards.h b/widget/EventForwards.h index 95fafbec7a2b..e22be04326eb 100644 --- a/widget/EventForwards.h +++ b/widget/EventForwards.h @@ -125,6 +125,4 @@ namespace mozilla { typedef WidgetWheelEvent WheelEvent; } -typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent; - #endif // mozilla_EventForwards_h__ diff --git a/widget/TouchEvents.h b/widget/TouchEvents.h index d1dbde2366fe..bc6f1dcd0b86 100644 --- a/widget/TouchEvents.h +++ b/widget/TouchEvents.h @@ -151,7 +151,4 @@ public: } // namespace mozilla -// TODO: Remove following typedefs -typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent; - #endif // mozilla_TouchEvents_h__ diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index e803f3a212da..b0a5494f4d16 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -1973,7 +1973,8 @@ nsEventStatus nsWindow::OnTouchEvent(QTouchEvent *event, bool &handled) 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); } diff --git a/widget/windows/nsWinGesture.cpp b/widget/windows/nsWinGesture.cpp index 4d96aa336a4a..85169d252ffc 100644 --- a/widget/windows/nsWinGesture.cpp +++ b/widget/windows/nsWinGesture.cpp @@ -119,7 +119,8 @@ bool nsWinGesture::InitLibrary() #define GCOUNT 5 -bool nsWinGesture::SetWinGestureSupport(HWND hWnd, nsGestureNotifyEvent::ePanDirection aDirection) +bool nsWinGesture::SetWinGestureSupport(HWND hWnd, + WidgetGestureNotifyEvent::ePanDirection aDirection) { if (!getGestureInfo) return false; @@ -144,15 +145,15 @@ bool nsWinGesture::SetWinGestureSupport(HWND hWnd, nsGestureNotifyEvent::ePanDir 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; diff --git a/widget/windows/nsWinGesture.h b/widget/windows/nsWinGesture.h index bed083156d99..e97e6aa8ddf8 100644 --- a/widget/windows/nsWinGesture.h +++ b/widget/windows/nsWinGesture.h @@ -198,7 +198,7 @@ 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); diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index c710d74edb1e..d9c432079fbc 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -5343,7 +5343,8 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& 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);