mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-19 09:30:44 +00:00
Fix native scrollbars from crashing with stubbing out mouseMove. Not part of build.
This commit is contained in:
parent
6627f3a26d
commit
f39fd703d9
@ -111,10 +111,10 @@ private:
|
|||||||
|
|
||||||
@interface NativeScrollbarView : NSScroller
|
@interface NativeScrollbarView : NSScroller
|
||||||
{
|
{
|
||||||
// Our window [WEAK]
|
// Our window [WEAK]
|
||||||
NSWindow* mWindow;
|
NSWindow* mWindow;
|
||||||
|
|
||||||
// the nsChildView that created the view. It retains this NSView, so
|
// the nsChildView that created this view. It retains this NSView, so
|
||||||
// the link back to it must be weak.
|
// the link back to it must be weak.
|
||||||
nsChildView* mGeckoChild;
|
nsChildView* mGeckoChild;
|
||||||
|
|
||||||
@ -125,7 +125,14 @@ private:
|
|||||||
NSTrackingRectTag mMouseEnterExitTag;
|
NSTrackingRectTag mMouseEnterExitTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)aRect;
|
// default initializer
|
||||||
|
- (id)initWithFrame:(NSRect)frameRect geckoChild:(nsChildView*)inChild;
|
||||||
|
// overridden parent class initializer
|
||||||
|
- (id)initWithFrame:(NSRect)frameRect;
|
||||||
|
|
||||||
|
// access the nsIWidget associated with this view. DOES NOT ADDREF.
|
||||||
|
- (nsIWidget*) widget;
|
||||||
|
|
||||||
- (NSWindow*) getNativeWindow;
|
- (NSWindow*) getNativeWindow;
|
||||||
- (void) setNativeWindow: (NSWindow*)aWindow;
|
- (void) setNativeWindow: (NSWindow*)aWindow;
|
||||||
@end
|
@end
|
||||||
|
@ -127,8 +127,7 @@ nsNativeScrollbar::CreateCocoaView ( )
|
|||||||
orientation.size.width = 100;
|
orientation.size.width = 100;
|
||||||
orientation.size.height = 20;
|
orientation.size.height = 20;
|
||||||
}
|
}
|
||||||
return [[[NativeScrollbarView alloc] initWithFrame:orientation] autorelease];
|
return [[[NativeScrollbarView alloc] initWithFrame:orientation geckoChild:this] autorelease];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GrafPtr
|
GrafPtr
|
||||||
@ -502,6 +501,35 @@ nsNativeScrollbar::IsEnabled(PRBool *aState)
|
|||||||
|
|
||||||
@implementation NativeScrollbarView
|
@implementation NativeScrollbarView
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// -initWithFrame:geckoChild
|
||||||
|
// Designated Initializer
|
||||||
|
//
|
||||||
|
// Init our superclass and make the connection to the gecko nsIWidget we're
|
||||||
|
// mirroring
|
||||||
|
//
|
||||||
|
- (id)initWithFrame:(NSRect)frameRect geckoChild:(nsChildView*)inChild
|
||||||
|
{
|
||||||
|
[super initWithFrame:frameRect];
|
||||||
|
|
||||||
|
NS_ASSERTION(inChild, "Need to provide a tether between this and a nsChildView class");
|
||||||
|
mGeckoChild = inChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// -initWithFrame
|
||||||
|
//
|
||||||
|
// overridden parent class initializer
|
||||||
|
//
|
||||||
|
- (id)initWithFrame:(NSRect)frameRect
|
||||||
|
{
|
||||||
|
NS_WARNING("You're calling the wrong initializer. You really want -initWithFrame:geckoChild");
|
||||||
|
[self initWithFrame:frameRect geckoChild:nsnull];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSWindow*) getNativeWindow
|
- (NSWindow*) getNativeWindow
|
||||||
{
|
{
|
||||||
NSWindow* currWin = [self window];
|
NSWindow* currWin = [self window];
|
||||||
@ -537,5 +565,29 @@ nsNativeScrollbar::IsEnabled(PRBool *aState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// -widget
|
||||||
|
//
|
||||||
|
// return our gecko child view widget. Note this does not AddRef.
|
||||||
|
//
|
||||||
|
- (nsIWidget*) widget
|
||||||
|
{
|
||||||
|
return NS_STATIC_CAST(nsIWidget*, mGeckoChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// -mouseMoved
|
||||||
|
//
|
||||||
|
// our parent view will try to forward this message down to us. The
|
||||||
|
// default behavior for NSResponder is to forward it up the chain. Can you
|
||||||
|
// say "infinite recursion"? I thought so. Just stub out the action to
|
||||||
|
// break the cycle of madness.
|
||||||
|
//
|
||||||
|
- (void)mouseMoved:(NSEvent*)theEvent
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user