diff --git a/mozilla/widget/src/cocoa/nsChildView.mm b/mozilla/widget/src/cocoa/nsChildView.mm index fb55d144ea1..fbe61e14ddf 100644 --- a/mozilla/widget/src/cocoa/nsChildView.mm +++ b/mozilla/widget/src/cocoa/nsChildView.mm @@ -2557,7 +2557,6 @@ nsChildView::GetThebesSurface() - (void)mouseDown:(NSEvent *)theEvent { - BOOL popupRolledUp = NO; // make sure this view is not in the rollup widget // the fastest way to do this is by comparing native window pointers if (gRollupWidget != nsnull) { @@ -2567,16 +2566,13 @@ nsChildView::GetThebesSurface() // roll up any popups if (gRollupListener != nsnull) { gRollupListener->Rollup(); - popupRolledUp = YES; + // If we rolled up a popup, we don't want to pass the click down to gecko. + // This happens e.g. when you click a popupmenubutton (the menu opens), then click + // on the popupmenubutton a second time, which should hide the menu. + return; } } } - - // If we rolled up a popup, we don't want to pass the click down to gecko. - // This happens e.g. when you click a popupmenubutton (the menu opens), then click - // on the popupmenubutton a second time, which should hide the menu. - if (popupRolledUp) - return; // if the command and alt keys are held down, initiate hand scrolling if ([ChildView areHandScrollModifiers:[theEvent modifierFlags]]) { @@ -2584,7 +2580,7 @@ nsChildView::GetThebesSurface() // needed to change the focus, among other things, since we don't // get to do that below. [super mouseDown:theEvent]; - return; // do not pass this mousedown event to gecko + return; // do not pass this mousedown event to gecko } #if USE_CLICK_HOLD_CONTEXTMENU @@ -2609,7 +2605,8 @@ nsChildView::GetThebesSurface() // send event into Gecko by going directly to the // the widget. - mGeckoChild->DispatchMouseEvent(geckoEvent); + if (mGeckoChild) + mGeckoChild->DispatchMouseEvent(geckoEvent); // XXX maybe call markedTextSelectionChanged:client: here? } @@ -2637,8 +2634,8 @@ nsChildView::GetThebesSurface() // send event into Gecko by going directly to the // the widget. - mGeckoChild->DispatchMouseEvent(geckoEvent); - + if (mGeckoChild) + mGeckoChild->DispatchMouseEvent(geckoEvent); } - (void)mouseMoved:(NSEvent*)theEvent