Bug 851128 - Backout patch because it caused bug 862417 and bug 864053. r=bgirard

This commit is contained in:
Steven Michaud 2013-04-22 16:41:50 -05:00
parent 20a1e61eb3
commit 24a888e6cc
3 changed files with 2 additions and 97 deletions

View File

@ -79,6 +79,7 @@
* MozTapGesture - Generated when the user executes a two finger
* tap gesture on the input device. Client coordinates contain the
* center point of the tap.
* (XXX Not implemented on Mac)
*
* MozPressTapGesture - Generated when the user executes a press
* and tap two finger gesture (first finger down, second finger down,

View File

@ -267,19 +267,11 @@ typedef NSInteger NSEventGestureAxis;
eGestureState_None,
eGestureState_StartGesture,
eGestureState_MagnifyGesture,
eGestureState_RotateGesture,
eGestureState_TapGesture
eGestureState_RotateGesture
} mGestureState;
float mCumulativeMagnification;
float mCumulativeRotation;
// Custom double tap gesture support
//
// mFirstTapTime keeps track of the time when the first tap occured
// and is used to check whether second tap should be recognized as
// a double tap gesture.
NSTimeInterval mFirstTapTime;
BOOL mDidForceRefreshOpenGL;
BOOL mWaitingForPaint;
@ -349,10 +341,6 @@ typedef NSInteger NSEventGestureAxis;
- (void)rotateWithEvent:(NSEvent *)anEvent;
- (void)endGestureWithEvent:(NSEvent *)anEvent;
// Not a genuine nsResponder method, but called by touchesBeganWithEvent
// to simulate double-tap recognition
- (void)tapWithEvent:(NSEvent *)anEvent;
// Support for fluid swipe tracking.
#ifdef __LP64__
- (void)maybeTrackScrollEventAsSwipe:(NSEvent *)anEvent

View File

@ -2214,8 +2214,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
mClickThroughMouseDownEvent = nil;
mDragService = nullptr;
[self setAcceptsTouchEvents:YES];
mGestureState = eGestureState_None;
mCumulativeMagnification = 0.0;
mCumulativeRotation = 0.0;
@ -3156,89 +3154,10 @@ NSEvent* gLastDragMouseDownEvent = nil;
* was necessary to obtain the methods' prototypes. Thus, Apple may
* change the interface in the future without notice.
*
* XXX - The tapWithEvent is a custom gesture that is set up below.
* Cocoa doesn't recognize double-taps by default, so the
* recognition is done mainly by touchesBeganWithEvent.
*
* The prototypes were obtained from the following link:
* http://cocoadex.com/2008/02/nsevent-modifications-swipe-ro.html
*/
- (void)touchesBeganWithEvent:(NSEvent *)anEvent
{
if (!anEvent) {
return;
}
// Set up for recognition of a double tap gesture
NSSet* touches =
[anEvent touchesMatchingPhase:NSTouchPhaseTouching inView:self];
NSUInteger touchCount = [touches count];
if (touchCount != 2) {
// Cancel double tap if 3+ fingers touch
if (mGestureState == eGestureState_TapGesture && touchCount > 2) {
mGestureState = eGestureState_None;
}
return;
}
if (mGestureState == eGestureState_TapGesture) {
NSTimeInterval deltaTapTime =
[NSDate timeIntervalSinceReferenceDate] - mFirstTapTime;
if (deltaTapTime <= [NSEvent doubleClickInterval] &&
deltaTapTime > 0.00) {
[self tapWithEvent: anEvent];
return;
}
}
mGestureState = eGestureState_TapGesture;
mFirstTapTime = [NSDate timeIntervalSinceReferenceDate];
}
- (void)touchesMovedWithEvent:(NSEvent *)anEvent
{
// Cancel double tap if there's movement
if (mGestureState == eGestureState_TapGesture) {
mGestureState = eGestureState_None;
}
}
- (void)touchesEndedWithEvent:(NSEvent *)anEvent
{
return;
}
- (void)touchesCancelledWithEvent:(NSEvent *)anEvent
{
// Clear the gestures state.
mGestureState = eGestureState_None;
}
- (void)tapWithEvent:(NSEvent *)anEvent
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (!anEvent) {
return;
}
nsAutoRetainCocoaObject kungFuDeathGrip(self);
// Setup the "double tap" event.
nsSimpleGestureEvent geckoEvent(true, NS_SIMPLE_GESTURE_TAP,
mGeckoChild, 0, 0.0);
[self convertCocoaMouseEvent:anEvent toGeckoEvent:&geckoEvent];
geckoEvent.clickCount = 1;
// Send the event.
mGeckoChild->DispatchWindowEvent(geckoEvent);
// Clear the gesture state
mGestureState = eGestureState_None;
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (void)swipeWithEvent:(NSEvent *)anEvent
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
@ -3307,7 +3226,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
case eGestureState_None:
case eGestureState_RotateGesture:
case eGestureState_TapGesture:
default:
return;
}
@ -3349,7 +3267,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
case eGestureState_None:
case eGestureState_MagnifyGesture:
case eGestureState_TapGesture:
default:
return;
}
@ -3419,7 +3336,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
case eGestureState_None:
case eGestureState_StartGesture:
case eGestureState_TapGesture:
default:
break;
}