Bug 1527412 - Remove unused contextMenu method. r=spohl
authorMarkus Stange <mstange@themasta.com>
Wed, 13 Feb 2019 11:14:02 +0000
changeset 458937 82aa9a03b71d26790c72a7c2a9b19c0fb7fd936f
parent 458936 fa484096ffd36c4c0712fa7b880379e1f78171e8
child 458938 80265a268c6878d35238be7d3c9135c0fa3e7a99
push id78113
push usermstange@themasta.com
push dateWed, 13 Feb 2019 17:02:18 +0000
treeherderautoland@b09a49ab3635 [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];