Backout 2823fca4f547 (bug 429824) for causing bug 1334140 in e10s. r=backout
authorStephen A Pohl <spohl.mozilla.bugs@gmail.com>
Thu, 26 Jan 2017 16:14:19 -0500
changeset 331323 8b37b56c428a35c97fa90aff8a78934e6abe45eb
parent 331322 691c601b38ec839a9f423940e379c488500b1775
child 331324 bba40246e02c0ad83640b6c04df0ff1b169d897d
push id31266
push usercbook@mozilla.com
push dateFri, 27 Jan 2017 09:44:04 +0000
treeherdermozilla-central@8dbe89935366 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs429824, 1334140
milestone54.0a1
backs out2823fca4f54792fec980a81e6fdf31171a1f9462
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
Backout 2823fca4f547 (bug 429824) for causing bug 1334140 in e10s. r=backout
widget/cocoa/nsChildView.mm
widget/cocoa/nsMenuBarX.h
widget/cocoa/nsMenuBarX.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -5469,33 +5469,20 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
 #endif // #if !defined(RELEASE_OR_BETA) || defined(DEBUG)
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
   bool handled = false;
   if (mGeckoChild && mTextInputHandler) {
     handled = mTextInputHandler->HandleKeyDownEvent(theEvent);
   }
 
-  // We always allow keyboard events to propagate to keyDown: but if they are
-  // not handled we give menu items a chance to act. This allows for handling of
-  // custom shortcuts. Note that existing shortcuts cannot be reassigned yet and
-  // will have been handled by keyDown: before we get here.
-  if (!handled && mGeckoChild) {
-    nsCocoaWindow* widget = mGeckoChild->GetXULWindowWidget();
-    if (widget) {
-      nsMenuBarX* mb = widget->GetMenuBar();
-      if (mb) {
-        // Check if main menu wants to handle the event.
-        handled = mb->PerformKeyEquivalent(theEvent);
-      }
-    }
-  }
+  // We always allow keyboard events to propagate to keyDown: but if they are not
+  // handled we give special Application menu items a chance to act.
   if (!handled && sApplicationMenu) {
-    // Check if application menu wants to handle the event.
-    handled = [sApplicationMenu performKeyEquivalent:theEvent];
+    [sApplicationMenu performKeyEquivalent:theEvent];
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)keyUp:(NSEvent*)theEvent
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
--- a/widget/cocoa/nsMenuBarX.h
+++ b/widget/cocoa/nsMenuBarX.h
@@ -42,17 +42,16 @@ protected:
   virtual ~nsNativeMenuServiceX() {}
 };
 
 // Objective-C class used to allow us to intervene with keyboard event handling.
 // We allow mouse actions to work normally.
 @interface GeckoNSMenu : NSMenu
 {
 }
-- (BOOL)performSuperKeyEquivalent:(NSEvent*)theEvent;
 @end
 
 // Objective-C class used as action target for menu items
 @interface NativeMenuItemTarget : NSObject
 {
 }
 -(IBAction)menuItemHit:(id)sender;
 @end
@@ -115,17 +114,16 @@ public:
   void              SetSystemHelpMenu();
   nsresult          Paint();
   void              ForceUpdateNativeMenuAt(const nsAString& indexString);
   void              ForceNativeMenuReload(); // used for testing
   static char       GetLocalizedAccelKey(const char *shortcutID);
   static void       ResetNativeApplicationMenu();
   void              SetNeedsRebuild();
   void              ApplicationMenuOpened();
-  bool              PerformKeyEquivalent(NSEvent* theEvent);
 
 protected:
   void              ConstructNativeMenus();
   void              ConstructFallbackNativeMenus();
   nsresult          InsertMenuAtIndex(nsMenuX* aMenu, uint32_t aIndex);
   void              RemoveMenuAtIndex(uint32_t aIndex);
   void              HideItem(nsIDOMDocument* inDoc, const nsAString & inID, nsIContent** outHiddenNode);
   void              AquifyMenuBar();
--- a/widget/cocoa/nsMenuBarX.mm
+++ b/widget/cocoa/nsMenuBarX.mm
@@ -522,21 +522,16 @@ void nsMenuBarX::ApplicationMenuOpened()
     if (!mMenuArray.IsEmpty()) {
       ResetNativeApplicationMenu();
       CreateApplicationMenu(mMenuArray[0].get());
     }
     mNeedsRebuild = false;
   }
 }
 
-bool nsMenuBarX::PerformKeyEquivalent(NSEvent* theEvent)
-{
-  return [mNativeMenu performSuperKeyEquivalent:theEvent];
-}
-
 // Hide the item in the menu by setting the 'hidden' attribute. Returns it in |outHiddenNode| so
 // the caller can hang onto it if they so choose. It is acceptable to pass nsull
 // for |outHiddenNode| if the caller doesn't care about the hidden node.
 void nsMenuBarX::HideItem(nsIDOMDocument* inDoc, const nsAString & inID, nsIContent** outHiddenNode)
 {
   nsCOMPtr<nsIDOMElement> menuItem;
   inDoc->GetElementById(inID, getter_AddRefs(menuItem));
   nsCOMPtr<nsIContent> menuContent(do_QueryInterface(menuItem));
@@ -876,21 +871,16 @@ static BOOL gMenuItemsExecuteCommands = 
   if (![NSApp keyWindow] || [[NSApp keyWindow] firstResponder] != firstResponder) {
     return YES;
   }
 
   // Return NO so that we can handle the event via NSView's "keyDown:".
   return NO;
 }
 
-- (BOOL)performSuperKeyEquivalent:(NSEvent*)theEvent
-{
-  return [super performKeyEquivalent:theEvent];
-}
-
 @end
 
 //
 // Objective-C class used as action target for menu items
 //
 
 @implementation NativeMenuItemTarget