From cf01ab4fd7e5170353f03c96f350cee24edaf251 Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Fri, 19 Jun 2009 12:15:23 -0400 Subject: [PATCH] Minor Mac OS X plugin related cleanup, no bug. r=smichaud --- layout/generic/nsObjectFrame.cpp | 8 ++--- modules/plugin/base/public/npapi.h | 3 +- .../plugin/base/public/nsIPluginInstance.idl | 10 ------ widget/src/cocoa/nsChildView.mm | 36 +++++++++---------- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index e7f16be33048..8680eae16a1a 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -2959,9 +2959,7 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() nsCOMPtr mydomElement = do_QueryInterface(mContent); NS_ENSURE_TRUE(mydomElement, NS_ERROR_NO_INTERFACE); - nsCOMPtr allParams; - - nsINodeInfo *ni = mContent->NodeInfo(); + nsCOMPtr allParams; // Making DOM method calls can cause our frame to go away, which // might kill us... @@ -4941,8 +4939,8 @@ WindowRef nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState) nsIntPoint pluginOrigin; nsIntRect widgetClip; PRBool widgetVisible; - pluginWidget->GetPluginClipRect(widgetClip, pluginOrigin, /* out */ widgetVisible); - + pluginWidget->GetPluginClipRect(widgetClip, pluginOrigin, widgetVisible); + // printf("GetPluginClipRect returning visible %d\n", widgetVisible); isVisible &= widgetVisible; diff --git a/modules/plugin/base/public/npapi.h b/modules/plugin/base/public/npapi.h index c2f3adf2ad33..849e93100569 100644 --- a/modules/plugin/base/public/npapi.h +++ b/modules/plugin/base/public/npapi.h @@ -68,9 +68,10 @@ #endif /* __MWERKS__ */ #ifdef XP_MACOSX -#include #ifdef __LP64__ #define NP_NO_QUICKDRAW +#else +#include #endif #endif diff --git a/modules/plugin/base/public/nsIPluginInstance.idl b/modules/plugin/base/public/nsIPluginInstance.idl index 892e7c96780f..2b55f405baa0 100644 --- a/modules/plugin/base/public/nsIPluginInstance.idl +++ b/modules/plugin/base/public/nsIPluginInstance.idl @@ -35,16 +35,6 @@ * * ***** END LICENSE BLOCK ***** */ -/** - * nsIPluginInstance - * - * @status DEPRECATED - * - * Originally published XPCOM Plugin API is now deprecated - * Developers are welcome to use NPAPI, please refer to: - * http://mozilla.org/projects/plugins/ - */ - #include "nsISupports.idl" #include "nsIPluginStreamListener.idl" diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index d36ff4333d26..07390a152b9c 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -348,7 +348,7 @@ ConvertGeckoRectToMacRect(const nsIntRect& aRect, Rect& outMacRect) // Flips a screen coordinate from a point in the cocoa coordinate system (bottom-left rect) to a point // that is a "flipped" cocoa coordinate system (starts in the top-left). static inline void -FlipCocoaScreenCoordinate (NSPoint &inPoint) +FlipCocoaScreenCoordinate(NSPoint &inPoint) { inPoint.y = nsCocoaUtils::FlippedScreenY(inPoint.y); } @@ -4087,20 +4087,20 @@ static PRBool ConvertUnicodeToCharCode(PRUnichar inUniChar, unsigned char* outCh } -static void ConvertCocoaKeyEventToMacEvent(NSEvent* cocoaEvent, EventRecord& macEvent, PRUint32 keyType = 0) +static void ConvertCocoaKeyEventToCarbonEvent(NSEvent* cocoaEvent, EventRecord& pluginEvent, PRUint32 keyType = 0) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; UInt32 charCode = 0; if ([cocoaEvent type] == NSFlagsChanged) { - macEvent.what = keyType == NS_KEY_DOWN ? keyDown : keyUp; + pluginEvent.what = keyType == NS_KEY_DOWN ? keyDown : keyUp; } else { if ([[cocoaEvent characters] length] > 0) charCode = [[cocoaEvent characters] characterAtIndex:0]; if ([cocoaEvent type] == NSKeyDown) - macEvent.what = [cocoaEvent isARepeat] ? autoKey : keyDown; + pluginEvent.what = [cocoaEvent isARepeat] ? autoKey : keyDown; else - macEvent.what = keyUp; + pluginEvent.what = keyUp; } if (charCode >= 0x0080) { @@ -4125,10 +4125,10 @@ static void ConvertCocoaKeyEventToMacEvent(NSEvent* cocoaEvent, EventRecord& mac break; } } - macEvent.message = (charCode & 0x00FF) | (nsCocoaUtils::GetCocoaEventKeyCode(cocoaEvent) << 8); - macEvent.when = ::TickCount(); - ::GetGlobalMouse(&macEvent.where); - macEvent.modifiers = ::GetCurrentEventKeyModifiers(); + pluginEvent.message = (charCode & 0x00FF) | (nsCocoaUtils::GetCocoaEventKeyCode(cocoaEvent) << 8); + pluginEvent.when = ::TickCount(); + ::GetGlobalMouse(&pluginEvent.where); + pluginEvent.modifiers = ::GetCurrentEventKeyModifiers(); NS_OBJC_END_TRY_ABORT_BLOCK; } @@ -5050,7 +5050,7 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers) // might send the keyDown event with wrong keyboard layout if other // keyboard layouts are already loaded. In that case, the native event // doesn't match to this gecko event... - ConvertCocoaKeyEventToMacEvent(mCurKeyEvent, macEvent); + ConvertCocoaKeyEventToCarbonEvent(mCurKeyEvent, macEvent); geckoEvent.nativeMsg = &macEvent; geckoEvent.isShift = (nsCocoaUtils::GetCocoaEventModifierFlags(mCurKeyEvent) & NSShiftKeyMask) != 0; if (!IsPrintableChar(geckoEvent.charCode)) { @@ -5467,7 +5467,7 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf) // create native EventRecord for use by plugins EventRecord macEvent; - ConvertCocoaKeyEventToMacEvent(theEvent, macEvent); + ConvertCocoaKeyEventToCarbonEvent(theEvent, macEvent); geckoEvent.nativeMsg = &macEvent; mKeyDownHandled = mGeckoChild->DispatchWindowEvent(geckoEvent); @@ -5513,7 +5513,7 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf) // create native EventRecord for use by plugins EventRecord macEvent; - ConvertCocoaKeyEventToMacEvent(theEvent, macEvent); + ConvertCocoaKeyEventToCarbonEvent(theEvent, macEvent); geckoEvent.nativeMsg = &macEvent; mKeyPressHandled = mGeckoChild->DispatchWindowEvent(geckoEvent); @@ -5550,7 +5550,7 @@ static const char* ToEscapedString(NSString* aString, nsCAutoString& aBuf) // create native EventRecord for use by plugins EventRecord macEvent; - ConvertCocoaKeyEventToMacEvent(theEvent, macEvent); + ConvertCocoaKeyEventToCarbonEvent(theEvent, macEvent); geckoEvent.nativeMsg = &macEvent; mKeyPressHandled = mGeckoChild->DispatchWindowEvent(geckoEvent); @@ -5704,7 +5704,7 @@ static BOOL keyUpAlreadySentKeyDown = NO; nsKeyEvent keyUpEvent(PR_TRUE, NS_KEY_UP, nsnull); [self convertCocoaKeyEvent:theEvent toGeckoEvent:&keyUpEvent]; EventRecord macKeyUpEvent; - ConvertCocoaKeyEventToMacEvent(theEvent, macKeyUpEvent); + ConvertCocoaKeyEventToCarbonEvent(theEvent, macKeyUpEvent); keyUpEvent.nativeMsg = &macKeyUpEvent; mGeckoChild->DispatchWindowEvent(keyUpEvent); return; @@ -5730,7 +5730,7 @@ static BOOL keyUpAlreadySentKeyDown = NO; // create native EventRecord for use by plugins EventRecord macEvent; - ConvertCocoaKeyEventToMacEvent(nativeKeyDownEvent, macEvent); + ConvertCocoaKeyEventToCarbonEvent(nativeKeyDownEvent, macEvent); geckoEvent.nativeMsg = &macEvent; keyDownHandled = mGeckoChild->DispatchWindowEvent(geckoEvent); @@ -5758,7 +5758,7 @@ static BOOL keyUpAlreadySentKeyDown = NO; // create native EventRecord for use by plugins EventRecord macEvent; - ConvertCocoaKeyEventToMacEvent(nativeKeyDownEvent, macEvent); + ConvertCocoaKeyEventToCarbonEvent(nativeKeyDownEvent, macEvent); geckoEvent.nativeMsg = &macEvent; mGeckoChild->DispatchWindowEvent(geckoEvent); @@ -5771,7 +5771,7 @@ static BOOL keyUpAlreadySentKeyDown = NO; // create native EventRecord for use by plugins EventRecord macEvent; - ConvertCocoaKeyEventToMacEvent(theEvent, macEvent); + ConvertCocoaKeyEventToCarbonEvent(theEvent, macEvent); geckoEvent.nativeMsg = &macEvent; mGeckoChild->DispatchWindowEvent(geckoEvent); @@ -5955,7 +5955,7 @@ static BOOL keyUpAlreadySentKeyDown = NO; // create native EventRecord for use by plugins EventRecord macEvent; - ConvertCocoaKeyEventToMacEvent(theEvent, macEvent, message); + ConvertCocoaKeyEventToCarbonEvent(theEvent, macEvent, message); geckoEvent.nativeMsg = &macEvent; mGeckoChild->DispatchWindowEvent(geckoEvent);