Various fixes for nsChildView, including uninitialized member pointer. b=553702 r=roc
authorJosh Aas <joshmoz@gmail.com>
Sat, 20 Mar 2010 11:05:47 -0400
changeset 39656 1cce6e1d30891ffe01a8d15640d7923f3f9a7bec
parent 39655 d03261d7898a4fb4c1c1a3581461453a33309c67
child 39657 df8d581bf4793839d3fdcfeb45ee8679ba76fe24
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs553702
milestone1.9.3a4pre
Various fixes for nsChildView, including uninitialized member pointer. b=553702 r=roc
widget/src/cocoa/nsChildView.h
widget/src/cocoa/nsChildView.mm
--- a/widget/src/cocoa/nsChildView.h
+++ b/widget/src/cocoa/nsChildView.h
@@ -65,16 +65,17 @@
 #import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 
 class gfxASurface;
 class nsChildView;
 class nsCocoaWindow;
 union nsPluginPort;
 
+#ifndef NP_NO_CARBON
 enum {
   // Currently focused ChildView (while this TSM document is active).
   // Transient (only set while TSMProcessRawKeyEvent() is processing a key
   // event), and the ChildView will be retained and released around the call
   // to TSMProcessRawKeyEvent() -- so it can be weak.
   kFocusedChildViewTSMDocPropertyTag  = 'GKFV', // type ChildView* [WEAK]
 };
 
@@ -85,16 +86,17 @@ enum {
 //
 // Calling TSMProcessRawKeyEvent() from ChildView's keyDown: and keyUp:
 // methods (when the ChildView is a plugin view) bypasses Cocoa's IME
 // infrastructure and (instead) causes Carbon TSM events to be sent on each
 // NSKeyDown event.  We install a Carbon event handler
 // (PluginKeyEventsHandler()) to catch these events and pass them to Gecko
 // (which in turn passes them to the plugin).
 extern "C" long TSMProcessRawKeyEvent(EventRef carbonEvent);
+#endif // NP_NO_CARBON
 
 @interface NSEvent (Undocumented)
 
 // Return Cocoa event's corresponding Carbon event.  Not initialized (on
 // synthetic events) until the OS actually "sends" the event.  This method
 // has been present in the same form since at least OS X 10.2.8.
 - (EventRef)_eventRef;
 
@@ -146,21 +148,23 @@ extern "C" long TSMProcessRawKeyEvent(Ev
   BOOL mPendingFullDisplay;
 
   // Holds our drag service across multiple drag calls. The reference to the
   // service is obtained when the mouse enters the view and is released when
   // the mouse exits or there is a drop. This prevents us from having to
   // re-establish the connection to the service manager many times per second
   // when handling |draggingUpdated:| messages.
   nsIDragService* mDragService;
-  
+
+#ifndef NP_NO_CARBON
   // For use with plugins, so that we can support IME in them.  We can't use
   // Cocoa TSM documents (those created and managed by the NSTSMInputContext
   // class) -- for some reason TSMProcessRawKeyEvent() doesn't work with them.
   TSMDocumentID mPluginTSMDoc;
+#endif
 
   // Simple gestures support
   //
   // mGestureState is used to detect when Cocoa has called both
   // magnifyWithEvent and rotateWithEvent within the same
   // beginGestureWithEvent and endGestureWithEvent sequence. We
   // discard the spurious gesture event so as not to confuse Gecko.
   //
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -458,16 +458,17 @@ static void DebugPrintAllKeyboardLayouts
 nsChildView::nsChildView() : nsBaseWidget()
 , mView(nsnull)
 , mParentView(nsnull)
 , mParentWidget(nsnull)
 , mVisible(PR_FALSE)
 , mDrawing(PR_FALSE)
 , mPluginDrawing(PR_FALSE)
 , mPluginIsCG(PR_FALSE)
+, mPluginInstanceOwner(nsnull)
 {
 #ifdef PR_LOGGING
   if (!sCocoaLog) {
     sCocoaLog = PR_NewLogModule("nsCocoaWidgets");
 #ifdef DEBUG
     DebugPrintAllKeyboardLayouts();
 #endif // DEBUG
   }
@@ -2168,17 +2169,19 @@ NSEvent* gLastDragMouseDownEvent = nil;
 
     // initialization for NSTextInput
     mMarkedRange.location = NSNotFound;
     mMarkedRange.length = 0;
 
     mLastMouseDownEvent = nil;
     mDragService = nsnull;
 
+#ifndef NP_NO_CARBON
     mPluginTSMDoc = nil;
+#endif
 
     mGestureState = eGestureState_None;
     mCumulativeMagnification = 0.0;
     mCumulativeRotation = 0.0;
 
     [self setFocusRingType:NSFocusRingTypeNone];
   }
   
@@ -5071,17 +5074,17 @@ static const char* ToEscapedString(NSStr
 #ifndef NP_NO_CARBON
 // Create a TSM document for use with plugins, so that we can support IME in
 // them.  Once it's created, if need be (re)activate it.  Some plugins (e.g.
 // the Flash plugin running in Camino) don't create their own TSM document --
 // without which IME can't work.  Others (e.g. the Flash plugin running in
 // Firefox) create a TSM document that (somehow) makes the input window behave
 // badly when it contains more than one kind of input (say Hiragana and
 // Romaji).  (We can't just use the per-NSView TSM documents that Cocoa
-// provices (those created and managed by the NSTSMInputContext class) -- for
+// provides (those created and managed by the NSTSMInputContext class) -- for
 // some reason TSMProcessRawKeyEvent() doesn't work with them.)
 - (void)activatePluginTSMDoc
 {
   if (!mPluginTSMDoc) {
     // Create a TSM document that supports both non-Unicode and Unicode input.
     // Though [ChildView processPluginKeyEvent:] only sends Mac char codes to
     // the plugin, this makes the input window behave better when it contains
     // more than one kind of input (say Hiragana and Romaji).  This is what