diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 3be3dc812e7..e7481f8362d 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -20,6 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Josh Aas * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -2871,7 +2872,7 @@ static nsEventStatus SendMouseEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w // No sense in firing off a Gecko event. Note that as of 10.4 Tiger, // a single NSScrollWheel event might result in deltaX = deltaY = 0. return; - + nsMouseScrollEvent geckoEvent(PR_TRUE, 0, nsnull); [self convertEvent:theEvent message:NS_MOUSE_SCROLL toGeckoEvent:&geckoEvent]; geckoEvent.scrollFlags |= inAxis; @@ -2932,6 +2933,15 @@ static nsEventStatus SendMouseEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w -(void)scrollWheel:(NSEvent*)theEvent { + // close popups if we're supposed to... + if (gRollupListener && gRollupWidget && + [self window] != gRollupWidget->GetNativeData(NS_NATIVE_WINDOW)) { + PRBool rollup = PR_FALSE; + gRollupListener->ShouldRollupOnMouseWheelEvent(&rollup); + if (rollup) + gRollupListener->Rollup(); + } + // It's possible for a single NSScrollWheel event to carry both useful // deltaX and deltaY, for example, when the "wheel" is a trackpad. // NSMouseScrollEvent can only carry one axis at a time, so the system diff --git a/widget/src/cocoa/nsNativeScrollbar.mm b/widget/src/cocoa/nsNativeScrollbar.mm index d35dac507f0..1ddb4fa6328 100644 --- a/widget/src/cocoa/nsNativeScrollbar.mm +++ b/widget/src/cocoa/nsNativeScrollbar.mm @@ -43,9 +43,13 @@ #include "nsINameSpaceManager.h" #include "nsIDOMElement.h" #include "nsIScrollbarMediator.h" +#include "nsIRollupListener.h" NS_IMPL_ISUPPORTS_INHERITED1(nsNativeScrollbar, nsChildView, nsINativeScrollbar) +extern nsIRollupListener * gRollupListener; +extern nsIWidget * gRollupWidget; + inline void BoundsCheck(PRInt32 low, PRUint32& value, PRUint32 high) { if ((PRInt32) value < low) @@ -678,7 +682,13 @@ nsNativeScrollbar::UpdateScroller() // - (IBAction)scroll:(NSScroller*)sender { - if ( mGeckoChild ) + // roll up popup windows if there are any + if (gRollupListener && gRollupWidget && + gRollupWidget->GetNativeData(NS_NATIVE_WINDOW) != [self getNativeWindow]) { + gRollupListener->Rollup(); + } + + if (mGeckoChild) mGeckoChild->DoScroll([sender hitPart]); }