Bug 640110 ChildView users outdated pointer of plugin event for nsGUIEvent r=smichaud

This commit is contained in:
Masayuki Nakano 2011-03-31 19:31:32 -04:00
parent a26f726650
commit c5db601034

View File

@ -3448,6 +3448,11 @@ NSEvent* gLastDragMouseDownEvent = nil;
nsAutoRetainCocoaObject kungFuDeathGrip(self);
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
#endif // ifndef NP_NO_CARBON
NPCocoaEvent cocoaEvent;
nsMouseEvent geckoEvent(PR_TRUE, NS_MOUSE_BUTTON_UP, nsnull, nsMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
if ([theEvent modifierFlags] & NSControlKeyMask)
@ -3460,7 +3465,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
// event type.
if (mIsPluginView) {
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
if (mPluginEventModel == NPEventModelCarbon) {
carbonEvent.what = mouseUp;
carbonEvent.message = 0;
@ -3470,7 +3474,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
geckoEvent.pluginEvent = &carbonEvent;
}
#endif
NPCocoaEvent cocoaEvent;
if (mPluginEventModel == NPEventModelCocoa) {
InitNPCocoaEvent(&cocoaEvent);
NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
@ -3638,13 +3641,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
gLastDragView = self;
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
#endif // ifndef NP_NO_CARBON
NPCocoaEvent cocoaEvent;
nsMouseEvent geckoEvent(PR_TRUE, NS_MOUSE_MOVE, nsnull, nsMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
// create event for use by plugins
if (mIsPluginView) {
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
if (mPluginEventModel == NPEventModelCarbon) {
carbonEvent.what = NPEventType_AdjustCursorEvent;
carbonEvent.message = 0;
@ -3654,7 +3661,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
geckoEvent.pluginEvent = &carbonEvent;
}
#endif
NPCocoaEvent cocoaEvent;
if (mPluginEventModel == NPEventModelCocoa) {
InitNPCocoaEvent(&cocoaEvent);
NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
@ -3743,6 +3749,11 @@ NSEvent* gLastDragMouseDownEvent = nil;
if (!mGeckoChild)
return;
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
#endif // ifndef NP_NO_CARBON
NPCocoaEvent cocoaEvent;
nsMouseEvent geckoEvent(PR_TRUE, NS_MOUSE_BUTTON_UP, nsnull, nsMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
geckoEvent.button = nsMouseEvent::eRightButton;
@ -3751,7 +3762,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
// create event for use by plugins
if (mIsPluginView) {
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
if (mPluginEventModel == NPEventModelCarbon) {
carbonEvent.what = mouseUp;
carbonEvent.message = 0;
@ -3761,7 +3771,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
geckoEvent.pluginEvent = &carbonEvent;
}
#endif
NPCocoaEvent cocoaEvent;
if (mPluginEventModel == NPEventModelCocoa) {
InitNPCocoaEvent(&cocoaEvent);
NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
@ -5843,6 +5852,11 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf)
PRUint32 message = isKeyDown ? NS_KEY_DOWN : NS_KEY_UP;
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
#endif // ifndef NP_NO_CARBON
NPCocoaEvent cocoaEvent;
// Fire a key event.
nsKeyEvent geckoEvent(PR_TRUE, message, nsnull);
[self convertCocoaKeyEvent:theEvent toGeckoEvent:&geckoEvent];
@ -5850,13 +5864,11 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf)
// create event for use by plugins
if (mIsPluginView) {
#ifndef NP_NO_CARBON
EventRecord carbonEvent;
if (mPluginEventModel == NPEventModelCarbon) {
ConvertCocoaKeyEventToCarbonEvent(theEvent, carbonEvent, message);
geckoEvent.pluginEvent = &carbonEvent;
}
#endif
NPCocoaEvent cocoaEvent;
if (mPluginEventModel == NPEventModelCocoa) {
ConvertCocoaKeyEventToNPCocoaEvent(theEvent, cocoaEvent, message);
geckoEvent.pluginEvent = &cocoaEvent;