mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 1697964 - Remove nsCocoaUtils::EventPhase and EventMomentumPhase. r=mac-reviewers,tnikkel
This has been unnecessary ever since we dropped support for 10.6 in Firefox 49. Depends on D108135 Differential Revision: https://phabricator.services.mozilla.com/D108136
This commit is contained in:
parent
a25fa13fd4
commit
e0ecba97e2
@ -2865,7 +2865,7 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
|
||||
// Only initiate horizontal tracking for gestures that have just begun --
|
||||
// otherwise a scroll to one side of the page can have a swipe tacked on
|
||||
// to it.
|
||||
NSEventPhase eventPhase = nsCocoaUtils::EventPhase(anEvent);
|
||||
NSEventPhase eventPhase = [anEvent phase];
|
||||
if ([anEvent type] != NSEventTypeScrollWheel || eventPhase != NSEventPhaseBegan ||
|
||||
![anEvent hasPreciseScrollingDeltas]) {
|
||||
return false;
|
||||
@ -3219,7 +3219,7 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
|
||||
}
|
||||
|
||||
static PanGestureInput::PanGestureType PanGestureTypeForEvent(NSEvent* aEvent) {
|
||||
switch (nsCocoaUtils::EventPhase(aEvent)) {
|
||||
switch ([aEvent phase]) {
|
||||
case NSEventPhaseMayBegin:
|
||||
return PanGestureInput::PANGESTURE_MAYSTART;
|
||||
case NSEventPhaseCancelled:
|
||||
@ -3231,7 +3231,7 @@ static PanGestureInput::PanGestureType PanGestureTypeForEvent(NSEvent* aEvent) {
|
||||
case NSEventPhaseEnded:
|
||||
return PanGestureInput::PANGESTURE_END;
|
||||
case NSEventPhaseNone:
|
||||
switch (nsCocoaUtils::EventMomentumPhase(aEvent)) {
|
||||
switch ([aEvent momentumPhase]) {
|
||||
case NSEventPhaseBegan:
|
||||
return PanGestureInput::PANGESTURE_MOMENTUMSTART;
|
||||
case NSEventPhaseChanged:
|
||||
@ -3263,8 +3263,8 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
||||
// Starting with 10.12 however, pixel scroll events no longer accumulate
|
||||
// deltaX and deltaY; they just report floating point values for every
|
||||
// single event. So we need to do our own accumulation.
|
||||
return PanGestureInput::GetIntegerDeltaForEvent(
|
||||
(nsCocoaUtils::EventPhase(aEvent) == NSEventPhaseBegan), [aEvent deltaX], [aEvent deltaY]);
|
||||
return PanGestureInput::GetIntegerDeltaForEvent([aEvent phase] == NSEventPhaseBegan,
|
||||
[aEvent deltaX], [aEvent deltaY]);
|
||||
}
|
||||
|
||||
// For line scrolls, or pre-10.12, just use the rounded up value of deltaX / deltaY.
|
||||
@ -3286,7 +3286,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSEventPhase phase = nsCocoaUtils::EventPhase(theEvent);
|
||||
NSEventPhase phase = [theEvent phase];
|
||||
// Fire eWheelOperationStart/End events when 2 fingers touch/release the
|
||||
// touchpad.
|
||||
if (phase & NSEventPhaseMayBegin) {
|
||||
|
@ -220,8 +220,6 @@ class nsCocoaUtils {
|
||||
// -[NSEvent hasPreciseScrollingDeltas] and -[NSEvent scrollingDeltaX/Y] APIs
|
||||
// that became availaible starting with the 10.7 SDK.
|
||||
// All of these can be removed once we drop support for 10.6.
|
||||
static NSEventPhase EventPhase(NSEvent* aEvent);
|
||||
static NSEventPhase EventMomentumPhase(NSEvent* aEvent);
|
||||
static BOOL IsMomentumScrollEvent(NSEvent* aEvent);
|
||||
static BOOL HasPreciseScrollingDeltas(NSEvent* aEvent);
|
||||
static void GetScrollingDeltas(NSEvent* aEvent, CGFloat* aOutDeltaX, CGFloat* aOutDeltaY);
|
||||
|
@ -154,42 +154,8 @@ NSPoint nsCocoaUtils::EventLocationForWindow(NSEvent* anEvent, NSWindow* aWindow
|
||||
NS_OBJC_END_TRY_BLOCK_RETURN(NSMakePoint(0.0, 0.0));
|
||||
}
|
||||
|
||||
@interface NSEvent (ScrollPhase)
|
||||
// 10.5 and 10.6
|
||||
- (long long)_scrollPhase;
|
||||
// 10.7 and above
|
||||
- (NSEventPhase)phase;
|
||||
- (NSEventPhase)momentumPhase;
|
||||
@end
|
||||
|
||||
NSEventPhase nsCocoaUtils::EventPhase(NSEvent* aEvent) {
|
||||
if ([aEvent respondsToSelector:@selector(phase)]) {
|
||||
return [aEvent phase];
|
||||
}
|
||||
return NSEventPhaseNone;
|
||||
}
|
||||
|
||||
NSEventPhase nsCocoaUtils::EventMomentumPhase(NSEvent* aEvent) {
|
||||
if ([aEvent respondsToSelector:@selector(momentumPhase)]) {
|
||||
return [aEvent momentumPhase];
|
||||
}
|
||||
if ([aEvent respondsToSelector:@selector(_scrollPhase)]) {
|
||||
switch ([aEvent _scrollPhase]) {
|
||||
case 1:
|
||||
return NSEventPhaseBegan;
|
||||
case 2:
|
||||
return NSEventPhaseChanged;
|
||||
case 3:
|
||||
return NSEventPhaseEnded;
|
||||
default:
|
||||
return NSEventPhaseNone;
|
||||
}
|
||||
}
|
||||
return NSEventPhaseNone;
|
||||
}
|
||||
|
||||
BOOL nsCocoaUtils::IsMomentumScrollEvent(NSEvent* aEvent) {
|
||||
return [aEvent type] == NSEventTypeScrollWheel && EventMomentumPhase(aEvent) != NSEventPhaseNone;
|
||||
return [aEvent type] == NSEventTypeScrollWheel && [aEvent momentumPhase] != NSEventPhaseNone;
|
||||
}
|
||||
|
||||
@interface NSEvent (HasPreciseScrollingDeltas)
|
||||
@ -243,10 +209,7 @@ void nsCocoaUtils::GetScrollingDeltas(NSEvent* aEvent, CGFloat* aOutDeltaX, CGFl
|
||||
}
|
||||
|
||||
BOOL nsCocoaUtils::EventHasPhaseInformation(NSEvent* aEvent) {
|
||||
if (![aEvent respondsToSelector:@selector(phase)]) {
|
||||
return NO;
|
||||
}
|
||||
return EventPhase(aEvent) != NSEventPhaseNone || EventMomentumPhase(aEvent) != NSEventPhaseNone;
|
||||
return [aEvent phase] != NSEventPhaseNone || [aEvent momentumPhase] != NSEventPhaseNone;
|
||||
}
|
||||
|
||||
void nsCocoaUtils::HideOSChromeOnScreen(bool aShouldHide) {
|
||||
|
Loading…
Reference in New Issue
Block a user