зеркало из https://github.com/mozilla/pjs.git
handle popup rollup correctly when scrolling. b=330999 r=mento
This commit is contained in:
Родитель
2107246be5
Коммит
46ec98b10e
|
@ -20,6 +20,7 @@
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
|
* Josh Aas <josh@mozilla.com>
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* 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
|
* 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,
|
// 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.
|
// a single NSScrollWheel event might result in deltaX = deltaY = 0.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsMouseScrollEvent geckoEvent(PR_TRUE, 0, nsnull);
|
nsMouseScrollEvent geckoEvent(PR_TRUE, 0, nsnull);
|
||||||
[self convertEvent:theEvent message:NS_MOUSE_SCROLL toGeckoEvent:&geckoEvent];
|
[self convertEvent:theEvent message:NS_MOUSE_SCROLL toGeckoEvent:&geckoEvent];
|
||||||
geckoEvent.scrollFlags |= inAxis;
|
geckoEvent.scrollFlags |= inAxis;
|
||||||
|
@ -2932,6 +2933,15 @@ static nsEventStatus SendMouseEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w
|
||||||
|
|
||||||
-(void)scrollWheel:(NSEvent*)theEvent
|
-(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
|
// It's possible for a single NSScrollWheel event to carry both useful
|
||||||
// deltaX and deltaY, for example, when the "wheel" is a trackpad.
|
// deltaX and deltaY, for example, when the "wheel" is a trackpad.
|
||||||
// NSMouseScrollEvent can only carry one axis at a time, so the system
|
// NSMouseScrollEvent can only carry one axis at a time, so the system
|
||||||
|
|
|
@ -43,9 +43,13 @@
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIScrollbarMediator.h"
|
#include "nsIScrollbarMediator.h"
|
||||||
|
#include "nsIRollupListener.h"
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED1(nsNativeScrollbar, nsChildView, nsINativeScrollbar)
|
NS_IMPL_ISUPPORTS_INHERITED1(nsNativeScrollbar, nsChildView, nsINativeScrollbar)
|
||||||
|
|
||||||
|
extern nsIRollupListener * gRollupListener;
|
||||||
|
extern nsIWidget * gRollupWidget;
|
||||||
|
|
||||||
inline void BoundsCheck(PRInt32 low, PRUint32& value, PRUint32 high)
|
inline void BoundsCheck(PRInt32 low, PRUint32& value, PRUint32 high)
|
||||||
{
|
{
|
||||||
if ((PRInt32) value < low)
|
if ((PRInt32) value < low)
|
||||||
|
@ -678,7 +682,13 @@ nsNativeScrollbar::UpdateScroller()
|
||||||
//
|
//
|
||||||
- (IBAction)scroll:(NSScroller*)sender
|
- (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]);
|
mGeckoChild->DoScroll([sender hitPart]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче