Bug 1091979 - Fix -Wswitch warning in widget/cocoa/nsChildView.mm. r=smichaud
authorChris Peterson <cpeterson@mozilla.com>
Wed, 29 Oct 2014 21:29:28 -0700
changeset 213473 d10109f1b0c268a22039d449c19431e5ccd5e08f
parent 213472 dc4b163f7db739e1e5d301e192d3b32a265b1645
child 213474 4a4eb24614d134748309b84d3104fa0deeb91b9b
push id51240
push usercpeterson@mozilla.com
push dateSat, 01 Nov 2014 02:14:12 +0000
treeherdermozilla-inbound@4a4eb24614d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud
bugs1091979
milestone36.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 1091979 - Fix -Wswitch warning in widget/cocoa/nsChildView.mm. r=smichaud
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -119,17 +119,17 @@ extern "C" {
   typedef CFTypeRef CGSRegionObj;
   CGError CGSNewRegionWithRect(const CGRect *rect, CGSRegionObj *outRegion);
   CGError CGSNewRegionWithRectList(const CGRect *rects, int rectCount, CGSRegionObj *outRegion);
 }
 
 // defined in nsMenuBarX.mm
 extern NSMenu* sApplicationMenu; // Application menu shared by all menubars
 
-bool gChildViewMethodsSwizzled = false;
+static bool gChildViewMethodsSwizzled = false;
 
 extern nsISupportsArray *gDraggedTransferables;
 
 ChildView* ChildViewMouseTracker::sLastMouseEventView = nil;
 NSEvent* ChildViewMouseTracker::sLastMouseMoveEvent = nil;
 NSWindow* ChildViewMouseTracker::sWindowUnderMouse = nil;
 NSPoint ChildViewMouseTracker::sLastScrollEventScreenLocation = NSZeroPoint;
 
@@ -4747,17 +4747,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
 }
 #endif // #ifdef __LP64__
 
 - (void)setUsingOMTCompositor:(BOOL)aUseOMTC
 {
   mUsingOMTCompositor = aUseOMTC;
 }
 
-
 // Returning NO from this method only disallows ordering on mousedown - in order
 // to prevent it for mouseup too, we need to call [NSApp preventWindowOrdering]
 // when handling the mousedown event.
 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)aEvent
 {
   // Always using system-provided window ordering for normal windows.
   if (![[self window] isKindOfClass:[PopupWindow class]])
     return NO;
@@ -5539,24 +5538,28 @@ static int32_t RoundUp(double aDouble)
     case NSRightMouseDown:
     case NSRightMouseUp:
     case NSRightMouseDragged:
     case NSOtherMouseDown:
     case NSOtherMouseUp:
     case NSOtherMouseDragged:
       if ([aMouseEvent subtype] == NSTabletPointEventSubtype) {
         mouseEvent->pressure = [aMouseEvent pressure];
+        MOZ_ASSERT(mouseEvent->pressure >= 0.0 && mouseEvent->pressure <= 1.0);
       }
       break;
+
+    default:
+      // Don't check other NSEvents for pressure.
+      break;
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-
 #pragma mark -
 // NSTextInput implementation
 
 - (void)insertText:(id)insertString
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   NS_ENSURE_TRUE_VOID(mGeckoChild);