mInstance->SetWindow(mPluginWindow);
void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, PRUint32 ndc){  if (!mInstance)    return; #if defined(XP_MAC) || defined(XP_MACOSX)#ifdef DO_DIRTY_INTERSECT   // aDirtyRect isn't always correct, see bug 56128  nsPoint rel(aDirtyRect.x, aDirtyRect.y);  nsPoint abs(0,0);  nsCOMPtr<nsIWidget> containerWidget;  // Convert dirty rect relative coordinates to absolute and also get the containerWidget  ConvertRelativeToWindowAbsolute(mOwner, rel, abs, *getter_AddRefs(containerWidget));  nsRect absDirtyRect = nsRect(abs.x, abs.y, aDirtyRect.width, aDirtyRect.height);  // Convert to absolute pixel values for the dirty rect  nsRect absDirtyRectInPixels;  ConvertTwipsToPixels(*mContext, absDirtyRect, absDirtyRectInPixels);#endif  nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);  if (pluginWidget && NS_SUCCEEDED(pluginWidget->StartDrawPlugin())) {    nsPluginPort* pluginPort = FixUpPluginWindow(ePluginPaintEnable);    if (pluginPort) {      // we have to call SetWindow here to get RealPlayer to correctly update      // its position      mInstance->SetWindow(mPluginWindow);      WindowRef  nativeWindowRef = ::GetWindowFromPort(pluginPort->port);            EventRecord updateEvent;      InitializeEventRecord(&updateEvent);      updateEvent.what = updateEvt;      updateEvent.message = UInt32(nativeWindowRef);          nsPluginEvent pluginEvent = { &updateEvent, nsPluginPlatformWindowRef(nativeWindowRef) };      PRBool eventHandled = PR_FALSE;      mInstance->HandleEvent(&pluginEvent, &eventHandled);    }    pluginWidget->EndDrawPlugin();  }#endif#ifdef XP_WIN  nsPluginWindow * window;  GetWindow(window);  nsRect relDirtyRect = nsRect(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);  nsRect relDirtyRectInPixels;  ConvertTwipsToPixels(*mContext, relDirtyRect, relDirtyRectInPixels);  // we got dirty rectangle in relative window coordinates, but we  // need it in absolute units and in the (left, top, right, bottom) form  RECT drc;  drc.left   = relDirtyRectInPixels.x + window->x;  drc.top    = relDirtyRectInPixels.y + window->y;  drc.right  = drc.left + relDirtyRectInPixels.width;  drc.bottom = drc.top + relDirtyRectInPixels.height;  nsPluginEvent pluginEvent;  pluginEvent.event = WM_PAINT;  pluginEvent.wParam = (uint32)ndc;  pluginEvent.lParam = (uint32)&drc;  PRBool eventHandled = PR_FALSE;  mInstance->HandleEvent(&pluginEvent, &eventHandled);#endif}