Bug 1527412 - Remove unused contextMenu method. r=spohl
authorMarkus Stange <mstange@themasta.com>
Wed, 13 Feb 2019 11:14:02 +0000
changeset 458920 82aa9a03b71d
parent 458919 fa484096ffd3
child 458921 80265a268c68
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs1527412
milestone67.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 1527412 - Remove unused contextMenu method. r=spohl This method could only return something non-null in embedding situations, in which our ChildView was a subview of somebody else's NSView that conforms to the mozView protocol. Such a situation hasn't existed for about 10 years. Differential Revision: https://phabricator.services.mozilla.com/D19555
widget/cocoa/mozView.h
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/mozView.h
+++ b/widget/cocoa/mozView.h
@@ -29,19 +29,16 @@ class TextInputHandler;
 // NSTextInput protocol to handle key events.  Don't make aHandler a
 // strong reference -- that causes a memory leak.
 - (void)installTextInputHandler:(mozilla::widget::TextInputHandler*)aHandler;
 - (void)uninstallTextInputHandler;
 
 // access the nsIWidget associated with this view. DOES NOT ADDREF.
 - (nsIWidget*)widget;
 
-// return a context menu for this view
-- (NSMenu*)contextMenu;
-
 // called when our corresponding Gecko view goes away
 - (void)widgetDestroyed;
 
 - (BOOL)isDragInProgress;
 
 // Checks whether the view is first responder or not
 - (BOOL)isFirstResponder;
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4520,29 +4520,18 @@ static gfx::IntPoint GetIntegerDeltaForE
   WidgetMouseEvent geckoEvent(true, eContextMenu, mGeckoChild, WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
   geckoEvent.button = WidgetMouseEvent::eRightButton;
   mGeckoChild->DispatchInputEvent(&geckoEvent);
   if (!mGeckoChild) return nil;
 
   [self maybeInitContextMenuTracking];
 
-  // Go up our view chain to fetch the correct menu to return.
-  return [self contextMenu];
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
-}
-
-- (NSMenu*)contextMenu {
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
-
-  NSView* superView = [self superview];
-  if ([superView respondsToSelector:@selector(contextMenu)])
-    return [(NSView<mozView>*)superView contextMenu];
-
+  // We never return an actual NSMenu* for the context menu. Gecko might have
+  // responded to the eContextMenu event by putting up a fake context menu.
   return nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (void)convertCocoaMouseWheelEvent:(NSEvent*)aMouseEvent
                        toGeckoEvent:(WidgetWheelEvent*)outWheelEvent {
   [self convertCocoaMouseEvent:aMouseEvent toGeckoEvent:outWheelEvent];